cmcurl: Linking fails cross-compiling to Solaris 10 due to clock_gettime() in rt
The following discussion from !7455 (closed) should be addressed:
-
@aadne started a discussion: librt
is necessary forclock_gettime()
before Solaris 11, but I don't know why my environment does not pull it in. It could be that your builds link to some other dynamic library (like e.g. dynamic openssl) which already links tolibrt
?Here's the compiler I'm using, latest GCC but 64-bit/static runtime only. The system is vanilla Solaris 10 with some CSW packages (some gnu tools, no compilers) and only the patchset for OracleDeveloperStudio 12.6 installed.
I run the configure now with
LDFLAGS=-lrt cmake cmake-src ...
[ahovda@osl206sol:/home/ahovda/cmake-build] $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/gcc/libexec/gcc/sparc64-sun-solaris2.10/9.5.0/lto-wrapper Target: sparc64-sun-solaris2.10 Configured with: /home/ahovda/src/gcc-9.5.0/configure --prefix=/opt/gcc --with-as=/usr/ccs/bin/as --without-gnu-as --with-ld=/usr/ccs/bin/sparcv9/ld --without-gnu-ld --enable-languages=c,c++ --enable-obsolete --build=sparc64-sun-solaris2.10 --disable-multilib --with-cpu=v9 --disable-shared Thread model: posix gcc version 9.5.0 (GCC)
The binaries end up dependending on no third-party libraries and should run on any Solaris 10/11 sparc system afaik.
[ahovda@osl206sol:/home/ahovda/cmake-build] $ ldd bin/ccmake libdl.so.1 => /lib/64/libdl.so.1 libkstat.so.1 => /lib/64/libkstat.so.1 libnsl.so.1 => /lib/64/libnsl.so.1 libsendfile.so.1 => /lib/64/libsendfile.so.1 libsocket.so.1 => /lib/64/libsocket.so.1 librt.so.1 => /lib/64/librt.so.1 libcurses.so.1 => /lib/64/libcurses.so.1 libm.so.2 => /lib/64/libm.so.2 libc.so.1 => /lib/64/libc.so.1 libmp.so.2 => /lib/64/libmp.so.2 libmd.so.1 => /lib/64/libmd.so.1 libscf.so.1 => /lib/64/libscf.so.1 libaio.so.1 => /lib/64/libaio.so.1 libdoor.so.1 => /lib/64/libdoor.so.1 libuutil.so.1 => /lib/64/libuutil.so.1 libgen.so.1 => /lib/64/libgen.so.1 /platform/SUNW,T5140/lib/sparcv9/libc_psr.so.1 /platform/SUNW,T5140/lib/sparcv9/libmd_psr.so.1
(FYI, this does not link to
/opt/csw/lib/sparcv9/libncurses.so
. I commented out the extra paths added toCMAKE_SYSTEM_PREFIX_PATH
inModules/Platform/SunOS.cmake
to avoid that. I guess I could have uninstalled the version in/opt/csw
but then most of the gnu tools would need to go too...)