Boost C++ Libraries: Ticket #12565: LTO Build Fails with lockpool.o: not an object or archive https://svn.boost.org/trac10/ticket/12565 <p> Hi, </p> <p> While compiling boost with LTO on both gcc and llvm/clang, the following error occurs: </p> <p> /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 </p> <p> The compile and link statements in full are below: </p> <p> Build: </p> <hr /> <p> "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" </p> <p> Link: </p> <hr /> <blockquote> <p> "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 </p> </blockquote> <p> Verbose: </p> <hr /> <p> "/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 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12565 Trac 1.4.3 anonymous Fri, 28 Oct 2016 07:28:47 GMT <link>https://svn.boost.org/trac10/ticket/12565#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12565#comment:1</guid> <description> <p> Apologies, LTO with gcc works fine. Only clang has issues </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 28 Oct 2016 08:18:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12565#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12565#comment:2</guid> <description> <p> Explicityly passing linkflags="-plugin /usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins/LLVMgold.so" fixes this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Kohei Takahashi</dc:creator> <pubDate>Sat, 19 Nov 2016 14:17:58 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/12565#comment:3 https://svn.boost.org/trac10/ticket/12565#comment:3 <ul> <li><strong>owner</strong> set to <span class="trac-author">timblechmann</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">atomic</span> </li> </ul> Ticket Andrey Semashev Thu, 05 Jan 2017 02:53:01 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/12565#comment:4 https://svn.boost.org/trac10/ticket/12565#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> 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. </p> Ticket