PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

building shared libraries with -mcmodel=medium

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
benkirk



Joined: 21 Oct 2004
Posts: 2

PostPosted: Tue Oct 09, 2007 8:46 am    Post subject: building shared libraries with -mcmodel=medium Reply with quote

I have a collection of object files which are built with -mcmodel=medium which I want to link into a shared library. The objects are compiled as:

praesepe(152)$ pgcc -c *.c -I../../include/base -mcmodel=medium
eigenval.c:
errhandl.c:
factor.c:
itersolv.c:
matrix.c:
mlsolv.c:
operats.c:
precond.c:
qmatrix.c:
qvector.c:
rtc.c:

(no problem. I get the desired .o's)

Now, I am trying to link them into a shared library:

praesepe(153)$ pgcc -mcmodel=medium -o liblaspack.so *.o
/usr/lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'

praesepe(154)$ pgcc -shared -mcmodel=medium -o liblaspack.so *.o
pgcc-Error-Switches -shared and -mcmodel=medium are not supported together

praesepe(155)$ pgcc -shared -o liblaspack.so *.o
/usr/bin/ld: errhandl.o: relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
errhandl.o: could not read symbols: Bad value


What is going on?
Back to top
View user's profile
hongyon



Joined: 19 Jul 2004
Posts: 551

PostPosted: Tue Oct 09, 2007 9:08 am    Post subject: Reply with quote

Hello,

-mcmodel=medium and -fpic cannot be used together. They clash. To build shared library, please compile with -fPIC , without -mcmodel=medium.

Hongyon
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group