Page 1 of 1

Compile CS with user library

Posted: Thu Jan 10, 2013 3:20 pm
by Meskine
Hello everybody

I would like to compile code saturne using a static library (.a extension file) in which I archived several modules and routine as objects and two headers files.

I tried to edit "CS_LIB_ADD=" in the runcase as follow :

CS_LIB_ADD = mylibpath/libname.a

or

CS_LIB_ADD = "-Lmylibpath -lname"

Niether of the two attempts does works :

the first return a compile error (all my routines in the library are not found)
the second return that -l is not recognise as a option of compile

Is there anybody to help me ?

Thank you

Re: Compile CS with user library

Posted: Fri Jan 11, 2013 2:03 am
by Yvan Fournier
Hello,

Could you provide details as recommended in the forum guidelines (which version of the code are you using, etc., etc,).

This should work but more details are needed to understand why it does not.

Regards,

Yvan

Re: Compile CS with user library

Posted: Fri Jan 11, 2013 5:31 pm
by Meskine
Hello Yvan.

Sorry because I forgot to specify my version. It is the version 2.0.0-rc2

I begin to understand better my problem now

In fact the problem deals with the use of my .mod file during CS compilation.
The first proposition of my last post (CS_LIB_ADD = mylibpath/libname.a) is the good one.

So now, when I edit the runcase as describe upper, I get a compil.log telling me that my .mod can't be find for compiling the routines which use them. In Wondering how CS can be fine all these .mod, I tried to compile all my modules separably in the include file of my CS kernel.

And this leaded to a successful compilation and run !

So my question is : How is it possible for the CS compiler to find .mod files located in my library (composed by .h .mod and .o files) and not to have to place them separately in the include file ?

Thank you for your help

Re: Compile CS with user library

Posted: Fri Jan 11, 2013 6:54 pm
by Yvan Fournier
Hello,

Depending on your compiler, you will have a different option to define a module search path (for example "-I" <path> with gfortran, but check your compiler's manual otherwise).

Adding that to FCFLAGS when configuring the code should do the trick.

Best regards,

Yvan