Home » Uncategorized » rust on alpine

rust on alpine

rust on musl libc still need some work.

https://doc.rust-lang.org/book/advanced-linking.html

$ make
cfg: version 1.11.0-dev (4c45d26a8 2016-06-11)
cfg: build triple x86_64-unknown-linux-gnu
cfg: host triples x86_64-unknown-linux-gnu
cfg: target triples x86_64-unknown-linux-gnu
cfg: host for x86_64-unknown-linux-gnu is x86_64
cfg: os for x86_64-unknown-linux-gnu is unknown-linux-gnu
cfg: have good valgrind for x86_64-unknown-linux-gnu
cfg: using CC=gcc (CFG_CC)
cfg: disabling valgrind run-pass tests
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore
/bin/sh: x86_64-unknown-linux-gnu/stage0/bin/rustc: not found
make: *** [/work/muslrust/mk/target.mk:216: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/stamp.core] Error 127
localhost:/work/muslrust$ ldd ./x86_64-unknown-linux-gnu/stage0/bin/rustc
/lib64/ld-linux-x86-64.so.2 (0x6affd0cbe000)
librustc_driver-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc_driver-a4922355.so (0x6affd06e6000)
libstd-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib/libstd-a4922355.so (0x6affd011e000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x6affd0cbe000)
librustc_passes-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_passes-a4922355.so (0x6affcfeee000)
librustc_borrowck-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_borrowck-a4922355.so (0x6affcfc36000)
librustc_lint-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_lint-a4922355.so (0x6affcf9d6000)
librustc_resolve-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_resolve-a4922355.so (0x6affcf726000)
librustc_typeck-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_typeck-a4922355.so (0x6affcf2ae000)
libsyntax_ext-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//libsyntax_ext-a4922355.so (0x6affcefe6000)
librustc_plugin-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_plugin-a4922355.so (0x6affcedd6000)
librustc_metadata-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_metadata-a4922355.so (0x6affce9c6000)
librustc_save_analysis-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_save_analysis-a4922355.so (0x6affce676000)
librustc_privacy-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_privacy-a4922355.so (0x6affce456000)
librustc_trans-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_trans-a4922355.so (0x6affcdf56000)
librustc_mir-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_mir-a4922355.so (0x6affcdc46000)
librustc_incremental-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_incremental-a4922355.so (0x6affcd9e6000)
librustc_const_eval-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_const_eval-a4922355.so (0x6affcd74e000)
librustc-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc-a4922355.so (0x6affcca96000)
libgetopts-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//libgetopts-a4922355.so (0x6affcc86e000)
libflate-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//libflate-a4922355.so (0x6affcc65e000)
librustc_back-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_back-a4922355.so (0x6affcc416000)
libsyntax-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//libsyntax-a4922355.so (0x6affcba3e000)
libserialize-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//libserialize-a4922355.so (0x6affcb76e000)
liblog-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//liblog-a4922355.so (0x6affcb55e000)
librustc_llvm-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_llvm-a4922355.so (0x6affc917e000)
libgraphviz-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib//libgraphviz-a4922355.so (0x6affc8f66000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x6affd0cbe000)
libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x6affd0cbe000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x6affc8d4e000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x6affd0cbe000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by ./x86_64-unknown-linux-gnu/stage0/bin/../lib/libstd-a4922355.so)
librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x6affd0cbe000)
librustc_data_structures-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib///librustc_data_structures-a4922355.so (0x6affc8af6000)
librustc_const_math-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib///librustc_const_math-a4922355.so (0x6affc88ce000)
librustc_platform_intrinsics-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib///librustc_platform_intrinsics-a4922355.so (0x6affc866e000)
libfmt_macros-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib///libfmt_macros-a4922355.so (0x6affc845e000)
librbml-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib///librbml-a4922355.so (0x6affc8226000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_trans-a4922355.so)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc-a4922355.so)
libterm-a4922355.so => ./x86_64-unknown-linux-gnu/stage0/bin/../lib///libterm-a4922355.so (0x6affc7fe6000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by ./x86_64-unknown-linux-gnu/stage0/bin/../lib//libsyntax-a4922355.so)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by ./x86_64-unknown-linux-gnu/stage0/bin/../lib//liblog-a4922355.so)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_llvm-a4922355.so)
Error relocating ./x86_64-unknown-linux-gnu/stage0/bin/../lib/libstd-a4922355.so: __register_atfork: symbol not found
Error relocating ./x86_64-unknown-linux-gnu/stage0/bin/../lib/libstd-a4922355.so: __rawmemchr: symbol not found
Error relocating ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_llvm-a4922355.so: mallinfo: symbol not found
Error relocating ./x86_64-unknown-linux-gnu/stage0/bin/../lib//librustc_llvm-a4922355.so: backtrace: symbol not found
$

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20121231/160533.html

+++ lib/Support/DynamicLibrary.cpp	(working copy)
@@ -155,7 +155,7 @@
 
 // This macro returns the address of a well-known, explicit symbol
 #define EXPLICIT_SYMBOL(SYM) \
-   if (!strcmp(symbolName, #SYM)) return &SYM
+   if (!strcmp(symbolName, #SYM)) return (void *) &SYM
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s