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

Build: fix output directory when specified with O= #30431

Closed
wants to merge 1 commit into from

Conversation

fredrikekre
Copy link
Member

Fix abspath call when output directory is specified with O= and SRCDIR is not set.

@fredrikekre fredrikekre added building Build system, or building Julia or its dependencies backport pending 1.0 labels Dec 18, 2018
@fredrikekre fredrikekre added the bugfix This change fixes an existing bug label Dec 18, 2018
@staticfloat
Copy link
Member

@fredrikekre does this at least fix the issue you were seeing?

@fredrikekre
Copy link
Member Author

Yes.

Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

How would SRCDIR manage not to get set? This will not do the same task.

@staticfloat
Copy link
Member

SRCDIR gets set much later. This happens as one of the first things in the Makefile. Can you explain in what situation this will not do the same task?

@vtjnash
Copy link
Member

vtjnash commented Dec 18, 2018

SRCDIR is the first line of the Makefiles—it always gets set first. This won't do the same task in any situation, since it's computing a function of a different value.

@staticfloat
Copy link
Member

SRCDIR is not defined within Make.inc; so its usage here is wrong. It will always expand to an empty string, due to the usage of :=. There is no situation in which this line of code will be correct; so we either need to define a value for SRCDIR earlier, remove the usage of :=, or manually insert something that will compute the value that SRCDIR "should" have had, which is what this PR does.

@vtjnash
Copy link
Member

vtjnash commented Dec 18, 2018

SRCDIR is not defined within Make.inc; so its usage here is wrong. It will always expand to an empty string, due to the usage of :=. There is no situation in which this line of code will be correct

Make.inc doesn't define any rules and is never used, so it should never expand to the empty string

or manually insert something that will compute the value that SRCDIR "should" have had, which is what this PR does.

That is not what this PR does. If it was that easy to compute, we would have done that originally.

@staticfloat
Copy link
Member

I think what you're trying to say is that SRCDIR should be set in all calling Makefiles before including Make.inc, and it should therefore be set by the time we get to this line in Make.inc. In that case, could you explain what the proper value to set SRCDIR is for the top-level Makefile, because there is no SRCDIR set in that Makefile.

@fredrikekre
Copy link
Member Author

fredrikekre commented Dec 18, 2018

Right, defining SRCDIR in the main Makefile, before

include $(JULIAHOME)/Make.inc
will probably also fix the issue.

Edit: It does fix the problem with this diff:

diff --git a/Makefile b/Makefile
index ea67778..df9eb03 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
 JULIAHOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
+SRCDIR := $(JULIAHOME)
 include $(JULIAHOME)/Make.inc
 
 VERSDIR := v`cut -d. -f1-2 < $(JULIAHOME)/VERSION`

@fredrikekre
Copy link
Member Author

Demonstration of the problem:

[~/sandbox]$ git clone https://github.com/JuliaLang/julia.git julia-source
[~/sandbox]$ export SOURCE=$PWD/julia-source
[~/sandbox]$ export INSTALL=$PWD/julia-install
[~/sandbox]$ make -C $SOURCE O=$INSTALL print-BUILDDIR
make: Entering directory '/home/fredrik/sandbox/julia-source'
BUILDDIR=/home/fredrik/sandbox/julia-install/home/fredrik/sandbox/julia-source <-- ????
make: Leaving directory '/home/fredrik/sandbox/julia-source'

@fredrikekre
Copy link
Member Author

FWIW, there also seems to be some ordering problem:

