From help-request at octave dot org Sat Dec 31 10:18:01 2005 Subject: Re: Build failure on OS X From: "Otto Maddox" To: "Joe Koski" Cc: "Octave Help" Date: Sat, 31 Dec 2005 16:16:58 +0000 OK, thanks to the helpful responses on this list, a bit of googling and some experimentation, I think I have made some progress. I'll now describe what I have figured out so far, because it might generalise to other situations when using a third-party g77 in concert with Apple's gcc/g++ 3.3. My GCC 3.4.5 (which includes g77, as well as gcc and g++) is installed under /opt/local/gcc34. I restarted the configure/make process to make octave as minimal as I could (for debugging purposes): $ env CC=/usr/bin/gcc-3.3 CXX=/usr/bin/g++-3.3 F77=/opt/local/gcc34/bin/g77 ./configure --disable-readline $ make and it goes OK until this (continued afterwards): /usr/bin/g++-3.3 -I. -I.. -I../liboctave -I../src -I../libcruft/misc -DHAVE_CONFIG_H -Wall -W -Wshadow -g -O2 \ -L.. -o octave \ main.o balance.o besselj.o betainc.o chol.o colloc.o daspk.o dasrt.o dassl.o det.o eig.o expm.o fft.o fft2.o fftn.o fftw_wisdom.o filter.o find.o fsolve.o gammainc.o gcd.o getgrent.o getpwent.o getrusage.o givens.o hess.o inv.o kron.o lpsolve.o lsode.o lu.o minmax.o pinv.o qr.o quad.o qz.o rand.o schur.o sort.o sqrtm.o svd.o syl.o time.o \ -L../liboctave -L../libcruft -L../src \ ../src/liboctinterp.a ../liboctave/liboctave.a ../libcruft/libcruft.a \ -framework vecLib -lncurses -lm -L/opt/local/gcc34/lib/gcc/powerpc-apple-darwin8.3.0/3.4.5 -L/opt/local/gcc34/lib/gcc/powerpc-apple-darwin8.3.0/3.4.5/../../.. -lm -lfrtbegin -lg2c -lgcc_s -lSystemStubs -lSystem ld: warning multiple definitions of symbol _xerbla_ ../src/liboctinterp.a(xerbla.o) definition of _xerbla_ in section (__TEXT,__text) /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib(single module) definition of _xerbla_ ld: Undefined symbols: __ZNSs20_S_empty_rep_storageE __ZNSt24__default_alloc_templateILb1ELi0EE10deallocateEPvm __ZNSt24__default_alloc_templateILb1ELi0EE12_S_force_newE __ZNSt24__default_alloc_templateILb1ELi0EE12_S_free_listE __ZNSt24__default_alloc_templateILb1ELi0EE22_S_node_allocator_lockE __ZNSt24__default_alloc_templateILb1ELi0EE8allocateEm __ZNSt24__default_alloc_templateILb1ELi0EE9_S_refillEm restFP saveFP __ZNSt24__default_alloc_templateILb1ELi0EE5_LockD4Ev __ZNSsD4Ev __ZNSs4_Rep9_S_createEmRKSaIcE __ZNSt15basic_streambufIcSt11char_traitsIcEEC4Ev __ZNSt15basic_streambufIcSt11char_traitsIcEED4Ev __ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE14_M_really_syncEmm __ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE7seekoffElSt12_Ios_SeekdirSt13_Ios_Openmode __ZNSaIcED4Ev __ZNSt19basic_ostringstreamIcSt11char_traitsIcESaIcEEC4ESt13_Ios_Openmode __ZNSt13basic_filebufIcSt11char_traitsIcEED4Ev __ZNSi5seekgElSt12_Ios_Seekdir __ZNSt19basic_istringstreamIcSt11char_traitsIcESaIcEEC4ERKSsSt13_Ios_Openmode make[2]: *** [octave] Error 1 make[1]: *** [src] Error 2 make: *** [all] Error 2 In particular, ld has the following two options passed to it: -L/opt/local/gcc34/lib/gcc/powerpc-apple-darwin8.3.0/3.4.5 -L/opt/local/gcc34/lib/gcc/powerpc-apple-darwin8.3.0/3.4.5/../../.. which contain Fortran libraries. But they also contain libstdc++{.a,.dylib} and libgcc.a, which I temporarily "disabled" by renaming: /opt/local/gcc34/lib/gcc/powerpc-apple-darwin8.3.0/3.4.5/libgcc.a.orig /opt/local/gcc34/lib/libstdc++.6.0.3.dylib.orig /opt/local/gcc34/lib/libstdc++.6.dylib.orig /opt/local/gcc34/lib/libstdc++.a.orig /opt/local/gcc34/lib/libstdc++.dylib.orig /opt/local/gcc34/lib/libstdc++.la.orig The problem is that those libraries were shadowing the system libraries /usr/lib/gcc/darwin/3.3/libstdc++.a and /usr/lib/gcc/darwin/3.3/libgcc.a. These system libraries contain the "undefined symbols" which ld was complaining about. saveFP and restFP problems seem to be well known to developers. But I can only assume that the undefined mangled C++ names are also for Apple extensions, which is why they're not contained in /opt/local/gcc34/lib/libstdc++.a (By the way, adding -lcc_dynamic to the linking options is not needed because saveFP and restFP are contained in /usr/lib/gcc/darwin/3.3/libgcc.a) After doing all this, I did another make, followed by make install which succeeded. The solution seems to work, but is ugly. So another question remains... how to do all this cleanly, that is, how to tell the compiler/linker not to link against these particular libraries so I don't have to rename them. Any ideas? Thanks. -- http://www.fastmail.fm - Accessible with your email software or over the web ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------