gcc and linking problems?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have some code which I have managed to compile with Suns cc on
Solaris9, sparc

cc: Sun WorkShop 6 update 2 C 5.3 Patch 111679-14 2004/02/20
ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.375

but which I can't with GCC and gnu ld:

gcc (GCC) 4.1.0,  GNU ld version 2.16.1 or even ld 2.17.

I'm getting errors of the form:

fft_2d_filter.o: In function `fft_2d_forward':
fft_2d_filter.c:(.text+0x28): undefined reference to `fftw_plan_dft_r2c_2d'
fft_2d_filter.c:(.text+0x3c): undefined reference to `fftw_execute'

and

/usr/local/lib/gcc/sparc-sun-solaris2.9/4.1.0/../../../libpng.so: undefined reference to `deflate'

The first form (.text+0x<something>) I don't recall seeing before, 
though I've been using gcc since about 1990, and these functions are defined
in the headers.
The second one seems to be a linker problem, since it is complaining about
the library file itself.  Other programs seem to be working with PNG images
correctly, however.  

My Makefile which I using with GNU make 3.81 looks like this:
<quote>

CC = gcc
# CC = /progs/SUNWspro/bin/cc

# LD = /usr/ccs/bin/ld 
LD = /usr/local/bin/ld
# /usr/lib/ld.so /usr/lib/ld /usr/ucb/ld /usr/local/bin/ld
LIBS = -z verbose -z rescan -L$(LD_LIBRARY_PATH)  -lfftw3 -lm -ll -lz -lpng
# CFLAGS = -Wall -Wextra -I/usr/local/include -fPIC
CFLAGS = -I/usr/local/include 
# Our lexer may need to be flex later, but for now, we use lex.
LEX=/usr/ccs/bin/lex
# similarly, our YACC may need to be BISON. For now, use yacc.
YACC=/usr/local/bin/yacc -d


LD_LIBRARY_PATH=/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
LD_RUN_PATH=${LD_LIBRARY_PATH}



zipfile:	fsv.c fft_2d_filter.c fft_2d_filter.h 2d_input.l 2d_input.y
	zip fsv.zip fsv.c fft_2d_filter.c fft_2d_filter.h 2d_input.l 2d_input.y

fsv:	y.tab.o lex.yy.o fsv.o fft_2d_filter.o 
	$(CC) $(CFLAGS) $(LIBS) -o $@ fsv.o fft_2d_filter.o y.tab.o \
	lex.yy.o

.c.o:
	$(CC) $(CFLAGS) -c -o $@ $<

y.tab.c y.tab.h: 2d_input.y
	$(YACC) 2d_input.y

lex.yy.c: 2d_input.l
	$(LEX) $<


fsvclean:
	/bin/rm lex.yy.[cho] y.tab.[cho] fsv fft_2d_filter.o fsv.o 

</quote>

and the -z verbose -z rescan are actually Sun ld options, though GNU
ld doesn't choke on them.

I've tried using Google for these errors, with nothing seemingly
helpful showing up, and I'm wondering what docs specifically I
should be reading to understand why I get these failures?  Since
the Sun tools produce an executable, I think I can't be too far off
the true path.... 

        Thank you,
        Hugh


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux