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

Change absolute symlinks resulting from build to relative? #9502

Closed
sbromberger opened this issue Dec 30, 2014 · 7 comments
Closed

Change absolute symlinks resulting from build to relative? #9502

sbromberger opened this issue Dec 30, 2014 · 7 comments
Labels
building Build system, or building Julia or its dependencies won't change Indicates that work won't continue on an issue or pull request

Comments

@sbromberger
Copy link
Contributor

Consider the results of the following build (via git clone) where julia was cloned into /Users/seth/dev/julia/julia (the "clone root"):

seth@schroeder:~/dev/julia/julia$ ls -l julia
lrwxr-xr-x  1 seth  staff  41 Dec 30 09:06 julia@ -> /Users/seth/dev/julia/julia/usr/bin/julia
seth@schroeder:~/dev/julia/julia$ ls -l usr/share/julia
total 16
drwxr-xr-x  4 seth  staff  136 Dec 30 08:43 ./
drwxr-xr-x  6 seth  staff  204 Dec 30 08:59 ../
lrwxr-xr-x  1 seth  staff   32 Dec 30 08:43 base@ -> /Users/seth/dev/julia/julia/base
lrwxr-xr-x  1 seth  staff   32 Dec 30 08:43 test@ -> /Users/seth/dev/julia/julia/test

These links use absolute paths, so that relocating the clone root is now impossible*.

Much better, if possible, would be to create the symlinks relative to the clone root, like so:

seth@schroeder:~/dev/julia/julia$ ls -l julia
lrwxr-xr-x  1 seth  staff  41 Dec 30 09:06 julia@ -> ./usr/bin/julia
seth@schroeder:~/dev/julia/julia$ ls -l usr/share/julia
total 16
drwxr-xr-x  4 seth  staff  136 Dec 30 08:43 ./
drwxr-xr-x  6 seth  staff  204 Dec 30 08:59 ../
lrwxr-xr-x  1 seth  staff   32 Dec 30 08:43 base@ -> ../../../base
lrwxr-xr-x  1 seth  staff   32 Dec 30 08:43 test@ -> ../../../test

*impossible in that things break. See #9493 (comment) for an example.

@pao pao changed the title Change absolute paths in build to relative ones? Change absolute symlinks resulting from build to relative? Dec 30, 2014
@pao pao added the building Build system, or building Julia or its dependencies label Dec 30, 2014
@tkelman
Copy link
Contributor

tkelman commented Dec 30, 2014

If it works everywhere, sure, worth trying. It might be that NTFS junctions require absolute paths, I forget the exact reason. To point people in the right direction, these are created by symlink_target here

julia/Makefile

Line 29 in 3758b81

$(foreach link,base test,$(eval $(call symlink_target,$(link),$(build_datarootdir)/julia)))
, which is defined here

julia/Make.inc

Lines 801 to 820 in 837611a

define symlink_target
CLEAN_TARGETS += clean-$(2)/$(1)
clean-$$(abspath $(2)/$(1)):
ifeq ($(BUILD_OS), WINNT)
@-cmd //C rmdir $$(call mingw_to_dos,$(2)/$(1),cd $(2) &&)
else
@-rm $$(abspath $(2)/$(1))
endif
$$(subst $$(abspath $(JULIAHOME))/,,$$(abspath $(2)/$(1))): $$(abspath $(2)/$(1))
$$(abspath $(2)/$(1)): | $$(abspath $(2))
ifeq ($(BUILD_OS), WINNT)
@cmd //C mklink //J $$(call mingw_to_dos,$(2)/$(1),cd $(2) &&) $$(call mingw_to_dos,$(1),)
else ifneq (,$(findstring CYGWIN,$(BUILD_OS)))
@cmd /C mklink /J $$(call cygpath_w,$(2)/$(1)) $$(call cygpath_w,$(1))
else ifdef JULIA_VAGRANT_BUILD
@cp -R $$(abspath $(1)) $$@
else
@ln -sf $$(abspath $(1)) $$@
endif
endef

@vtjnash
Copy link
Member

vtjnash commented Dec 31, 2014

moving a build root is not in general possible without a complete wipe of all of the dependencies also, since most build systems enforce that the install target be an absolute path.

@tkelman
Copy link
Contributor

tkelman commented Dec 31, 2014

right, forgot about all the rpath and install_name_tool manipulations we have to do. so maybe this is a case of "don't do that"?

@vtjnash
Copy link
Member

vtjnash commented Dec 31, 2014

yes. plus the absolute path gets hardcoded into the autotools and cmake build files in deps. i'm not really sure there a good way around that either (perhaps if everything is cmake?)

@ihnorton
Copy link
Member

(perhaps if everything is cmake?)

Nope, CMake hardcodes absolutely everything.

@vtjnash
Copy link
Member

vtjnash commented Dec 31, 2014

good to know.

closing this as "nobody with a moderately complex build system allows this because it's considered too insane and dangerous"

@vtjnash vtjnash closed this as completed Dec 31, 2014
@vtjnash vtjnash added the won't change Indicates that work won't continue on an issue or pull request label Dec 31, 2014
@nalimilan
Copy link
Member

But note that we went to great lengths with @staticfloat to ensure that you can change PREFIX when calling make install, as e.g. the GNU guidelines recommend. The rpath is updated as needed. So this use case should definitely work as long as the dependencies handle it.

(Though all of this applies to the result of make install, not to the build tree itself.)

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 won't change Indicates that work won't continue on an issue or pull request
Projects
None yet
Development

No branches or pull requests

6 participants