From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10ba33,11af15607bd0af82,start X-Google-Attributes: gid10ba33,public X-Google-Thread: fee84,77653ffe51c35a24 X-Google-Attributes: gidfee84,public From: pedwards@valhalla.cs.wright.edu (Phil Edwards) Subject: Re: gcc 2.7.2, ld warnings on Digital UNIX v3.2 Date: 1996/05/01 Message-ID: <4m6a4n$em2@valhalla.cs.wright.edu>#1/1 X-Deja-AN: 152336688 distribution: world references: <4ktph9$o2n@odo.amherst.com> <4kubph$b90@vertex.tor.hookup.net> <317443FF.213B@wlv.iipo.gtegsc.com> <4lo9l0$n8g@disunms.epfl.ch> organization: the top of Solsbury Hill. newsgroups: comp.unix.osf.osf1,gnu.g++.help With <4lo9l0$n8g@disunms.epfl.ch>, it seems Radenko Kalajdzic (rkalajdz@di.epfl.ch) sez: [snip rebuild notes] + /usr/bin/ld: + Warning: clog defined as GLOBAL DATA but is defined in a shared + lib as a GLOBAL FUNC + /usr/bin/ld: + Warning: clog defined as GLOBAL DATA but is defined in a shared + lib as a GLOBAL FUNC + didec30: ~/projets/adaline > + ------ The problem is due to a conflict between iostream.h and libm.a. The iostream header file contains this declaration: extern _IO_ostream_withassign cout, cerr, clog; The conflict lies with the complex logarithm function declared in the mathematics library: [11 gamma]> cd /tmp [12 gamma]> ar xv /usr/ccs/lib/libm.a clog.o x - clog.o [13 gamma]> nm clog.o Name Value Type Size __dpml_globals_table | 0000000000000000 | N | 0000000000000000 _fpdata | 0000000000000000 | U | 0000000000000000 atan2 | 0000000000000000 | U | 0000000000000008 * clog | 0000000000000016 | T | 0000000000000008 hypot | 0000000000000000 | U | 0000000000000008 log | 0000000000000000 | U | 0000000000000008 [14 gamma]> The *'ed line is the actual clog(3) function, and therein lies the conflict: the GLOBAL DATA is the clog declared in the header file, and the GLOBAL FUNCtion is the result of g++ automatically linking in the math library even though one usually doesn't ask g++ to do so. The solution is one of: 1) Ignore it. ld(1) is just confused because the kind folks at GNU are making stupid assumptions again. 2) Build a g++ which doesn't call for -lm, and thus not link in the math library. If you do this, be certain to keep backups of the original g++. 3) Build a math library which doesn't contain clog(3), and name it libm.a; keep the "real" one as liboldm.a or something. This is probably easier than (2), since all it requires is lots of time spent with ar(1), but will break any compilations requiring the complex logarithm function. Probably a bad idea, all in all. 4) Find a version of g++ in which "g++" is just a script which calls gcc with command-line arguments, and then remove "-lm" from the script. Personally, I think GNU made a /big/ mistake when they moved g++ to a separate executable: their goal of "an integrated compiler" is now further away, and "gcc" doesn't correctly detect a C++ program anymore. Just my two timeslices there. I went with option (1), and have been happier ever since. Luck++; Phil -- #include The gods do not protect fools. Fools finger pedwards@gamma.cs.wright.edu are protected by more capable fools. email pedwards@valhalla.cs.wright.edu -Larry Niven