Opened 6 years ago

Closed 6 years ago

#12565 closed Bugs (invalid)

LTO Build Fails with lockpool.o: not an object or archive

Reported by: amit.prakash.ambasta@… Owned by: timblechmann
Milestone: To Be Determined Component: atomic
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc: amit.prakash.ambasta@…

Description

Hi,

While compiling boost with LTO on both gcc and llvm/clang, the following error occurs:

/usr/bin/x86_64-pc-linux-gnu-ld: error: bin.v2/libs/atomic/build/gcc-4.2/gentoorelease/boost.locale.icu-off/pch-off/threading-multi/lockpool.o:1:3: invalid character /usr/bin/x86_64-pc-linux-gnu-ld: error: bin.v2/libs/atomic/build/gcc-4.2/gentoorelease/boost.locale.icu-off/pch-off/threading-multi/lockpool.o:1:3: syntax error, unexpected $end /usr/bin/x86_64-pc-linux-gnu-ld: error: bin.v2/libs/atomic/build/gcc-4.2/gentoorelease/boost.locale.icu-off/pch-off/threading-multi/lockpool.o: not an object or archive

The compile and link statements in full are below:

Build:


"clang++" -ftemplate-depth-128 -O2 -pipe -march=haswell -flto=thin -stdlib=libc++ -flto=thin -std=c++14 -finline-functions -Wno-inline -Wall -pthread -fPIC -m64 -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1 -DBOOST_ATOMIC_SOURCE -DNDEBUG -I"." -c -o "bin.v2/libs/atomic/build/gcc-4.2/gentoorelease/boost.locale.icu-off/pch-off/threading-multi/lockpool.o" "libs/atomic/src/lockpool.cpp"

Link:


"x86_64-pc-linux-gnu-clang++" -o "bin.v2/libs/atomic/build/gcc-4.2/gentoorelease/boost.locale.icu-off/pch-off/threading-multi/libboost_atomic.so.1.62.0" -Wl,-h -Wl,libboost_atomic.so.1.62.0 -shared -Wl,--start-group "bin.v2/libs/atomic/build/gcc-4.2/gentoorelease/boost.locale.icu-off/pch-off/threading-multi/lockpool.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -Wl,-O1 -Wl,--as-needed -pthread -m64

Verbose:


"/usr/bin/x86_64-pc-linux-gnu-ld" --eh-frame-hdr -m elf_x86_64 -shared -o bin.v2/libs/atomic/build/gcc-4.2/gentoorelease/boost.locale.icu-off/pch-off/threading-multi/libboost_atomic.so.1.62.0 /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/crtbeginS.o -use-gold-plugin -use-gold-plugin -L/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0 -L/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../lib64 -L/usr/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib -h libboost_atomic.so.1.62.0 --start-group bin.v2/libs/atomic/build/gcc-4.2/gentoorelease/boost.locale.icu-off/pch-off/threading-multi/lockpool.o -Bstatic -Bdynamic -lrt --end-group -O1 --as-needed -lc++ -lm -lgcc_s -lpthread -lc -lgcc_s /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../lib64/crtn.o

Change History (4)

comment:1 by anonymous, 6 years ago

Apologies, LTO with gcc works fine. Only clang has issues

comment:2 by anonymous, 6 years ago

Explicityly passing linkflags="-plugin /usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins/LLVMgold.so" fixes this.

comment:3 by Kohei Takahashi, 6 years ago

Component: Noneatomic
Owner: set to timblechmann

comment:4 by Andrey Semashev, 6 years ago

Resolution: invalid
Status: newclosed

IIUC, the problem is that clang frontend does not pass the plugin command line argument to the linker. That seems like a problem with clang (incorrect configuration, perhaps?). Anyway, I don't think that is something that can be fixed in the library.

Note: See TracTickets for help on using tickets.