[ekref@vera2:~]$ make -C $SOURCE O=$INSTALL -j20
Building into /c3se/users/ekref/Vera/julia
find: ‘/c3se/users/ekref/Vera/julia/base’: No such file or directory
find: ‘/c3se/users/ekref/Vera/julia/doc’: No such file or directory
find: ‘/c3se/users/ekref/Vera/julia/base’: No such file or directory
find: ‘/c3se/users/ekref/Vera/julia/usr/share/julia/stdlib/v1.2/*/src’: No such file or directory
make: Entering directory `/c3se/users/ekref/Vera/julia-source'
make: Circular /c3se/users/ekref/Vera/julia/usr/bin <- /c3se/users/ekref/Vera/julia/usr/bin dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/etc/julia <- /c3se/users/ekref/Vera/julia/usr/etc/julia dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/include <- /c3se/users/ekref/Vera/julia/usr/include dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/include/julia <- /c3se/users/ekref/Vera/julia/usr/include/julia dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/lib <- /c3se/users/ekref/Vera/julia/usr/lib dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/lib/julia <- /c3se/users/ekref/Vera/julia/usr/lib/julia dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/libexec <- /c3se/users/ekref/Vera/julia/usr/libexec dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/share/julia <- /c3se/users/ekref/Vera/julia/usr/share/julia dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/share/julia/stdlib <- /c3se/users/ekref/Vera/julia/usr/share/julia/stdlib dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/share/man/man1 <- /c3se/users/ekref/Vera/julia/usr/share/man/man1 dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/tools <- /c3se/users/ekref/Vera/julia/usr/tools dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia <- /c3se/users/ekref/Vera/julia dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/base <- /c3se/users/ekref/Vera/julia/base dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/src <- /c3se/users/ekref/Vera/julia/src dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/ui <- /c3se/users/ekref/Vera/julia/ui dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/doc <- /c3se/users/ekref/Vera/julia/doc dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/deps <- /c3se/users/ekref/Vera/julia/deps dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/stdlib <- /c3se/users/ekref/Vera/julia/stdlib dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/test <- /c3se/users/ekref/Vera/julia/test dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/test/embedding <- /c3se/users/ekref/Vera/julia/test/embedding dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/test/llvmpasses <- /c3se/users/ekref/Vera/julia/test/llvmpasses dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/share/julia/base <- /c3se/users/ekref/Vera/julia/usr/share/julia/base dependency dropped.
make: Circular /c3se/users/ekref/Vera/julia/usr/share/julia/test <- /c3se/users/ekref/Vera/julia/usr/share/julia/test dependency dropped.
Creating usr/etc/julia/startup.jl
Copying in usr/share/man/man1/julia.1
/c3se/users/ekref/Vera/julia-source/contrib/install.sh 755 /c3se/users/ekref/Vera/julia-source/contrib/julia-config.jl /c3se/users/ekref/Vera/julia/usr/share/julia/
make[1]: Entering directory `/c3se/users/ekref/Vera/julia/stdlib'
make[1]: *** No targets specified and no makefile found.  Stop.
make[1]: Leaving directory `/c3se/users/ekref/Vera/julia/stdlib'
make: *** [julia-stdlib] Error 2
make: *** Waiting for unfinished jobs....
make: Leaving directory `/c3se/users/ekref/Vera/julia-source'

which is weird since julia-stdlib depends on DIRS

julia/Makefile

Line 59 in eddcbd7

julia-stdlib: | $(DIRS)
which includes the missing directories, like stdlib. I guess the unfinished jobs from the end of the output is creating those files, because calling make again works, since those file are now existing.

@KristofferC KristofferC mentioned this pull request Dec 20, 2018
52 tasks
This was referenced Dec 30, 2018
@StefanKarpinski StefanKarpinski added triage This should be discussed on a triage call backport 1.0 and removed triage This should be discussed on a triage call backport 1.0 labels Jan 31, 2019
@StefanKarpinski StefanKarpinski added backport 1.0 triage This should be discussed on a triage call and removed backport 1.0 labels Jan 31, 2019
@JeffBezanson
Copy link
Member

Should this be backported?

@fredrikekre
Copy link
Member Author

Would #30431 (comment) be a better fix than what is on this branch now @vtjnash ?

@vtjnash
Copy link
Member

vtjnash commented Feb 4, 2019

That's at least not an incorrect change (unlike this PR), although nobody has yet said why this is a bug. There's a repro above that shows that an ignored variable has an undefined value—but which is normal to not care what happens to the value of something that is not used.

@fredrikekre
Copy link
Member Author

fredrikekre commented Feb 5, 2019

nobody has yet said why this is a bug

You don't think this is a bug: #30431 (comment) ? I would expect

BUILDDIR=/home/fredrik/sandbox/julia-install

and not

BUILDDIR=/home/fredrik/sandbox/julia-install/home/fredrik/sandbox/julia-source

@Keno Keno removed the triage This should be discussed on a triage call label Mar 14, 2019
@Keno
Copy link
Member

Keno commented Mar 14, 2019

@vtjnash says this change is incorrect. It seems like there's still some confusion about that, so ideally let's figure out what the actual issue here is before triaging whether to backport it.

@staticfloat
Copy link
Member

@vtjnash can you explain a little more concretely why this is incorrect?

@vtjnash
Copy link
Member

vtjnash commented Mar 14, 2019

It replaces some code that does the desired thing with code that does something else. The only claim so far seems to be that an unused variable has an undefined value. But yeah, we have many of those.

@staticfloat
Copy link
Member

So let's talk about the incorrect behavior that we see right now then. The fundamental issue is that running make -C $SOURCE O=$INSTALL print-BUILDDIR doesn't work properly due to SRCDIR not being set within the top-level Makefile. Perhaps the proper fix is as @fredrikekre said above, and to define SRCDIR := $(JULIAHOME) within our top-level Makefile.

@vtjnash
Copy link
Member

vtjnash commented Mar 14, 2019

OK, but this can't be the only unused variable (used by some other arbitrary build script) that has a random value. As you point out, SRCDIR and SRCCACHE also don't have the correct values

@staticfloat
Copy link
Member

@fredrikekre I tried to re-create this and I couldn't; if you include the make configure step from the README (Which I don't see in your code traces above) does this work properly for you now?

@KristofferC KristofferC mentioned this pull request Apr 19, 2019
39 tasks
@KristofferC KristofferC mentioned this pull request Aug 26, 2019
55 tasks
@KristofferC KristofferC mentioned this pull request Dec 3, 2019
56 tasks
@vtjnash vtjnash closed this Oct 29, 2020
@vtjnash vtjnash removed backport 1.0 bugfix This change fixes an existing bug labels Oct 29, 2020
@vtjnash vtjnash deleted the fe/fix-build branch October 29, 2020 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants