Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile version of build_deps.sh #417

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

manasij7479
Copy link
Collaborator

No description provided.

Copy link
Contributor

@pranavk pranavk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.PHONY thing seems problematic. Rest looks good to me; i will test it tomorrow and let you know if I face some problems.

cp $(llvm_builddir)/lib/libgtest_main.a $(llvm_installdir)/lib/
cp $(llvm_builddir)/lib/libgtest.a $(llvm_installdir)/lib/

llvm-build:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably needs to be .PHONY to keep llvm-build target always out-of-date.

make -C $(llvm_builddir) -j4;\
make -C $(llvm_builddir) -j4 install;\
fi
alive2 : third_party/alive2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same .PHONY thing as above. There are other targets in this file as well which are not marked as .PHONY. I guess the problem will start appearing when there are files in the filesystem with exact same name as these targets. make won't build these targets because it will think that these targets are already built (even though you want them to be built unconditionally everytime).

NINJA=ninja
# Override NINJA from the command line with something like NINJA="ninja -j1" if you are running out of memory

deps : alive2 llvm hiredis klee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: let's be consistent and not have any space before the colon.

@manasij7479
Copy link
Collaborator Author

Thanks for the comments, will fix and test.

@regehr
Copy link
Collaborator

regehr commented Jan 21, 2019

I'm still not sure what problem this change is intended to solve

@regehr
Copy link
Collaborator

regehr commented Jan 21, 2019

also, if we're going to do this, I'd like the full set of dependencies encoded in the makefile
for example, if we upgrade souper and it requires a different version of LLVM, then that should trigger a rebuild of LLVM

@regehr
Copy link
Collaborator

regehr commented Jan 21, 2019

and then this all needs to be tested

@manasij7479
Copy link
Collaborator Author

I'm still not sure what problem this change is intended to solve

My reason: If llvm build is interrupted for any reason, it is annoying to nuke third_party and start from scratch. This makefile cleanly splits up cloning+cmake and the build steps, so that the second one can be resumed without redoing the first.

full set of dependencies encoded in the makefile

Will do.
Maybe put the LLVM version/url information in a file and use that as a dependency?
Is there a better solution? (cc: @pranavk )

@regehr
Copy link
Collaborator

regehr commented Jan 21, 2019

this seems reasonable

to be clear, I'm not excited about this PR since the use case is not compelling -- but I'll merge it if there's some added value beyond picking up interrupted builds of dependencies


deps : alive2 llvm hiredis klee

llvm : third_party/llvm llvm-build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't rely on the order of dependencies here. if you want llvm-build to be executed after third_party/llvm, then i think better to make third_party/llvm a dependency of llvm-build. Parallel make can mess things up otherwise. See: https://stackoverflow.com/questions/9159960/order-of-processing-components-in-makefile/9160175#9160175

@pranavk
Copy link
Contributor

pranavk commented Jan 21, 2019

Will do.
Maybe put the LLVM version/url information in a file and use that as a dependency?
Is there a better solution? (cc: @pranavk )

Using the llvm version info as name of the file (eg: llvm70) and touch it in llvm directory sounds like should work. When souper depends on a new llvm version, it will try to find a llvm80 in third_party/llvm/ which it won't find in which case we will trigger the llvm-build.

@regehr
Copy link
Collaborator

regehr commented Jan 21, 2019

sounds good-- I want you to test this though!

@manasij7479
Copy link
Collaborator Author

@LebedevRI Do you have any suggestions for improving this Makefile?

Copy link
Contributor

@LebedevRI LebedevRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LebedevRI Do you have any suggestions for improving this Makefile?

Hm, not particularly, i haven't written all that many makefiles by hand.
The one general comment was already said i think - unless this is going to replace
the existing build_deps.sh, they will get out of sync eventually..

mkdir -p $(llvm_builddir)

if [ -n "`which ninja`" ]; then\
$(NINJA) -C $(llvm_builddir);\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need something like set -e, so we abort on the first failure?

@pranavk
Copy link
Contributor

pranavk commented Jan 24, 2019

Just had a OOM while building debug build of souper (LLVM was being built). This PR would help greatly because I had to hack the current build_deps.sh script so that it doesn't start compiling LLVM from scratch.

@regehr
Copy link
Collaborator

regehr commented Jan 28, 2019

@pranavk what would happen if I was in the middle of cloning LLVM and my connection got interrupted-- would this makefile gracefully recover from that or would it simply see that the directory exists and move forward, failing in a perhaps-confusing way?

@pranavk
Copy link
Contributor

pranavk commented Jan 28, 2019

i am not sure about this makefile; i don't think so. i guess manasij is working on it and will update this PR soon; putting those .PHONY attributes to make sure that we unconditionally process some targets should fix the issue. i'll have a look and test it after he updates this PR.

@manasij7479
Copy link
Collaborator Author

manasij7479 commented Jan 28, 2019 via email

@pranavk
Copy link
Contributor

pranavk commented Jan 28, 2019

how about an 'if' condition in the target that checks if .git/ directory exists. If (exists), git pull, otherwise clone? Or something along those lines.

@regehr
Copy link
Collaborator

regehr commented Jan 28, 2019

it's clear that all of these issues can be solved
the question is whether the solutions are worth the complexity and whether you guys can spend your time a better way....

@regehr
Copy link
Collaborator

regehr commented Jan 28, 2019

I'm just saying that the thing being solved here isn't something that has caused me pain over multiple years of being a souper developer, and it's very likely to not cause you guys much pain either, once you get your machine issues straightened out

@regehr
Copy link
Collaborator

regehr commented Jan 28, 2019

and also there are plenty of corner cases where you can easily make things worse, whereas "nuke it all and rebuild" is very easy to think about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants