"-static" flag will apply to libc level ( means it will avoid to link to libc as well). What is the goal here ?
Original Message:
Sent: Thu March 21, 2024 06:46 AM
From: Antonin Rozehnal
Subject: g++: Undefined symbol: ._ZNSt18condition_variable10notify_allEv
Build with dynamic libraries works fine, but I would like to ask if it is possible to link all the necessary libraries statically?
When I added the '-static', a lot of the Undefined symbol was listed
<pre>
# g++ -std=gnu++11 -pthread -Wall -Wextra -Wunused -O2 -static -o ugrep ugrep-ugrep.o ugrep-cnf.o ugrep-glob.o ugrep-output.o ugrep-query.o ugrep-screen.o ugrep-stats.o ugrep-vkey.o ugrep-zopen.o ../lib/libreflex.a
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
ld: 0711-317 ERROR: Undefined symbol: __loadx
ld: 0711-317 ERROR: Undefined symbol: _errno
ld: 0711-317 ERROR: Undefined symbol: _system_configuration
ld: 0711-317 ERROR: Undefined symbol: read_sysconfig
ld: 0711-317 ERROR: Undefined symbol: errno
ld: 0711-317 ERROR: Undefined symbol: _pks_state
ld: 0711-317 ERROR: Undefined symbol: __ksetjmp
ld: 0711-317 ERROR: Undefined symbol: sigprocmask
ld: 0711-317 ERROR: Undefined symbol: .ukeyset_activate
ld: 0711-317 ERROR: Undefined symbol: sigcleanup
ld: 0711-317 ERROR: Undefined symbol: environ
ld: 0711-317 ERROR: Undefined symbol: .___memmove
ld: 0711-317 ERROR: Undefined symbol: sbrk
ld: 0711-317 ERROR: Undefined symbol: .___strlen
ld: 0711-317 ERROR: Undefined symbol: getuidx
ld: 0711-317 ERROR: Undefined symbol: getgidx
ld: 0711-317 ERROR: Undefined symbol: .___memset
ld: 0711-317 ERROR: Undefined symbol: __unload
ld: 0711-317 ERROR: Undefined symbol: incinterval
...
</pre>
------------------------------
Antonin Rozehnal
Original Message:
Sent: Tue March 19, 2024 04:04 AM
From: Antonin Rozehnal
Subject: g++: Undefined symbol: ._ZNSt18condition_variable10notify_allEv
Hi Aditya,
I didn't need to install anything else from Toolbox. I already had this installed::
ls -l /opt/freeware/lib/pthread/ppc64
total 0
drwxr-xr-x 3 root system 256 21 kvě 2023 go
lrwxrwxrwx 1 root system 61 21 kvě 2023 libatomic.a -> ../../gcc/powerpc-ibm-aix7.2.0.0/10/pthread/ppc64/libatomic.a
lrwxrwxrwx 1 root system 60 21 kvě 2023 libgcc_s.a -> ../../gcc/powerpc-ibm-aix7.2.0.0/10/pthread/ppc64/libgcc_s.a
lrwxrwxrwx 1 root system 59 21 kvě 2023 libgomp.a -> ../../gcc/powerpc-ibm-aix7.2.0.0/10/pthread/ppc64/libgomp.a
lrwxrwxrwx 1 root system 61 21 kvě 2023 libstdc++.a -> ../../gcc/powerpc-ibm-aix7.2.0.0/10/pthread/ppc64/libstdc++.a
I just added -> export CXX="g++ -pthread"
Thank you so much for your help. :-)
------------------------------
Antonin Rozehnal
Original Message:
Sent: Tue March 19, 2024 02:59 AM
From: Aditya Kamath
Subject: g++: Undefined symbol: ._ZNSt18condition_variable10notify_allEv
Hi Antonin,
These are pthread symbols that are not being found.
Can you try with export CXX="g++ -pthread" or export LDFLAGS="-L/opt/freeware/lib/pthread/ppc64" and then try??
Also, I am curious to know if you want this package from Toolbox.
------------------------------
Aditya Kamath
Original Message:
Sent: Mon March 18, 2024 10:25 PM
From: Antonin Rozehnal
Subject: g++: Undefined symbol: ._ZNSt18condition_variable10notify_allEv
I tried build ugrep https://github.com/Genivia/ugrep by g++ but I ended up with an error for missing symbols. https://github.com/Genivia/ugrep/issues/374
ld: 0711-317 ERROR: Undefined symbol: ._ZNSt18condition_variable10notify_allEvld: 0711-317 ERROR: Undefined symbol: ._ZNSt18condition_variable4waitERSt11unique_lockISt5mutexEld: 0711-317 ERROR: Undefined symbol: ._ZNSt18condition_variableD1Evld: 0711-317 ERROR: Undefined symbol: ._ZNSt18condition_variableC1Evld: 0711-317 ERROR: Undefined symbol: _ZTINSt6thread6_StateEld: 0711-317 ERROR: Undefined symbol: ._ZNSt6thread6_StateD2Evld: 0711-317 ERROR: Undefined symbol: ._ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvEld: 0711-317 ERROR: Undefined symbol: ._ZNSt18condition_variable10notify_oneEvld: 0711-317 ERROR: Undefined symbol: ._ZNSt6thread4joinEvld: 0711-317 ERROR: Undefined symbol: ._ZNSt6thread20hardware_concurrencyEvld: 0711-317 ERROR: Undefined symbol: ._ZNSt11this_thread11__sleep_forENSt6chrono8durationIxSt5ratioILx1ELx1EEEENS1_IxS2_ILx1ELx1000000000EEEEld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.collect2: error: ld returned 8 exit status
Can anyone here advise me if there is any way to fix this?
------------------------------
Antonin Rozehnal
------------------------------