dimanche 2 avril 2017

Use a linux c++ library with PROC PROTO in SAS

I would like to use my own library with the SAS PROC PROTO. I am using the university edition which appears to run on Linux.

I tried to do the following: Compile my source file into a static library (because I am not sure which libc or other standard library are available or in which version thy could be available so I would like to include them all). I used the following: g++ -static -std=c++11 -c foo.cpp -o libfoo.o and then ar rcs libfoo.a libfoo.o

then I upload the libfoo.a on the SAS platform, and made a SAS program like the following:

%let root = /folders/foobar/; 

libname lib "&root";

proc proto package=lib.Foobar 
    Label="Foobar" ;

link "&root/libfoo.a" ;

However then I get the following error:

64         link "&root/libfoo.a" ;
 65         
 66         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 ERROR: Unable to load 'libfoo.a'.
 ERROR: Extension Load Failure: OS Error: -1 (/folders/foobar/libfoo.a: invalid ELF header)
 ERROR: Unable to load extension: (/folders/foobar/libtrie.a)
 ERROR: Could not find extension: (libtrie.a)
 ERROR: Could not find extension: (libtrie.a)

From there I suppose SAS is expecting a dynamic library. so I suppose I should first link statically to include all the dependent libraries, and then link dynamically so that SAS could load it..

Is it the right approach and how is best to do that on Linux/g++ ?

Aucun commentaire:

Enregistrer un commentaire