Bug #124

DLL compilation does not work in linnux

Added by Chris Grandin about 1 year ago. Updated 9 months ago.

Status:ClosedStart date:08/15/2013
Priority:HighDue date:
Assignee:Chris Grandin% Done:

0%

Category:ADMB 11Estimated time:2.00 hours
Target version:ADMB-Trunk

Description

admb -d simple

  • tpl2cpp -bounds -dll simple
  • adcomp -d -s simple.cpp
    g++ -c -O3 -DBUILDING_DLL -D__GNUDOS__ -DBUILDING_DLL -Dlinux -DSAFE_ALL -DUSE_LAPLACE -I. -I"/usr/local/admb"/include -I"/usr/local/admb"/contrib/include simple.cpp
    simple.cpp: In function ‘void simple(char**)’:
    simple.cpp:87:61: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
  • adlink -d -s simple
    g++ -O3 -shared -o simple.so simple.o "/usr/local/admb"/contrib/lib/libcontrib.a "/usr/local/admb"/lib/libadmb.a
    /usr/bin/ld: simple.o: relocation R_X86_64_32S against `vtable for model_data' can not be used when making a shared object; recompile with -fPIC
    simple.o: could not read symbols: Bad value
    collect2: ld returned 1 exit status

Error: Could not build simple.so

Compilation exited abnormally with code 1 at Thu Aug 15 07:23:23

History

#1 Updated by Chris Grandin about 1 year ago

Chris Grandin wrote:

admb -d simple

  • tpl2cpp -bounds -dll simple
  • adcomp -d -s simple.cpp
    g++ -c -O3 -DBUILDING_DLL -D__GNUDOS__ -DBUILDING_DLL -Dlinux -DSAFE_ALL -DUSE_LAPLACE -I. -I"/usr/local/admb"/include -I"/usr/local/admb"/contrib/include simple.cpp
    simple.cpp: In function ‘void simple(char**)’:
    simple.cpp:87:61: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
  • adlink -d -s simple
    g++ -O3 -shared -o simple.so simple.o "/usr/local/admb"/contrib/lib/libcontrib.a "/usr/local/admb"/lib/libadmb.a
    /usr/bin/ld: simple.o: relocation R_X86_64_32S against `vtable for model_data' can not be used when making a shared object; recompile with -fPIC
    simple.o: could not read symbols: Bad value
    collect2: ld returned 1 exit status

Error: Could not build simple.so

Compilation exited abnormally with code 1 at Thu Aug 15 07:23:23

I tried putting -fPIC in adcomp but this leads to other issues

#2 Updated by Chris Grandin 12 months ago

  • Status changed from New to Resolved
  • Estimated time set to 2.00

I added -fPIC to the GNUMakefile and to the admbcomp script.

#3 Updated by Redmine Admin 9 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF