Compile CS with user library

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Meskine
Posts: 26
Joined: Thu Jul 19, 2012 1:56 pm

Compile CS with user library

Post 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
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Compile CS with user library

Post 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
Meskine
Posts: 26
Joined: Thu Jul 19, 2012 1:56 pm

Re: Compile CS with user library

Post 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
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Compile CS with user library

Post 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
Post Reply