Help please, Problem when compile EMAN

I used the -ql tag when compiling the EMAN program, in the link stage following error would occur:

/usr/bin/ld: CMakeFiles/EM.dir/EMDataA.o: relocation R_X86_64_32S against `a local symbol’ can not be used when making a shared object; recompile with -fPIC

however, the compiling command for EMDataA.o as followed have already with -fPIC tag their:
pgCC -DEM_EXPORTS -O2 -tp k8-64e -ql -fPIC … -o ./EMDataA.o -c /usr/bin/eman_build/em

when remove the -ql tag everything goes OK, so I cann’t figuring out what’s the problem here?

I’m using PGI 7.12, and a workstation equipped with 4 dual-core AMD opteron processors.

Great thanks for your help~

BTW: My link command goes like this:
pgCC -fPIC -O2 -tp k8-64e -ql -shared -Wl,-soname, -o …/lib/ “CMakeFiles/EM.dir/EMDataA.o” …

This time I try the -pg tag similarly error happened:
/usr/bin/ld: CMakeFiles/EM.dir/EMDataA.o: relocation R_X86_64_PC32 against `_mcount’ can not be used when making a shared object; recompile with -fPIC


Can you please post the whole lines for both compile and link? Did you add -L in your link line?

Also, please add -v for both cases, with and without -ql(or -pg), and post their output here.

Thank you,

hi~ hongyon:

It’s a automatic building process so,

The link command line:
/usr/bin/ld /usr/lib64/crti.o /home/eman/opt/pgi712/linux86-64/7.1-2/libso/trace_init.o /home/eman/opt/pgi712/linux86-64/7.1-2/libso/init_pgpf.o -m elf_x86_64 -dynamic-linker /lib64/ /home/eman/opt/pgi712/linux86-64/7.1-2/lib/pgi.ld -L/home/eman/bin/fftw-2.1.5/lib -L/home/eman/bin/gsl-1.9/lib -L/home/eman/bin/hdf5-1.6.3/lib -L/home/eman/bin/mpich-1.2.7p1/lib -L/home/eman/opt/pgi712/linux86-64/7.1-2/libso -L/home/eman/opt/pgi712/linux86-64/7.1-2/lib -L/usr/lib64 -soname CMakeFiles/EM.dir/EMDataA.o CMakeFiles/EM.dir/EMDataB.o CMakeFiles/EM.dir/EMDataC.o CMakeFiles/EM.dir/Euler.o CMakeFiles/EM.dir/Quaternion.o CMakeFiles/EM.dir/XYData.o CMakeFiles/EM.dir/VolFrag.o CMakeFiles/EM.dir/Cylinder.o CMakeFiles/EM.dir/List.o CMakeFiles/EM.dir/Vect.o CMakeFiles/EM.dir/VolTable.o CMakeFiles/EM.dir/EMIcos.o CMakeFiles/EM.dir/EMVtk.o CMakeFiles/EM.dir/hyper.o CMakeFiles/EM.dir/util.o CMakeFiles/EM.dir/EMHist.o CMakeFiles/EM.dir/EMPif.o CMakeFiles/EM.dir/EMhdf.o CMakeFiles/EM.dir/EMhdf2.o CMakeFiles/EM.dir/emobject.o CMakeFiles/EM.dir/GatanDM3.o CMakeFiles/EM.dir/EMem.o CMakeFiles/EM.dir/eulerroutines.o CMakeFiles/EM.dir/byteorder.o CMakeFiles/EM.dir/commonLroutines.o -lsfftw -lsrfftw -lgsl -lgslcblas -lm -lhdf5 -lz -Bstatic -lpmpich++ -Bdynamic -lpng -ltiff -ljpeg -rpath /home/eman/bin/fftw-2.1.5/lib:/home/eman/bin/gsl-1.9/lib:/home/eman/bin/hdf5-1.6.3/lib:/home/eman/bin/mpich-1.2.7p1/lib -rpath /home/eman/opt/pgi712/linux86-64/7.1-2/libso -rpath /home/eman/opt/pgi712/linux86-64/7.1-2/lib -o …/lib/ -shared -lpgnod_prof_g -lstd -lC -lnspgc -lpgc -lm /usr/lib64/crtn.o

The compile command line:
/home/eman/opt/pgi712/linux86-64/7.1-2/bin/pgcpp1 --llalign --no_warnings -Dunix -D__unix -D__unix__ -Dlinux -D__linux -D__linux__ -D__NO_MATH_INLINES -D__x86_64__ -D__LONG_MAX__=9223372036854775807L ‘-D__SIZE_TYPE__=unsigned long int’ ‘-D__PTRDIFF_TYPE__=long int’ -D__THROW= -D__extension__= -D__amd64__ -D__SSE__ -D__MMX__ -D__SSE2__ -D__SSE3__ -D__PGI -I/home/eman/eman_build/eman -I/home/eman/eman_build/eman/libEM -I/home/eman/bin/fftw-2.1.5/include -I/home/eman/bin/gsl-1.9/include -I/home/eman/bin/hdf5-1.6.3/include -I/home/eman/bin/mpich-1.2.7p1/include -DEM_EXPORTS -D__PIC__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DHAVE_FSEEKO -DHAVE_FTELLO -DDUMBPAR -DFILESERVER -DHAVE_SYS_POLL_H -DFILELOCK -DTIF -DHDF5 -DPNG -I/home/eman/opt/pgi712/linux86-64/7.1-2/include/CC -I/home/eman/opt/pgi712/linux86-64/7.1-2/include -I/usr/local/include -I/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include -I/usr/include -q -o /tmp/ /home/eman/eman_build/eman/libEM/EMDataA.C

Thanks for your help!


Unfortunately, this seem to be a bug or a feature we need to add.

I have filed a TPR#14852 for this. We will keep you posted of its progress.

Thank you for for reporting to us.

thanks a lot :)


I’m using a 7.0-7 version (we do not have an upgrade for the newer versions), and I also encountered this problem. It was triggered by the use of -Mprof=mpi,func (without, everything is fine)
I tried the PGI toolsuit because it proposed a MPI profiler, but it seems that it is not possible to compile a program to be used with the profiler. Is there a way to circumvent the issue?

Hi Matthieu,

Unfortunately, profiling of shared libraries isn’t supported yet. However, we are actively working on adding this support to a future release (hopefully 8.1).


Too bad, I’m stuck with 7.0-7 :|
This means I will have to change how my application works, to use only static libraries.

Good news for me, we have access to the newest package thanks to a new contract. Is this already solved?

No, not yet. It’s a very difficult issue and our engineers are actively working on it. If all goes well, support of shared library profiling should be available in the 8.1 release. Though, this could be delayed.

One thing you could do now is use sample based hardware profiling using the ‘pgcollect’ utility. (See chapter 21 of the PGI Tool’s guide). You’ll need to install Oprofile and run as root, but it profiles the entire program, including shared libraries.

  • Mat

Too bad, it’s impossible for me to be root on my computer.
Well, I’ll wait, hoping for the best in a future release ;)