The basic printf("hello world!\n" program fails to link under gcc-3.4.0 on solaris 2.6 with the following error: /apps/race/home/nickt/gcc/bin/ld: a.out: hidden symbol `__eprintf' in /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/libgcc.a (_eprintf.oS) is referenced by DSO This is for the following command line: g++ -v test.cpp The identical file (with .c extension) compiles/links with gcc and g++. All my other c++ executables suffer the same link issue. gcc was configured as follows: kilmer: ~>g++ -v Reading specs from /apps/race/home/nickt/gcc/lib/gcc/sparc-sun- solaris2.6/3.4.0/specs Configured with: ../gcc-3.4.0/configure --prefix=/apps/race/home/nickt/gcc -- with-gnu-as --with-as=/apps/race/gcc/bin/as --with-gnu-ld --with- ld=/apps/race/gcc/bin/ld --enable-languages=c,c++ Thread model: posix gcc version 3.4.0 And built using: gmake CFLAGS='-O' LIBCFLAGS='-g -O2' \ LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap-lean Thanks Nick Thurn
Could you upload a compilable testcase that fails to link? Thanks in advance.
Subject: Re: __eprintf link issue for c++ on solaris 2.6 try: #include <cstdio> int main(int, const char* []) { std::printf("Hello world!\n"); return 0; } This fails on my machine. when compiled with g++ -v test.cpp cheers Nick CBTO-GRT IT Sydney +61-2-9258-1394 gcc-bugzilla@gcc. gnu.org To: Nick Thurn/Sydney/DBAustralia/DeuBa@DBAustralia cc: 03/05/2004 03:45 Subject: [Bug target/15253] __eprintf link issue for c++ on solaris 2.6 PM Please respond to gcc-bugzilla ------- Additional Comments From ebotcazou at gcc dot gnu dot org 2004-05-03 05:45 ------- Could you upload a compilable testcase that fails to link? Thanks in advance. -- What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot gnu dot | |org Status|UNCONFIRMED |WAITING http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15253 ------- You are receiving this mail because: ------- You reported the bug, or are watching the reporter. -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
Thanks. The problem doesn't occur with a compiler built with 'gmake bootstrap' and wired to use the Sun tools. I'll try to reproduce your configuration.
Subject: Re: __eprintf link issue for c++ on solaris 2.6 I just realised the full config wasn't in the original report. In any case the below shows the error. Note that I recompiled with gmake bootstrap last night to no effect - I did not start from clean and configure however. kilmer: ~>g++ -v test.cpp Reading specs from /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/specs Configured with: ../gcc-3.4.0/configure --prefix=/apps/race/home/nickt/gcc --with-gnu-as --with-as=/apps/race/gcc/bin/as --with-gnu-ld --with-ld=/apps/race/gcc/bin/ld --enable-languages=c,c++ Thread model: posix gcc version 3.4.0 /apps/race/home/nickt/gcc/libexec/gcc/sparc-sun-solaris2.6/3.4.0/cc1plus -quiet -v test.cpp -quiet -dumpbase test.cpp -mcpu=v7 -auxbase test -version -o /var/tmp//ccoYMIug.s ignoring nonexistent directory "/apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/../../../../sparc-sun-solaris2.6/include" #include "..." search starts here: #include <...> search starts here: /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/../../../../include/c++/3.4.0 /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/../../../../include/c++/3.4.0/sparc-sun-solaris2.6 /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/../../../../include/c++/3.4.0/backward /usr/local/include /apps/race/home/nickt/gcc/include /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/include /usr/include End of search list. GNU C++ version 3.4.0 (sparc-sun-solaris2.6) compiled by GNU C version 3.4.0. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 /apps/race/gcc/bin/as -V -Qy -s -o /var/tmp//ccAL9glz.o /var/tmp//ccoYMIug.s GNU assembler version 2.14 (sparc-sun-solaris2.6) using BFD version 2.14 20030612 /apps/race/home/nickt/gcc/libexec/gcc/sparc-sun-solaris2.6/3.4.0/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/crt1.o /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/crti.o /usr/ccs/lib/values-Xa.o /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/crtbegin.o -L/apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0 -L/apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/../../../../sparc-sun-solaris2.6/lib -L/usr/ccs/bin -L/usr/ccs/lib -L/apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/../../.. /var/tmp//ccAL9glz.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lc /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/crtend.o /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/crtn.o /apps/race/gcc/bin/ld: a.out: hidden symbol `__eprintf' in /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/libgcc.a(_eprintf.oS) is referenced by DSO GNU ld version 2.14 20030612 Supported emulations: elf32_sparc collect2: ld returned 1 exit status cheers Nick CBTO-GRT IT Sydney +61-2-9258-1394 gcc-bugzilla@gcc. gnu.org To: Nick Thurn/Sydney/DBAustralia/DeuBa@DBAustralia cc: 03/05/2004 05:19 Subject: [Bug target/15253] __eprintf link issue for c++ on solaris 2.6 PM Please respond to gcc-bugzilla ------- Additional Comments From ebotcazou at gcc dot gnu dot org 2004-05-03 07:19 ------- Thanks. The problem doesn't occur with a compiler built with 'gmake bootstrap' and wired to use the Sun tools. I'll try to reproduce your configuration. -- What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW Ever Confirmed| |1 Last reconfirmed|0000-00-00 00:00:00 |2004-05-03 07:19:44 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15253 ------- You are receiving this mail because: ------- You reported the bug, or are watching the reporter. -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
Subject: Re: New: __eprintf link issue for c++ on solaris 2.6 > /apps/race/home/nickt/gcc/bin/ld: a.out: hidden symbol `__eprintf' > in /apps/race/home/nickt/gcc/lib/gcc/sparc-sun-solaris2.6/3.4.0/libgcc.a > (_eprintf.oS) is referenced by DSO I've encountered this error before. I don't remember the exact cause, but usually it means that an unfixed or outdated <assert.h> is being picked up by the new compiler, or you have some mis-built shared library (whichever one is trying to reference _eprintf, probably because of a bad assert.h).
Thanks for the hint, Daniel. The ident of <assert.h> is #pragma ident "@(#)assert.h 1.9 92/07/14 SMI" /* SVr4.0 1.6.1.4 */ on the Solaris 2.6 box and it is not fixed by the compiler.
I couldn't reproduce the problem on: beeba% uname -a SunOS beeba 5.6 Generic_105181-35 sun4u sparc SUNW,Ultra-2 with GNU assembler version 2.14 (sparc-sun-solaris2.6) using BFD version 2.14 20030612 GNU ld version 2.14 20030612 Supported emulations: elf32_sparc configured with: /home/eric/cvs/gcc-3_4-branch/configure --prefix=/opt/build/eric/local --enable-languages=c,c++ --with-as=/opt/build/eric/local/bin/as --with-gnu-as --with-ld=/opt/build/eric/local/bin/ld --with-gnu-ld and built with 'gmake bootstrap'. Can you see what your <assert.h> looks like and whether it is fixed by the compiler?
Subject: Re: __eprintf link issue for c++ on solaris 2.6 Hi, Sorry for the slow response - I've been out of the office. My assert.h file looks like the below and is not fixed by the build process. I presume you mean I should find an assert.h file in the gcc install location that being: <install location>/lib/gcc/sparc-sun-solaris2.6/3.4.0/include/assert.h There's none there or anywhere else in the install tree so I guess it's not fixed up. cheers Nick CBTO-GRT IT Sydney +61-2-9258-1394 (See attached file: assert.h) -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
Created attachment 6279 [details] assert.h
Thanks. It appears that we have the same <assert.h> file. Could you determine which shared library references the symbol?
Subject: Re: __eprintf link issue for c++ on solaris 2.6 kilmer: ~/gcc/lib>nm -Al libstdc++.so.* libgcc_s.so.1 *.a | tee file | grep eprintf libstdc++.so.6: U __eprintf libstdc++.so.6.0.0: U __eprintf libstdc++.a:debug.o: U __eprintf /apps/race/home/nickt/src/obj/sparc-sun-solaris2.6/libstdc++-v3/src/../../../../gcc-3.4.0/libstdc++-v3/src/debug.cc:489 Looks like it's the standard library. I ran the same query on the libs in our gcc-3.3.1 install an there is no __eprintf symbol. cheers Nick CBTO-GRT IT Sydney +61-2-9258-1394 -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
*** Bug 15527 has been marked as a duplicate of this bug. ***
the only place __eprintf could be coming from is an old assert.h which should not be installed so this is invalid.
Subject: Re: __eprintf link issue for c++ on solaris 2.6 > the only place __eprintf could be coming from is an old assert.h which should not be > installed so this is invalid. If you mean the Bug is invalid that is not the case. The previous version of gcc did not have this issue. cheers Nick CBTO-GRT IT Sydney +61-2-9258-1394 -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.