From: Hugh Sasse Date: 2006-09-14T02:32:33+09:00 Subject: OT: compilation probs (later extension). This is somewhat OT for Ruby-Talk, but I want to build this against Ruby later, and Ruby is built with GCC. I suppose I could make another one built with Sun's cc, put it somewhere else, but I'd consider that a violation of DRY. Anyway, my question which I've been wrestling with for over a week, and which help from the gcc-help list hasn't solved for me, is: Compiling my application (which uses FFTW 3.1) with the Sun cc works, and I get an executable, but compiling it with gcc I get errors of the form: [...] gcc -R/usr/local/lib -g -I/usr/local/include -z verbose -z rescan -L/progs/SUNWspro/lib:/usr/local/lib:/usr/local/lib/sparcv9:/usr/lib:/usr/share/lib:/usr/dt/lib:/usr/openwin/lib:/opt/panorama/lib:/opt/sfw/lib -lfftw3 -lm -ll -lpng -lz -o fsv fsv.o fft_2d_filter.o y.tab.o \ lex.yy.o fft_2d_filter.o: In function `fft_2d_forward': /home/hgs/fsv/fft_2d_filter.c:30: undefined reference to `fftw_plan_dft_r2c_2d' /home/hgs/fsv/fft_2d_filter.c:31: undefined reference to `fftw_execute' fft_2d_filter.o: In function `fft_2d_inverse': [...] collect2: ld returned 1 exit status gmake: *** [fsv] Error 1 The fftw3 library exists, as do the png libraries, I recently tried adding the -R option into the build of fftw3 so that the paths to the libraries would get built in, but I get the same errors anyway. I thought my libraries might be in the wrong order, and putting -lz after -lpng got rid of the errors like: /usr/local/lib/gcc/sparc-sun-solaris2.9/4.1.0/../../../libpng.so: undefined reference to `deflate' /usr/local/lib/gcc/sparc-sun-solaris2.9/4.1.0/../../../libpng.so: undefined reference to `inflate' [...] I don't really know how to get that right in future. I tried using lorder and tsort but that produces a huge amount of output (in /usr/local/lib): bash-2.05$ ls lib{fftw*,z*,png*} | xargs lorder | tsort |wc /usr/ccs/bin/nm: libfftw3.la: invalid file type 352 352 3946 bash-2.05$ Can anyone help me out with this, or have I entered a really obscure area of C programming? Sorry for the OT nature of this, but I want to get to the bottom of this, or I'm just "programming by coincidence". The difference between witchcraft and science... There is no fftw3 list, which is hardly an excuse. Thank you, Hugh