[cfe-dev] Missing /usr/lib/cxa_finalize.o on Solaris 11.1

Dmitri Shubin sbn at tbricks.com
Tue Jun 11 00:31:49 PDT 2013


Hi Igor,

On 06/11/2013 12:53 AM, Игорь Пашев wrote:
> I'm trying to compile a C++ program on Solaris 11.1 with the lastest
> LLVM and Clang
> and get a failure:
> ../build/Debug+Asserts/bin/clang++ 1.cpp
> ld: fatal: file /usr/lib/cxa_finalize.o: open failed: No such file or directory
> ld: fatal: file processing errors. No output written to a.out
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
You can get it from Pathscale's libcxxrt: 
https://github.com/pathscale/libcxxrt
Just compile this single object with clang and put to /usr/lib

> Removing cxa_finalize.o from linker args results in a valid executable:
> $ ../build/Debug+Asserts/bin/clang++ -c 1.cpp
> $ ld -C -e _start -Bdynamic --dynamic-linker /usr/lib/ld.so.1 -o a.out
> /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/values-Xa.o
> /usr/gcc/4.5/lib/gcc/i386-pc-solaris2.11/4.5.2/crtbegin.o
> -L/usr/gcc/4.5/lib/gcc/i386-pc-solaris2.11/4.5.2/ 1.o -lstdc++ -lgcc_s
> -lgcc -lc -lm /usr/gcc/4.5/lib/gcc/i386-pc-solaris2.11/4.5.2/crtend.o
> /usr/lib/crtn.o
> $ ./a.out ; echo $?
> 0
AFAIR this file is needed to call destructors of C++ global/static objects.
You can also try to use atexit() for this by giving 
'-fno-use-cxa-atexit' to clang.

Bye!



More information about the cfe-dev mailing list