Skip to content

Broken install when configured with a custom --prefix #16733

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

Closed
jasonroelofs opened this issue Aug 24, 2014 · 7 comments
Closed

Broken install when configured with a custom --prefix #16733

jasonroelofs opened this issue Aug 24, 2014 · 7 comments

Comments

@jasonroelofs
Copy link

I'm trying to build Rust from source on Mac OS X 10.9 installing it to a custom prefix (/opt/rust because /usr/local/ is managed by homebrew). I have successfully done brew install rust --HEAD, which works with the defaults and gives me a valid Rust install. However, my install to /opt/rust leads to an inability to find library files (and oddly is looking for stage1 library builds).

Steps to get to where I am

git clone ...
./configure --prefix=/opt/rust --enable-clang --disable-rpath
make
sudo make install

Installation succeeds but running the installed rustc fails.

Following other tickets found here, I made sure to set my DYLD_LIBRARY_PATH and my LD_LIBRARY_PATH for safe measure to the custom install directory.

] which rustc
/opt/rust/bin/rustc

] rustc -v
dyld: Library not loaded: x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libnative-4e7c5e5c.dylib
  Referenced from: /opt/rust/bin/rustc
  Reason: image not found
Trace/BPT trap: 5

] echo $DYLD_LIBRARY_PATH
/opt/rust/lib

] echo $LD_LIBRARY_PATH
/opt/rust/lib

] ls /opt/rust/lib/
libarena-4e7c5e5c.dylib      liblog-4e7c5e5c.dylib        librustc_llvm-4e7c5e5c.dylib libsyntax-4e7c5e5c.dylib
libdebug-4e7c5e5c.dylib      libnative-4e7c5e5c.dylib     librustdoc-4e7c5e5c.dylib    libterm-4e7c5e5c.dylib
libflate-4e7c5e5c.dylib      librbml-4e7c5e5c.dylib       librustrt-4e7c5e5c.dylib     libtest-4e7c5e5c.dylib
libfmt_macros-4e7c5e5c.dylib libregex-4e7c5e5c.dylib      libserialize-4e7c5e5c.dylib  libtime-4e7c5e5c.dylib
libgetopts-4e7c5e5c.dylib    librustc-4e7c5e5c.dylib      libstd-4e7c5e5c.dylib        rustlib
libgraphviz-4e7c5e5c.dylib   librustc_back-4e7c5e5c.dylib libsync-4e7c5e5c.dylib

] otool -L /opt/rust/bin/rustc
/opt/rust/bin/rustc:
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libnative-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librustc-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libarena-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librustc_llvm-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librbml-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libtime-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libgraphviz-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librustc_back-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libflate-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libsyntax-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libdebug-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libterm-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libserialize-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/liblog-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libfmt_macros-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libgetopts-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libstd-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libsync-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librustrt-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
    /usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)

It seems that there's something wrong with the build process when using a custom prefix, such that the system doesn't take the final step of ensuring the binary will look for the various libraries in their installed locations.

In what may be a further help, the build system seems to be installing the binary from stage2 which itself is linked back to the stage1 libraries.

] otool -L /Users/roelofs/Source/rust/x86_64-apple-darwin/stage2/bin/rustc
/Users/roelofs/Source/rust/x86_64-apple-darwin/stage2/bin/rustc:
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libnative-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librustc-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libarena-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librustc_llvm-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librbml-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libtime-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libgraphviz-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librustc_back-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libflate-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libsyntax-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libdebug-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libterm-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libserialize-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/liblog-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libfmt_macros-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libgetopts-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libstd-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/libsync-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librustrt-4e7c5e5c.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
    /usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)

My build's stage3 directory is nothing but empty folders.

Thanks!

@pnkfelix
Copy link
Member

cc me. I think I've been running into this problem without realizing it.

@jasonroelofs
Copy link
Author

So not sure what's going on. If I brew install rust --HEAD, which uses --prefix, the install goes through perfectly fine. However if I git clone and built it myself, I get this broken state. So I haven't fully ruled out a problem on my machine yet, but something is strange.

@jasonroelofs
Copy link
Author

Progress! brew install rust works because Homebrew itself fixes library linking paths with install_name_tool. I am just learning about this tool and how its used but I think the build install script needs to do this itself. I downloaded the latest available nightly binaries for OSX 10.9 and it has the same problem, bad library linking.

@jasonroelofs
Copy link
Author

Alright something is definitely messed up with my machine. I was able to install rust with a custom prefix just fine on another Mac.

I'll close this for now, it is definitely my problem. Sorry for the bother.

@pnkfelix
Copy link
Member

pnkfelix commented Sep 1, 2014

@jasonroelofs out of curiosity did the other machine also have Homebrew? Just curious about own past observations

@jasonroelofs
Copy link
Author

The other machine did not have homebrew, but for this situation specifically, I think it came down to a simple mis-type that ensured my DYLD_LIBRARY_PATH wasn't exported properly:

DYLD_LIBRARY_PATH=/opt/rust/lib

vs

export DYLD_LIBRARY_PATH=/opt/rust/lib

Very important distinction!

@eonil
Copy link

eonil commented Dec 6, 2014

@jasonroelofs Thanks for the last comment. I had same problem and could fix by adding export. It was so important!

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

No branches or pull requests

3 participants