You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to cross-compile from x86_64-unknown-linux to x86_64-sun-solaris. I have a working C cross toolchain and I cross compiled the std crate basically following the directions from https://github.com/japaric/rust-cross.
However, when I try to cross compile a Rust program, I get a linking error listing many undefined references.
$ rustc --target=x86_64-sun-solaris -C linker=i386-pc-solaris2.10-gcc hello.rs
error: linking with `i386-pc-solaris2.10-gcc` failed: exit code: 1
|
= note: "i386-pc-solaris2.10-gcc" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib" "hello.0.o" "-o" "hello" "-Wl,-z" "-Wl,ignore" "-nodefaultlibs" "-L" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/librand-6da574fadb124927.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libcollections-fac80a156b3b2582.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd_unicode-cc81378608ed406b.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libpanic_unwind-69d2925c4048be57.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libunwind-c7cae34415ee0cd5.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/liballoc-572a80e2714fa765.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/liballoc_system-d9fd2071a44a00ee.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/liblibc-d93d1e292968da46.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libcore-acf490f1deba6df2.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libcompiler_builtins-240ffb02833b10a3.rlib" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt"
= note: /usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::addr::resolve_socket_addr::h8ac620a0339febb7':
std.cgu-0.rs:(.text._ZN3std3net4addr19resolve_socket_addr17h8ac620a0339febb7E+0x2f6): undefined reference to `freeaddrinfo'
std.cgu-0.rs:(.text._ZN3std3net4addr19resolve_socket_addr17h8ac620a0339febb7E+0x30e): undefined reference to `freeaddrinfo'
std.cgu-0.rs:(.text._ZN3std3net4addr19resolve_socket_addr17h8ac620a0339febb7E+0x38d): undefined reference to `freeaddrinfo'
std.cgu-0.rs:(.text._ZN3std3net4addr19resolve_socket_addr17h8ac620a0339febb7E+0x3a9): undefined reference to `freeaddrinfo'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::tcp::TcpStream::peer_addr::hbddec8d8a8642d58':
std.cgu-0.rs:(.text._ZN3std3net3tcp9TcpStream9peer_addr17hbddec8d8a8642d58E+0x8e): undefined reference to `getpeername'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::tcp::TcpStream::local_addr::h127e7dae00bc8df1':
std.cgu-0.rs:(.text._ZN3std3net3tcp9TcpStream10local_addr17h127e7dae00bc8df1E+0x8e): undefined reference to `getsockname'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::tcp::TcpStream::shutdown::h9b20fec0fe5374ea':
std.cgu-0.rs:(.text._ZN3std3net3tcp9TcpStream8shutdown17h9b20fec0fe5374eaE+0x1e): undefined reference to `shutdown'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::tcp::TcpStream::peek::hba75dea67c8306d6':
std.cgu-0.rs:(.text._ZN3std3net3tcp9TcpStream4peek17hba75dea67c8306d6E+0x15): undefined reference to `recv'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::tcp::TcpStream::set_nodelay::h113f2801503c1912':
std.cgu-0.rs:(.text._ZN3std3net3tcp9TcpStream11set_nodelay17h113f2801503c1912E+0x27): undefined reference to `setsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::tcp::TcpStream::set_ttl::h983cdcbb15a98c9e':
std.cgu-0.rs:(.text._ZN3std3net3tcp9TcpStream7set_ttl17h983cdcbb15a98c9eE+0x21): undefined reference to `setsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `_$LT$std..net..tcp..TcpStream$u20$as$u20$std..io..Read$GT$::read::hbecfb598690ae84e':
std.cgu-0.rs:(.text._ZN58_$LT$std..net..tcp..TcpStream$u20$as$u20$std..io..Read$GT$4read17hbecfb598690ae84eE+0x18): undefined reference to `recv'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `_$LT$std..net..tcp..TcpStream$u20$as$u20$std..io..Write$GT$::write::h2b6102fca2a2a4ef':
std.cgu-0.rs:(.text._ZN59_$LT$std..net..tcp..TcpStream$u20$as$u20$std..io..Write$GT$5write17h2b6102fca2a2a4efE+0x18): undefined reference to `send'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `_$LT$$RF$$u27$a$u20$std..net..tcp..TcpStream$u20$as$u20$std..io..Read$GT$::read::h4fe5f74f77e39bb3':
std.cgu-0.rs:(.text._ZN73_$LT$$RF$$u27$a$u20$std..net..tcp..TcpStream$u20$as$u20$std..io..Read$GT$4read17h4fe5f74f77e39bb3E+0x1b): undefined reference to `recv'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `_$LT$$RF$$u27$a$u20$std..net..tcp..TcpStream$u20$as$u20$std..io..Write$GT$::write::h815fc18ab31f1cb5':
std.cgu-0.rs:(.text._ZN74_$LT$$RF$$u27$a$u20$std..net..tcp..TcpStream$u20$as$u20$std..io..Write$GT$5write17h815fc18ab31f1cb5E+0x1b): undefined reference to `send'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::tcp::TcpListener::local_addr::h3e219b074566b327':
std.cgu-0.rs:(.text._ZN3std3net3tcp11TcpListener10local_addr17h3e219b074566b327E+0x8e): undefined reference to `getsockname'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::tcp::TcpListener::set_ttl::h07b1bfcfe7f8208b':
std.cgu-0.rs:(.text._ZN3std3net3tcp11TcpListener7set_ttl17h07b1bfcfe7f8208bE+0x21): undefined reference to `setsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::tcp::TcpListener::set_only_v6::hb3472a8d9f1e331d':
std.cgu-0.rs:(.text._ZN3std3net3tcp11TcpListener11set_only_v617hb3472a8d9f1e331dE+0x27): undefined reference to `setsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::udp::UdpSocket::local_addr::h57daf150b5a33a03':
std.cgu-0.rs:(.text._ZN3std3net3udp9UdpSocket10local_addr17h57daf150b5a33a03E+0x8e): undefined reference to `getsockname'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::udp::UdpSocket::set_broadcast::h7e7ca089ef3c6a7f':
std.cgu-0.rs:(.text._ZN3std3net3udp9UdpSocket13set_broadcast17h7e7ca089ef3c6a7fE+0x27): undefined reference to `setsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::udp::UdpSocket::set_multicast_loop_v4::h35ab5c59c2f88b7c':
std.cgu-0.rs:(.text._ZN3std3net3udp9UdpSocket21set_multicast_loop_v417h35ab5c59c2f88b7cE+0x24): undefined reference to `setsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::udp::UdpSocket::set_multicast_ttl_v4::h8ecacb88046dc792':
std.cgu-0.rs:(.text._ZN3std3net3udp9UdpSocket20set_multicast_ttl_v417h8ecacb88046dc792E+0x21): undefined reference to `setsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::udp::UdpSocket::set_multicast_loop_v6::h1c3c57a3dcb1ad38':
std.cgu-0.rs:(.text._ZN3std3net3udp9UdpSocket21set_multicast_loop_v617h1c3c57a3dcb1ad38E+0x27): undefined reference to `setsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::udp::UdpSocket::set_ttl::h8933d7542730721f':
std.cgu-0.rs:(.text._ZN3std3net3udp9UdpSocket7set_ttl17h8933d7542730721fE+0x21): undefined reference to `setsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o):std.cgu-0.rs:(.text._ZN3std3net3udp9UdpSocket17join_multicast_v417h7bcfb52030639456E+0x2d): more undefined references to `setsockopt' follow
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::udp::UdpSocket::send::hf748edc185389663':
std.cgu-0.rs:(.text._ZN3std3net3udp9UdpSocket4send17hf748edc185389663E+0x18): undefined reference to `send'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::udp::UdpSocket::recv::hacc771b0c4e26ce7':
std.cgu-0.rs:(.text._ZN3std3net3udp9UdpSocket4recv17hacc771b0c4e26ce7E+0x18): undefined reference to `recv'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::udp::UdpSocket::peek::h5f2dd0d6931ca58b':
std.cgu-0.rs:(.text._ZN3std3net3udp9UdpSocket4peek17h5f2dd0d6931ca58bE+0x15): undefined reference to `recv'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::net::lookup_host::hc447eb41b0ff6758':
std.cgu-0.rs:(.text._ZN3std3net11lookup_host17hc447eb41b0ff6758E+0x14c): undefined reference to `getaddrinfo'
std.cgu-0.rs:(.text._ZN3std3net11lookup_host17hc447eb41b0ff6758E+0x1a6): undefined reference to `gai_strerror'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys_common::net::getsockopt::hd75706944ea0cd88':
std.cgu-0.rs:(.text._ZN3std10sys_common3net10getsockopt17hd75706944ea0cd88E+0x2f): undefined reference to `getsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `_$LT$std..sys_common..net..LookupHost$u20$as$u20$core..ops..Drop$GT$::drop::h36d99e6972a83fd1':
std.cgu-0.rs:(.text._ZN68_$LT$std..sys_common..net..LookupHost$u20$as$u20$core..ops..Drop$GT$4drop17h36d99e6972a83fd1E+0x4): undefined reference to `freeaddrinfo'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys_common::net::TcpStream::connect::h949b4d717d783cd5':
std.cgu-0.rs:(.text._ZN3std10sys_common3net9TcpStream7connect17h949b4d717d783cd5E+0xc8): undefined reference to `connect'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `_$LT$std..sys_common..net..TcpStream$u20$as$u20$core..fmt..Debug$GT$::fmt::h84c89a5c2e1779cb':
std.cgu-0.rs:(.text._ZN68_$LT$std..sys_common..net..TcpStream$u20$as$u20$core..fmt..Debug$GT$3fmt17h84c89a5c2e1779cbE+0xc3): undefined reference to `getsockname'
std.cgu-0.rs:(.text._ZN68_$LT$std..sys_common..net..TcpStream$u20$as$u20$core..fmt..Debug$GT$3fmt17h84c89a5c2e1779cbE+0x25a): undefined reference to `getpeername'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys_common::net::TcpListener::bind::hb7e068302800cd86':
std.cgu-0.rs:(.text._ZN3std10sys_common3net11TcpListener4bind17hb7e068302800cd86E+0xc6): undefined reference to `setsockopt'
std.cgu-0.rs:(.text._ZN3std10sys_common3net11TcpListener4bind17hb7e068302800cd86E+0xe9): undefined reference to `bind'
std.cgu-0.rs:(.text._ZN3std10sys_common3net11TcpListener4bind17hb7e068302800cd86E+0xfb): undefined reference to `listen'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `_$LT$std..sys_common..net..TcpListener$u20$as$u20$core..fmt..Debug$GT$::fmt::h9661d1ff80c3ccb6':
std.cgu-0.rs:(.text._ZN70_$LT$std..sys_common..net..TcpListener$u20$as$u20$core..fmt..Debug$GT$3fmt17h9661d1ff80c3ccb6E+0xb4): undefined reference to `getsockname'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys_common::net::UdpSocket::bind::h47638f514e6c1c9c':
std.cgu-0.rs:(.text._ZN3std10sys_common3net9UdpSocket4bind17h47638f514e6c1c9cE+0xbd): undefined reference to `bind'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys_common::net::UdpSocket::send_to::h7159c16ccbb34df4':
std.cgu-0.rs:(.text._ZN3std10sys_common3net9UdpSocket7send_to17h7159c16ccbb34df4E+0x2f): undefined reference to `sendto'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys_common::net::UdpSocket::connect::h256ab73a693f067f':
std.cgu-0.rs:(.text._ZN3std10sys_common3net9UdpSocket7connect17h256ab73a693f067fE+0x38): undefined reference to `connect'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `_$LT$std..sys_common..net..UdpSocket$u20$as$u20$core..fmt..Debug$GT$::fmt::h1616d92aa58a9da3':
std.cgu-0.rs:(.text._ZN68_$LT$std..sys_common..net..UdpSocket$u20$as$u20$core..fmt..Debug$GT$3fmt17h1616d92aa58a9da3E+0xb4): undefined reference to `getsockname'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixStream::connect::inner::h2d8ccf5e7349e02b':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net10UnixStream7connect5inner17h2d8ccf5e7349e02bE+0x29b): undefined reference to `connect'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixStream::local_addr::hf0d89436446e5900':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net10UnixStream10local_addr17hf0d89436446e5900E+0x60): undefined reference to `getsockname'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixStream::peer_addr::h90581356ab09ca08':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net10UnixStream9peer_addr17h90581356ab09ca08E+0x60): undefined reference to `getpeername'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixStream::shutdown::hf80ec323912a06bb':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net10UnixStream8shutdown17hf80ec323912a06bbE+0x1e): undefined reference to `shutdown'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `_$LT$std..sys..imp..ext..net..UnixStream$u20$as$u20$std..io..Read$GT$::read::he45e49d4c8740c3f':
std.cgu-0.rs:(.text._ZN69_$LT$std..sys..imp..ext..net..UnixStream$u20$as$u20$std..io..Read$GT$4read17he45e49d4c8740c3fE+0x18): undefined reference to `recv'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `_$LT$$RF$$u27$a$u20$std..sys..imp..ext..net..UnixStream$u20$as$u20$std..io..Read$GT$::read::h4431fafbd59ea635':
std.cgu-0.rs:(.text._ZN84_$LT$$RF$$u27$a$u20$std..sys..imp..ext..net..UnixStream$u20$as$u20$std..io..Read$GT$4read17h4431fafbd59ea635E+0x1b): undefined reference to `recv'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixListener::bind::inner::h36b45f252b3a736e':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixListener4bind5inner17h36b45f252b3a736eE+0x293): undefined reference to `bind'
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixListener4bind5inner17h36b45f252b3a736eE+0x2a5): undefined reference to `listen'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixListener::local_addr::h10cbd3bad9fe5b51':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixListener10local_addr17h10cbd3bad9fe5b51E+0x60): undefined reference to `getsockname'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixDatagram::bind::inner::h9c213be558e41b32':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixDatagram4bind5inner17h9c213be558e41b32E+0x2e3): undefined reference to `bind'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixDatagram::connect::inner::hbb74da45dfd3b1b9':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixDatagram7connect5inner17hbb74da45dfd3b1b9E+0x1e1): undefined reference to `connect'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixDatagram::local_addr::hf7c5199603fb4d51':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixDatagram10local_addr17hf7c5199603fb4d51E+0x60): undefined reference to `getsockname'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixDatagram::peer_addr::hce34030eb7493fea':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixDatagram9peer_addr17hce34030eb7493feaE+0x60): undefined reference to `getpeername'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixDatagram::recv_from::h877b0b216b4f9e4a':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixDatagram9recv_from17h877b0b216b4f9e4aE+0x6a): undefined reference to `recvfrom'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixDatagram::recv::h03500c94fbf652a3':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixDatagram4recv17h03500c94fbf652a3E+0x18): undefined reference to `recv'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixDatagram::send_to::inner::h33668a6347777559':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixDatagram7send_to5inner17h33668a6347777559E+0x1f5): undefined reference to `sendto'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::ext::net::UnixDatagram::shutdown::hfebab37ce44c46c9':
std.cgu-0.rs:(.text._ZN3std3sys3imp3ext3net12UnixDatagram8shutdown17hfebab37ce44c46c9E+0x1e): undefined reference to `shutdown'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::net::Socket::new_raw::he52f0f6149dd6248':
std.cgu-0.rs:(.text._ZN3std3sys3imp3net6Socket7new_raw17he52f0f6149dd6248E+0x12): undefined reference to `socket'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::net::Socket::new_pair::h533a9c46b9e47b8b':
std.cgu-0.rs:(.text._ZN3std3sys3imp3net6Socket8new_pair17h533a9c46b9e47b8bE+0x21): undefined reference to `socketpair'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::net::Socket::accept::h0650523372fcb4ef':
std.cgu-0.rs:(.text._ZN3std3sys3imp3net6Socket6accept17h0650523372fcb4efE+0x29): undefined reference to `accept'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::net::Socket::recv_from_with_flags::h7bddbbf438ef9302':
std.cgu-0.rs:(.text._ZN3std3sys3imp3net6Socket20recv_from_with_flags17h7bddbbf438ef9302E+0xab): undefined reference to `recvfrom'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::net::Socket::set_timeout::h915c6f61654eda10':
std.cgu-0.rs:(.text._ZN3std3sys3imp3net6Socket11set_timeout17h915c6f61654eda10E+0x80): undefined reference to `setsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(std-c20e021390d7c683.0.o): In function `std::sys::imp::net::Socket::timeout::h2fcb3327dc895c34':
std.cgu-0.rs:(.text._ZN3std3sys3imp3net6Socket7timeout17h2fcb3327dc895c34E+0x2d): undefined reference to `getsockopt'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(posix.o): In function `backtrace_open':
posix.c:(.text.backtrace_open+0x51): undefined reference to `__errno_location'
posix.c:(.text.backtrace_open+0x9f): undefined reference to `__errno_location'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(posix.o): In function `backtrace_close':
posix.c:(.text.backtrace_close+0x29): undefined reference to `__errno_location'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(elf.o): In function `backtrace_initialize':
elf.c:(.text.backtrace_initialize+0xa1): undefined reference to `dl_iterate_phdr'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(mmapio.o): In function `backtrace_get_view':
mmapio.c:(.text.backtrace_get_view+0x91): undefined reference to `__errno_location'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(mmapio.o): In function `backtrace_release_view':
mmapio.c:(.text.backtrace_release_view+0x31): undefined reference to `__errno_location'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(mmap.o): In function `backtrace_alloc':
mmap.c:(.text.backtrace_alloc+0x169): undefined reference to `__errno_location'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(dwarf.o): In function `read_attribute':
dwarf.c:(.text.read_attribute+0x2e3): undefined reference to `strnlen'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(dwarf.o): In function `dwarf_lookup_pc':
dwarf.c:(.text.dwarf_lookup_pc+0x858): undefined reference to `strnlen'
dwarf.c:(.text.dwarf_lookup_pc+0x902): undefined reference to `strnlen'
dwarf.c:(.text.dwarf_lookup_pc+0x994): undefined reference to `strnlen'
dwarf.c:(.text.dwarf_lookup_pc+0xbc6): undefined reference to `strnlen'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(dwarf.o):dwarf.c:(.text.dwarf_lookup_pc+0xf7e): more undefined references to `strnlen' follow
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/liballoc_system-d9fd2071a44a00ee.rlib(alloc_system-d9fd2071a44a00ee.0.o): In function `__rust_allocate':
alloc_system.cgu-0.rs:(.text.__rust_allocate+0x22): undefined reference to `posix_memalign'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/liballoc_system-d9fd2071a44a00ee.rlib(alloc_system-d9fd2071a44a00ee.0.o): In function `__rust_reallocate':
alloc_system.cgu-0.rs:(.text.__rust_reallocate+0x40): undefined reference to `posix_memalign'
collect2: error: ld returned 1 exit status
error: aborting due to previous error
Is rustc supposed to automatically invoke the linker with all needed libraries, or am I just doing something wrong? It appears to be necessary to explicitly link against resolv. Adding -lresolv brings it down to only a few undefined references (__errno_location, strnlen, and posix_memalign):
$ "i386-pc-solaris2.10-gcc" -lresolv "-m64" "-L" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib" "hello.0.o" "-o" "hello" "-Wl,-z" "-Wl,ignore" "-nodefaultlibs" "-L" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/librand-6da574fadb124927.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libcollections-fac80a156b3b2582.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd_unicode-cc81378608ed406b.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libpanic_unwind-69d2925c4048be57.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libunwind-c7cae34415ee0cd5.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/liballoc-572a80e2714fa765.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/liballoc_system-d9fd2071a44a00ee.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/liblibc-d93d1e292968da46.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libcore-acf490f1deba6df2.rlib" "/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libcompiler_builtins-240ffb02833b10a3.rlib" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt"
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(posix.o): In function `backtrace_open':
posix.c:(.text.backtrace_open+0x51): undefined reference to `__errno_location'
posix.c:(.text.backtrace_open+0x9f): undefined reference to `__errno_location'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(posix.o): In function `backtrace_close':
posix.c:(.text.backtrace_close+0x29): undefined reference to `__errno_location'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(elf.o): In function `backtrace_initialize':
elf.c:(.text.backtrace_initialize+0xa1): undefined reference to `dl_iterate_phdr'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(mmapio.o): In function `backtrace_get_view':
mmapio.c:(.text.backtrace_get_view+0x91): undefined reference to `__errno_location'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(mmapio.o): In function `backtrace_release_view':
mmapio.c:(.text.backtrace_release_view+0x31): undefined reference to `__errno_location'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(mmap.o): In function `backtrace_alloc':
mmap.c:(.text.backtrace_alloc+0x169): undefined reference to `__errno_location'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(dwarf.o): In function `read_attribute':
dwarf.c:(.text.read_attribute+0x2e3): undefined reference to `strnlen'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(dwarf.o): In function `dwarf_lookup_pc':
dwarf.c:(.text.dwarf_lookup_pc+0x858): undefined reference to `strnlen'
dwarf.c:(.text.dwarf_lookup_pc+0x902): undefined reference to `strnlen'
dwarf.c:(.text.dwarf_lookup_pc+0x994): undefined reference to `strnlen'
dwarf.c:(.text.dwarf_lookup_pc+0xbc6): undefined reference to `strnlen'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-c20e021390d7c683.rlib(dwarf.o):dwarf.c:(.text.dwarf_lookup_pc+0xf7e): more undefined references to `strnlen' follow
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/liballoc_system-d9fd2071a44a00ee.rlib(alloc_system-d9fd2071a44a00ee.0.o): In function `__rust_allocate':
alloc_system.cgu-0.rs:(.text.__rust_allocate+0x22): undefined reference to `posix_memalign'
/usr/local/lib/rustlib/x86_64-sun-solaris/lib/liballoc_system-d9fd2071a44a00ee.rlib(alloc_system-d9fd2071a44a00ee.0.o): In function `__rust_reallocate':
alloc_system.cgu-0.rs:(.text.__rust_reallocate+0x40): undefined reference to `posix_memalign'
collect2: error: ld returned 1 exit status
Are these symbols defined in another library that needs to be linked, or is there a better way to resolve this?
I am using rustc 1.17.0, which I compiled to get the x86_64-sun-solaris std crate.
The problem seems to originate from Solaris 10. Rust 1.22.0 (will be promoted to beta these days) uses memalign instead of posix_memalign, so this is fixed there. strnlen and dl_iterate_phdr are not available on Solaris 10 as well, so maybe you used another compiler with Solaris 11 or illumos sysroot to compile the stdlib? With this setting I can reproduce parts of this issue. If that is the case, it should be closed.
No, I don't mean Solaris 10 is unsupported. But using an untouched Solaris 11 or illumos sysroot for cross compiling and then running in Solaris 10 should not be considered a supported use case because then the mentioned non-Solaris 10 symbols are picked up during compilation. For the continuous integration I made the necessary changes to an illumos sysroot to also support Solaris 10. That is what the bug reporter should also do (or just use a Solaris 10 sysroot or even better compile with the precompiled x86_64-sun-solaris libstd, which does not link to these symbols).
I am trying to cross-compile from x86_64-unknown-linux to x86_64-sun-solaris. I have a working C cross toolchain and I cross compiled the std crate basically following the directions from https://github.com/japaric/rust-cross.
However, when I try to cross compile a Rust program, I get a linking error listing many undefined references.
Is rustc supposed to automatically invoke the linker with all needed libraries, or am I just doing something wrong? It appears to be necessary to explicitly link against resolv. Adding
-lresolv
brings it down to only a few undefined references (__errno_location, strnlen, and posix_memalign):Are these symbols defined in another library that needs to be linked, or is there a better way to resolve this?
I am using rustc 1.17.0, which I compiled to get the x86_64-sun-solaris std crate.
The text was updated successfully, but these errors were encountered: