[build2] build2-toolchain (phase2) link errors related to "thread_local" not passed accross projects

christian montanari ptizoom at gmail.com
Mon Jul 9 20:33:59 UTC 2018


I got these anoying linking errors trying buildind build2 in « phase2 » on CYGWIN, based on the 
https://github.com/build2/build2-toolchain.git build2/build2

I found it quite close to these observations:
https://gcc.gnu.org/ml/gcc-bugs/2015-01/msg02097.html
https://stackoverflow.com/questions/28023728/using-extern-thread-local-in-c11-on-cygwin-amd64

and then canceled the problem by using “__thread” instead of “thread_local”
(see git patch attached).

The patch is actually in  file “libbutl/ft/lang.hxx” to cancel   
 define of « __cpp_thread_local »  and so allow consistancy accross libbutl and « b » exec.
surely this is not right but it works for my selfish needs.

(I am new to this jazz, it seems to me a lot frustrating work is implied to decipher this “build2” and not much added value to the core project. Anyway I dived in because I like this “odb” stuff, but still I am wondering why  one did not stick to m4 macros as everything is there since the beginning of ages !)

I have attached also my first reciepies for building with a cygwin machine.
Note all the added defines needed to get to this stage. 

Cheerio.


The link error:
...
++ -Og -std=c++1z -L /usr/local/lib -o build2/b build2/b.o -Wl,--whole-archive build2/libb.u.a -Wl,--no-whole-archive ../libbutl/libbutl/libbutl.a -lpthread ../libpkgconf/libpkgconf/libpkgconf.a -lpthread -lpthread
build2/b.o:b.cxx:(.text$_ZZN6build214fail_mark_baseC4EPKcPKvENKUlRKN4butl11diag_recordEE_clES8_[_ZZN6build214fail_mark_baseC4EPKcPKvENKUlRKN4butl11diag_recordEE_clES8_]+0xc): relocalisation tronquée pour concorder avec la taille : R_X86_64_PC32 vers le symbole indéfini TLS init function for build2::diag_frame::stack
build2/b.o:b.cxx:(.text$_ZZN6build214fail_mark_baseC4EPKcPKvENKUlRKN4butl11diag_recordEE_clES8_[_ZZN6build214fail_mark_baseC4EPKcPKvENKUlRKN4butl11diag_recordEE_clES8_]+0x16): relocalisation tronquée pour concorder avec la taille : R_X86_64_PC32 vers le symbole indéfini TLS init function for build2::diag_frame::stack
build2/libb.u.a(algorithm.o):algorithm.cxx:(.text+0x200): relocalisation tronquée pour concorder avec la taille : R_X86_64_PC32 vers le symbole indéfini TLS init function for build2::diag_frame::stack
build2/libb.u.a(algorithm.o):algorithm.cxx:(.text+0x20a): relocalisation tronquée pour concorder avec la taille : R_X86_64_PC32 vers le symbole indéfini TLS init function for build2::diag_frame::stack
build2/libb.u.a(algorithm.o):algorithm.cxx:(.text+0x225): relocalisation tronquée pour concorder avec la taille : R_X86_64_PC32 vers le symbole indéfini TLS init function for build2::diag_frame::stack
build2/libb.u.a(algorithm.o):algorithm.cxx:(.text+0x22f): relocalisation tronquée pour concorder avec la taille : R_X86_64_PC32 vers le symbole indéfini TLS init function for build2::diag_frame::stack
build2/libb.u.a(algorithm.o):algorithm.cxx:(.text+0x28b): relocalisation tronquée pour concorder avec la taille : R_X86_64_PC32 vers le symbole indéfini TLS init function for build2::diag_frame::stack
build2/libb.u.a(algorithm.o):algorithm.cxx:(.text+0x295): relocalisation tronquée pour concorder avec la taille : R_X86_64_PC32 vers le symbole indéfini TLS init function for build2::diag_frame::stack
build2/libb.u.a(algorithm.o):algorithm.cxx:(.text+0x2ca): relocalisation tronquée pour concorder avec la taille : R_X86_64_PC32 vers le symbole indéfini TLS init function for build2::diag_frame::stack
build2/libb.u.a(algorithm.o):algorithm.cxx:(.text+0x2d4): relocalisation tronquée pour concorder avec la taille : R_X86_64_PC32 vers le symbole indéfini TLS init function for build2::diag_frame::stack
build2/libb.u.a(algorithm.o):algorithm.cxx:(.text+0x8e5): débordement de relocalisation additionnelle omise à partir de la sortie
collect2: error: ld a retourné le statut de sortie 1
skipped updating 20 targets
info: failed to update build2/exe{b}
make: *** [build2.mk:32: phase2.0] Error 1

the patch…

diff --git a/libbutl/ft/lang.hxx b/libbutl/ft/lang.hxx
index 4f0663c..2391fc7 100644
--- a/libbutl/ft/lang.hxx
+++ b/libbutl/ft/lang.hxx
@@ -22,8 +22,11 @@
 #      define __cpp_thread_local 201103
 #    endif
 #  else
-#    define __cpp_thread_local 201103
+#    if !defined(CYGWIN_)
+#      define __cpp_thread_local 201103
+#    endif
 #  endif
+
 #endif
 
 #endif // LIBBUTL_FT_LANG_HXX

The build reciepes :

#!/usr/bin/make -f
#phase 1
phase1.0 bootstrap build2/b-boot.exe:
	$(MAKE) -C /usr/src/git.codesynthesis.com/build2-toolchain/build2 \
	 -f bootstrap.gmake CXX=g++ CPPFLAGS="-I/usr/local/include  -I/usr/include  -DCYGWIN "  libbutl=../libbutl

phase2.0:
	cd /usr/src/git.codesynthesis.com/build2-toolchain/build2 \
	; build2/b-boot --verbose 2 \
		config.cxx=g++ \
		config.cxx.poptions="-D_DEFAULT_SOURCE -DCYGWIN -D__CYGWIN__ -D_POSIX_C_SOURCE=200809 -D_XOPEN_SOURCE=700" \
		config.cxx.coptions=-Og  \
		config.bin.lib=static \
		build2/exe{b}

tbc...

Provenance : Courrier pour Windows 10

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.build2.org/archives/users/attachments/20180709/6bf91d69/attachment.html>


More information about the users mailing list