Message ID | 20180905105127.31591-1-fontaine.fabrice@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [v3,1/1] boost: fix static detection of lock-free atomic ints | expand |
Hello Fabrice, Thanks again for your work on this topic. However, I am sorry, but I still don't understand :-/ On Wed, 5 Sep 2018 12:51:27 +0200, Fabrice Fontaine wrote: > +When build statically, boost is unable to detect lock-free atomics ints > +because it tries to link dynamically with boost_system, see I don't see where it tries to link dynamically with boost_system. > +Using shell: /bin/sh -c > + argv[0] = '/bin/sh' > + argv[1] = '-c' > + argv[2] = ' > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp" > > +gcc.compile.c++ bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o > + > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp" Here it builds the object file has_atomic_flag_lockfree_test.o, it uses -static, there's no -shared or nothing really wrong here. This tests succeeds, so lock-free atomic ints are available, we're all good. It does *not* try to link against libboost_system at this point. > +0.033561 sec system; 0.126314 sec user; 288.682473 sec clock > +gcc.compile.c++ bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o > + > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -I"." -c -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" "libs/system/src/error_code.cpp" > + > +0.084060 sec system; 0.644133 sec user; 8.858824 sec clock > +SEM: <s>gcc-link-semaphore now used by <pbin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi>libboost_system.so.1.67.0 > +Using shell: /bin/sh -c > + argv[0] = '/bin/sh' > + argv[1] = '-c' > + argv[2] = ' > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0" -Wl,-h -Wl,libboost_system.so.1.67.0 -shared -Wl,--start-group "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -fPIC -pthread -g -Wl,-elf2flt -static Here is also does not try to link against libboost_system: it tries to *generate* it! The summarized command is "g++ -o libboost_system.so.1.67.0" so the overall goal of the command is to *produce* libboost_system.so.1.67.0, not to link against it. > +ld (ld-elf2flt): -shared used without passing a shared library ID Obviously, this fails because building shared libraries is not possible in this static-only configuration. But I fail to see the relation: - Between producing libboost_system.so and the "project boost/thread" thing - Between inverting "project boost/thread" and the atomic_flag_lock_free test and this issue disappearing. This still feel very mysterious to me. Best regards, Thomas
Dear Thomas, Le jeu. 6 sept. 2018 à 21:06, Thomas Petazzoni <thomas.petazzoni@bootlin.com> a écrit : > Hello Fabrice, > > Thanks again for your work on this topic. However, I am sorry, but I > still don't understand :-/ > > On Wed, 5 Sep 2018 12:51:27 +0200, Fabrice Fontaine wrote: > > > +When build statically, boost is unable to detect lock-free atomics ints > > +because it tries to link dynamically with boost_system, see > > I don't see where it tries to link dynamically with boost_system. > > > +Using shell: /bin/sh -c > > + argv[0] = '/bin/sh' > > + argv[1] = '-c' > > + argv[2] = ' > > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" > -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os > -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline > -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter > -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 > -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o > "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" > "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp" > > > > +gcc.compile.c++ > bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o > > + > > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" > -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os > -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline > -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter > -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 > -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o > "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" > "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp" > > Here it builds the object file has_atomic_flag_lockfree_test.o, it uses > -static, there's no -shared or nothing really wrong here. This tests > succeeds, so lock-free atomic ints are available, we're all good. > > It does *not* try to link against libboost_system at this point. > > > +0.033561 sec system; 0.126314 sec user; 288.682473 sec clock > > +gcc.compile.c++ > bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o > > + > > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" > -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os > -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline > -Wall -pedantic -g -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -I"." > -c -o > "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" > "libs/system/src/error_code.cpp" > > + > > +0.084060 sec system; 0.644133 sec user; 8.858824 sec clock > > +SEM: <s>gcc-link-semaphore now used by > <pbin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi>libboost_system.so.1.67.0 > > +Using shell: /bin/sh -c > > + argv[0] = '/bin/sh' > > + argv[1] = '-c' > > + argv[2] = ' > > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -o > "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0" > -Wl,-h -Wl,libboost_system.so.1.67.0 -shared -Wl,--start-group > "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" > -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -fPIC -pthread -g > -Wl,-elf2flt -static > > Here is also does not try to link against libboost_system: it tries to > *generate* it! > > The summarized command is "g++ -o libboost_system.so.1.67.0" so the > overall goal of the command is to *produce* libboost_system.so.1.67.0, > not to link against it. > That's right it fails because it can't produce it but it produces it in the goal of linking to it. For more information, you can see more traces of a successfull build in the PR: https://github.com/boostorg/thread/pull/231. > > > +ld (ld-elf2flt): -shared used without passing a shared library ID > > Obviously, this fails because building shared libraries is not possible > in this static-only configuration. > But I fail to see the relation: > > - Between producing libboost_system.so and the "project boost/thread" > thing > Here is an extract of the "Project attributes" section of https://www.boost.org/doc/libs/1_67_0/doc/html/bbv2/tutorial.html <https://www.boost.org/doc/libs/1_36_0/doc/html/bbv2/tutorial.html>: "If we want the same requirements for our other target, hello2 , we could simply duplicate them. However, as projects grow, that approach leads to a great deal of repeated boilerplate in Jamfiles. Fortunately, there's a better way. Each project can specify a set of *attributes*, including requirements: project : requirements <include>/home/ghost/Work/boost <threading>multi ; exe hello : hello.cpp ; exe hello2 : hello.cpp ;" So in our case, we have: project boost/thread : requirements <threading>multi [...] <library>/boost/system//boost_system ; exe has_atomic_flag_lockfree : ../build/has_atomic_flag_lockfree_test.cpp ; This means that has_atomic_flag_lockfree requires boost_system. If we move has_atomic_flag_lockfree before the project statement then boost_system is not required anymore. This also means that all the other requirements for boost/thread does not apply for this simple test which seems acceptabe to me. > > - Between inverting "project boost/thread" and the > atomic_flag_lock_free test and this issue disappearing. > > This still feel very mysterious to me. > > Best regards, > > Thomas > -- > Thomas Petazzoni, CTO, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com > Best Regards, Fabrice <div dir="ltr"><div dir="ltr"><div dir="ltr">Dear Thomas,<br><br><div class="gmail_quote"><div dir="ltr">Le jeu. 6 sept. 2018 à 21:06, Thomas Petazzoni <<a href="mailto:thomas.petazzoni@bootlin.com" target="_blank">thomas.petazzoni@bootlin.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Fabrice,<br> <br> Thanks again for your work on this topic. However, I am sorry, but I<br> still don't understand :-/<br> <br> On Wed, 5 Sep 2018 12:51:27 +0200, Fabrice Fontaine wrote:<br> <br> > +When build statically, boost is unable to detect lock-free atomics ints<br> > +because it tries to link dynamically with boost_system, see<br> <br> I don't see where it tries to link dynamically with boost_system.<br> <br> > +Using shell: /bin/sh -c<br> > + argv[0] = '/bin/sh'<br> > + argv[1] = '-c'<br> > + argv[2] = '<br> > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp"<br> ><br> > +gcc.compile.c++ bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o<br> > +<br> > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp"<br> <br> Here it builds the object file has_atomic_flag_lockfree_test.o, it uses<br> -static, there's no -shared or nothing really wrong here. This tests<br> succeeds, so lock-free atomic ints are available, we're all good.<br> <br> It does *not* try to link against libboost_system at this point.<br> <br> > +0.033561 sec system; 0.126314 sec user; 288.682473 sec clock<br> > +gcc.compile.c++ bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o<br> > +<br> > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -I"." -c -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" "libs/system/src/error_code.cpp"<br> > +<br> > +0.084060 sec system; 0.644133 sec user; 8.858824 sec clock<br> > +SEM: <s>gcc-link-semaphore now used by <pbin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi>libboost_system.so.1.67.0<br> > +Using shell: /bin/sh -c<br> > + argv[0] = '/bin/sh'<br> > + argv[1] = '-c'<br> > + argv[2] = '<br> > + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0" -Wl,-h -Wl,libboost_system.so.1.67.0 -shared -Wl,--start-group "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -fPIC -pthread -g -Wl,-elf2flt -static<br> <br> Here is also does not try to link against libboost_system: it tries to<br> *generate* it!<br> <br> The summarized command is "g++ -o libboost_system.so.1.67.0" so the<br> overall goal of the command is to *produce* libboost_system.so.1.67.0,<br> not to link against it.<br></blockquote><div>That's right it fails because it can't produce it but it produces it in the goal of linking to it. For more information, you can see more traces of a successfull build in the PR: <a href="https://github.com/boostorg/thread/pull/231" target="_blank">https://github.com/boostorg/thread/pull/231</a>.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br> > +ld (ld-elf2flt): -shared used without passing a shared library ID<br> <br> Obviously, this fails because building shared libraries is not possible<br> in this static-only configuration. </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br> But I fail to see the relation:<br> <br> - Between producing libboost_system.so and the "project boost/thread"<br> thing<br></blockquote><div>Here is an extract of the "Project attributes" section of <a href="https://www.boost.org/doc/libs/1_36_0/doc/html/bbv2/tutorial.html" target="_blank">https://www.boost.org/doc/libs/1_67_0/doc/html/bbv2/tutorial.html</a>:</div><div><p> "If we want the same requirements for our other target, <code class="m_-7152641340384444798gmail-filename">hello2 </code>, we could simply duplicate them. However, as projects grow, that approach leads to a great deal of repeated boilerplate in Jamfiles. Fortunately, there's a better way. Each project can specify a set of <i class="m_-7152641340384444798gmail-firstterm">attributes</i>, including requirements: </p> <pre class="m_-7152641340384444798gmail-programlisting">project : requirements <include>/home/ghost/Work/boost <threading>multi ; exe hello : hello.cpp ; exe hello2 : hello.cpp ;"<br><br></pre><div>So in our case, we have:</div><div>project boost/thread</div><div> : requirements <threading>multi</div><div>[...]<br></div><div> <library>/boost/system//boost_system ;</div><div>exe has_atomic_flag_lockfree : ../build/has_atomic_flag_lockfree_test.cpp ;</div><div></div><div><br></div><div>This means that has_atomic_flag_lockfree requires boost_system.</div><div>If we move has_atomic_flag_lockfree before the project statement then boost_system is not required anymore. This also means that all the other requirements for boost/thread does not apply for this simple test which seems acceptabe to me.<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br> - Between inverting "project boost/thread" and the<br> atomic_flag_lock_free test and this issue disappearing.<br> <br> This still feel very mysterious to me.<br> <br> Best regards,<br> <br> Thomas<br> -- <br> Thomas Petazzoni, CTO, Bootlin<br> Embedded Linux and Kernel engineering<br> <a href="https://bootlin.com" rel="noreferrer" target="_blank">https://bootlin.com</a><br></blockquote><div>Best Regards,</div><div><br></div><div>Fabrice<br></div></div></div></div></div>
Hello, On Wed, 5 Sep 2018 12:51:27 +0200, Fabrice Fontaine wrote: > When build statically, boost is unable to detect lock-free atomics ints > because it tries to link dynamically, see > output/build/boost-1.67.0/bin.v2/config.log (with -d5 option): > > Using shell: /bin/sh -c > argv[0] = '/bin/sh' > argv[1] = '-c' > argv[2] = ' > "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp" > ' > gcc.compile.c++ bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o > > "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp" > > 0.033561 sec system; 0.126314 sec user; 288.682473 sec clock > gcc.compile.c++ bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o > > "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -I"." -c -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" "libs/system/src/error_code.cpp" > > 0.084060 sec system; 0.644133 sec user; 8.858824 sec clock > SEM: <s>gcc-link-semaphore now used by <pbin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi>libboost_system.so.1.67.0 > Using shell: /bin/sh -c > argv[0] = '/bin/sh' > argv[1] = '-c' > argv[2] = ' > "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0" -Wl,-h -Wl,libboost_system.so.1.67.0 -shared -Wl,--start-group "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -fPIC -pthread -g -Wl,-elf2flt -static > ' > gcc.link.dll bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0 > > "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0" -Wl,-h -Wl,libboost_system.so.1.67.0 -shared -Wl,--start-group "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -fPIC -pthread -g -Wl,-elf2flt -static > > ld (ld-elf2flt): -shared used without passing a shared library ID > collect2: error: ld a retourné le statut de sortie 1 > 0.003123 sec system; 0.004732 sec user; 15.646509 sec clock > ...failed gcc.link.dll bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0... > > Due to this wrong detection, boost_atomic is wrongly selected by > boost_thread which cause a build failure on missing select > > To fix this, move the exe statement before the boost/thread project > > Fixes: > - http://autobuild.buildroot.org/results/f46d38991385cbc2a4fa14eb31074e770cd79803 > > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> > --- > Changes v2 -> v3 (after review of Thomas Petazzoni): > - Replace hack by a patch movin exe statement in the beginning of > libs/thread/build/Jamfile.v2 Applied to master, thanks. Thomas
diff --git a/package/boost/0005-fix-static-detection-of-lock-free-atomic-ints.patch b/package/boost/0005-fix-static-detection-of-lock-free-atomic-ints.patch new file mode 100644 index 0000000000..580a298056 --- /dev/null +++ b/package/boost/0005-fix-static-detection-of-lock-free-atomic-ints.patch @@ -0,0 +1,80 @@ +From 48be99d20753ecab8817b030b95a7f1260aa777f Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine <fontaine.fabrice@gmail.com> +Date: Wed, 5 Sep 2018 12:04:15 +0200 +Subject: [PATCH 17/17] fix static detection of lock-free atomic ints +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When build statically, boost is unable to detect lock-free atomics ints +because it tries to link dynamically with boost_system, see +output/build/boost-1.67.0/bin.v2/config.log (with -d5 option): + +Using shell: /bin/sh -c + argv[0] = '/bin/sh' + argv[1] = '-c' + argv[2] = ' + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp" +' +gcc.compile.c++ bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o + + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp" + +0.033561 sec system; 0.126314 sec user; 288.682473 sec clock +gcc.compile.c++ bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o + + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -I"." -c -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" "libs/system/src/error_code.cpp" + +0.084060 sec system; 0.644133 sec user; 8.858824 sec clock +SEM: <s>gcc-link-semaphore now used by <pbin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi>libboost_system.so.1.67.0 +Using shell: /bin/sh -c + argv[0] = '/bin/sh' + argv[1] = '-c' + argv[2] = ' + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0" -Wl,-h -Wl,libboost_system.so.1.67.0 -shared -Wl,--start-group "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -fPIC -pthread -g -Wl,-elf2flt -static +' +gcc.link.dll bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0 + + "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0" -Wl,-h -Wl,libboost_system.so.1.67.0 -shared -Wl,--start-group "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -fPIC -pthread -g -Wl,-elf2flt -static + +ld (ld-elf2flt): -shared used without passing a shared library ID +collect2: error: ld a retourné le statut de sortie 1 +0.003123 sec system; 0.004732 sec user; 15.646509 sec clock +...failed gcc.link.dll bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0... + +To fix this, move the exe statement before the boost/thread project + +Fixes: + - http://autobuild.buildroot.org/results/f46d38991385cbc2a4fa14eb31074e770cd79803 + +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> +[Upstream status: https://github.com/boostorg/thread/pull/231] +--- + build/Jamfile.v2 | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libs/thread/build/Jamfile.v2 b/build/Jamfile.v2 +index ce8c7f47..26d8b9c3 100644 +--- a/libs/thread/build/Jamfile.v2 ++++ b/libs/thread/build/Jamfile.v2 +@@ -38,6 +38,8 @@ import path ; + import configure ; + import threadapi-feature ; + ++exe has_atomic_flag_lockfree : ../build/has_atomic_flag_lockfree_test.cpp ; ++ + project boost/thread + : source-location ../src + : requirements <threading>multi +@@ -141,8 +143,6 @@ project boost/thread + <library>/boost/system//boost_system + ; + +-exe has_atomic_flag_lockfree : ../build/has_atomic_flag_lockfree_test.cpp ; +- + rule tag ( name : type ? : property-set ) + { + local result = $(name) ; +-- +2.17.1 +
When build statically, boost is unable to detect lock-free atomics ints because it tries to link dynamically, see output/build/boost-1.67.0/bin.v2/config.log (with -d5 option): Using shell: /bin/sh -c argv[0] = '/bin/sh' argv[1] = '-c' argv[2] = ' "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp" ' gcc.compile.c++ bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -c -o "bin.v2/libs/thread/build/gcc-6.4.0/debug/threading-multi/has_atomic_flag_lockfree_test.o" "libs/thread/src/../build/has_atomic_flag_lockfree_test.cpp" 0.033561 sec system; 0.126314 sec user; 288.682473 sec clock gcc.compile.c++ bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -Wl,-elf2flt -static -fPIC -pthread -O0 -fno-inline -Wall -pedantic -g -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -I"." -c -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" "libs/system/src/error_code.cpp" 0.084060 sec system; 0.644133 sec user; 8.858824 sec clock SEM: <s>gcc-link-semaphore now used by <pbin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi>libboost_system.so.1.67.0 Using shell: /bin/sh -c argv[0] = '/bin/sh' argv[1] = '-c' argv[2] = ' "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0" -Wl,-h -Wl,libboost_system.so.1.67.0 -shared -Wl,--start-group "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -fPIC -pthread -g -Wl,-elf2flt -static ' gcc.link.dll bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0 "/home/fabrice/buildroot/output/host/bin/arm-linux-g++" -o "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0" -Wl,-h -Wl,libboost_system.so.1.67.0 -shared -Wl,--start-group "bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -fPIC -pthread -g -Wl,-elf2flt -static ld (ld-elf2flt): -shared used without passing a shared library ID collect2: error: ld a retourné le statut de sortie 1 0.003123 sec system; 0.004732 sec user; 15.646509 sec clock ...failed gcc.link.dll bin.v2/libs/system/build/gcc-6.4.0/debug/threading-multi/libboost_system.so.1.67.0... Due to this wrong detection, boost_atomic is wrongly selected by boost_thread which cause a build failure on missing select To fix this, move the exe statement before the boost/thread project Fixes: - http://autobuild.buildroot.org/results/f46d38991385cbc2a4fa14eb31074e770cd79803 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> --- Changes v2 -> v3 (after review of Thomas Petazzoni): - Replace hack by a patch movin exe statement in the beginning of libs/thread/build/Jamfile.v2 Changes v1 -> v2 (after review of Arnout Vandecappelle): - Fix URL of build failure ...c-detection-of-lock-free-atomic-ints.patch | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 package/boost/0005-fix-static-detection-of-lock-free-atomic-ints.patch