diff options
| author | Haitao Li <lihaitao@gmail.com> | 2011-10-16 17:02:06 +0800 |
|---|---|---|
| committer | Haitao Li <lihaitao@gmail.com> | 2011-10-16 17:12:30 +0800 |
| commit | ad5014bf4c81fdfd6c382d2f2df1e9f824787dde (patch) | |
| tree | 3b05061d87aa5a22578347f8d15d11b353ab1689 /src/comp | |
| parent | 280bc5633d77b91253b0a0d60c78b9afdbcb59e5 (diff) | |
| download | rust-ad5014bf4c81fdfd6c382d2f2df1e9f824787dde.tar.gz rust-ad5014bf4c81fdfd6c382d2f2df1e9f824787dde.zip | |
Fix link error by explicitly link needed DSOs
Building Rust(version 280bc56) on Ubuntu 11.10 failed with link error, like: compile_and_link: stage0/lib/rustc/i686-unknown-linux-gnu/lib/libstd.so compile_and_link: stage0/lib/rustc/i686-unknown-linux-gnu/bin/rustc /local/src/rust/build/stage0/lib/rustc/i686-unknown-linux-gnu/lib/librustrt.so: undefined reference to `clock_gettime' collect2: ld returned 1 exit status error: linking with gcc failed with code 1 GCC toolchain released by Ubuntu 11.10 introduced a few compiler flags that are different with upstream GCC[1]. Flags "-Wl,--as-needed' and '-Wl,--no-copy-dt-needed-entries' are passed by default. Function clock_gettime from librt is used by librustrt, indirectly by rustc. It is necessary to explicitly pass the "-lrt" flags when building rustc. Please note since the toolchain changes will be the default in the next release(2.22) of binutils, this is not actually a Debian/Ubuntu specific issue. 1. https://wiki.ubuntu.com/OneiricOcelot/ReleaseNotes#GCC_4.6_Toolchain Signed-off-by: Haitao Li <lihaitao@gmail.com>
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/back/link.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs index 4a7e238ae55..2162e67724e 100644 --- a/src/comp/back/link.rs +++ b/src/comp/back/link.rs @@ -582,7 +582,7 @@ fn link_binary(sess: session::session, gcc_args += ["-lm", main]; } - gcc_args += ["-lrustrt"]; + gcc_args += ["-lrustrt", "-lrt"]; gcc_args += rpath::get_rpath_flags(sess, saved_out_filename); |
