libc Problem

Hi everyone,

I am trying already couple of days now to compile a code (written partly in fortran and partly in c) but I keep getting this error:

/usr/lib64/gcc/x86_64-suse-linux/4.8/…/…/…/…/x86_64-suse-linux/bin/ld: dynamic STT_GNU_IFUNC symbol strcmp' with pointer equality in /usr/lib64/libc.a(strcmp.o)’ can not be used when making an executable; recompile with -fPIE and relink with -pie
collect2: error: ld returned 1 exit status

This is what my makefile looks like:

CFLAGS = -Wall -O3 -I …/…/…/SPOOLES.2.2 -DARCH=“Linux” -DSPOOLES -DARPACK -DMATRIXSTORAGE -fPIE -m64
FFLAGS = -Wall -O3 -fPIE -m64
LDFLAGS = -pie $(LDFLAGS)

CC=mpic++
FC=gfortran

.c.o :
$(CC) $(CFLAGS) -c $<
.f.o :
$(FC) $(FFLAGS) -c $<

include Makefile.inc

SCCXMAIN = ccx_2.7.c

OCCXF = $(SCCXF:.f=.o)
OCCXC = $(SCCXC:.c=.o)
OCCXMAIN = $(SCCXMAIN:.c=.o)

DIR=…/…/…/SPOOLES.2.2

LIBS =
…/…/…/SPOOLES.2.2/spooles.a
…/…/…/ARPACK/libarpack_INTEL.a
/usr/lib64/libpthread.a /usr/lib64/libm.a /usr/lib64/libc.a

ccx_2.7: $(OCCXMAIN) ccx_2.7.a $(LIBS)
./date.pl; $(CC) $(CFLAGS) -c ccx_2.7.c; $(FC) -Wall -O3 -o $@ $(OCCXMAIN) ccx_2.7.a $(LIBS)

ccx_2.7.a: $(OCCXF) $(OCCXC)
ar vr $@ $?

I have opensuse 13.1 installed. Any help is welcome. I am not a programmer, I just use research codes written in fortran for my research in computational solid mechanics.

Thank you in advance.

Why you are explicitly using static libraries? You should use “-lpthread -lm” and let compiler pick either static or dynamic version depending on other flags. -lc is normally redundant and assumed as default (unless you explicitly tell compiler to not use standard libraries).

Thanks for your answer.

When I write in the makefile -lpthread -lm -lc (or just ignore -lc) I get a lot of “undefined reference to” and also an error at the end. Problem seems to be even bigger then.

Hello jorgosm and welcome to these forums.

Not easy to detect for a new forums user here, but very important are the CODE tags. You get them by clicking on the # button in the tool bar of the post editor. You then copy/paste computer text from your terminal window in between the tags. This will make computer text in a post much better readable.

When possible we prefer to copy from the terminal window the prompt, the command, the output and the next prompt. Then you do not have to explain very much about what you did, where you did it and what you got because it is all there.

Well, that suggests that you may need more libraries. Post full makefile output (if it is long, upload it to susepaste.org and post link here).

I have written in the makefile -lpthread -lm -lc, all the other parts remain the same.

http://susepaste.org/69085593

Here is a link to the output.

Thank you very much.

Patch to build ccx 2.6 (https://build.opensuse.org/package/view_file/science/ccx/ccx-2.6-build.patch?expand=1) is using “-lspooles -larpack -llapack -lblas” instead of direct archives. Of course version 2.7 may need more changes.

I would suggest you contact maintainer of ccx package for openSUSE (http://software.opensuse.org/package/ccx); may be ask for new version.

I think it worked!!! With just a small change about the lspooles!!! rotfl!rotfl!rotfl!rotfl!

Man you 're great! I would so buy you a nice cold bavarian beer man!

Thanks!

Well, if you are serious, I’m in Augsburg for two weeks starting with May the 5th :stuck_out_tongue:

Munich is quite close :slight_smile: And the beer is always cold, so if you drop by. Thanks again!