linking problem __pgi_trace and __pgi_tracee

make decode_bufr

shell command brings the following error :

gcc decode_bufr.c -o decode_bufr  -L/usr/local/lib -lemos -L /opt/pgi/linux86/7.0/lib -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgftnrtl -lc -lnspgc -lrt -lpgc -L /opt/pgi/linux86/7.0/lib/pgi.ld -Wl,-rpath /opt/pgi/linux86/7.0/lib
/opt/pgi/linux86/7.0/lib/libpgc.so: undefined reference to `__pgi_trace'
/opt/pgi/linux86/7.0/lib/libpgc.so: undefined reference to `__pgi_tracee'

and the makefile is like this :

#
# Makefile for compiling and linking C grib decoding tools with LIBEMOS 
# compiled with the PGI Fortran compilers
#

TARGETS  = all clean decode_grib

SOURCES  = decode_grib.c decode_bufr.c

PGILIB52 = -L /opt/pgi/linux86/7.0/lib -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgftnrtl -lc -lnspgc -lrt -lpgc
PGILDFLAGS52  = -Wl,-rpath /opt/pgi/linux86/7.0/lib

PGILDFLAGS52_2=-L /opt/pgi/linux86/7.0/lib/pgi.ld

EMOSLIB52  = -L/usr/local/lib -lemos

PGILD52   = $(PGILIB52) $(PGILDFLAGS52_2) $(PGILDFLAGS52) 

CC       = gcc
CFLAGS   = 
LD       = gcc

LDFLAGS52 = $(EMOSLIB52) $(PGILD52)
LDFLAGS  = $(LDFLAGS52)

#setenv LDFLAGS="-L /usr/local/lib /usrpgi/linux86/7.0/lib/pgi.ld"


all: decode_grib decode_bufr

clean:
	rm -f decode_grib.o decode_grib

decode_grib:  decode_grib.c
	$(CC) decode_grib.c -o decode_grib $(CFLAGS) $(LDFLAGS)

decode_grib52:  decode_grib.c
	$(CC) decode_grib.c -o decode_grib52 $(CFLAGS) $(LDFLAGS52)

decode_bufr:  decode_bufr.c
	$(CC) decode_bufr.c -o decode_bufr $(CFLAGS) $(LDFLAGS)

decode_bufr52: decode_bufr.c 
	$(CC) decode_bufr.c -o decode_bufr52 $(CFLAGS) $(LDFLAGS52)

why am i getting those errors?

thanx.

Hi asilter,

The link file /opt/pgi/linux86/7.0/lib/pgi.ld needs to be added before the libraries.

Hope this helps,
Mat

:( nope. same error message comes.