CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

custom code compilation error: library linking problem

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By dzi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 10, 2014, 06:16
Default custom code compilation error: library linking problem
  #1
Member
 
nadine moussa
Join Date: Mar 2012
Posts: 30
Rep Power: 11
nadine is on a distinguished road
Hello there,

I developed a new code (porousSolidificationtheta) based on interFoam, and changed the interfaceproperties library of transportModel, so I copied transport Model and relocated in my WM_PROJECT_USER_DIR)/src/ and renamed the library as libmyinterfaceproperties and compiled it after changing th Make/files as follow:
LIB = $(FOAM_USER_LIBBIN)/libmyinterfaceProperties
the library was correctly compiled :

'/home/nadine/OpenFOAM/nadine-2.0.1/platforms/linux64GccDPOpt/lib/libmyinterfaceProperties.so' is up to date.

then in my code (porousSolidificationtheta directory I changed the make/options as follow:
EXE_INC = \
-I$(WM_PROJECT_USER_DIR)/src/transportModels/interfaceProperties/lnInclude \
EXE_LIBS = \
-L$(FOAM_USER_LIBBIN) \
-llibmyinterfaceProperties \

and compiled using wmake, but got this error message:

g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/nadine/OpenFOAM/nadine-2.0.1/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam201/src/transportModels -I/opt/openfoam201/src/transportModels/incompressible/lnInclude -I/opt/openfoam201/src/turbulenceModels/incompressible/turbulenceModel -I/opt/openfoam201/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam201/src/OpenFOAM/lnInclude -I/opt/openfoam201/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed Make/linux64GccDPOpt/porousSolidificationtheta.o -L/opt/openfoam201/platforms/linux64GccDPOpt/lib \
-L/home/nadine/OpenFOAM/nadine-2.0.1/platforms/linux64GccDPOpt/lib -llibmyinterfaceProperties -ltwoPhaseInterfaceProperties -lincompressibleTransportModels -lincompressibleTurbulenceModel -lincompressibleRASModels -lincompressibleLESModels -lfiniteVolume -lOpenFOAM -ldl -lm -o /home/nadine/OpenFOAM/nadine-2.0.1/platforms/linux64GccDPOpt/bin/porousSolidificationtheta
/usr/bin/ld: cannot find -llibmyinterfaceProperties
collect2: ld returned 1 exit status
make: *** [/home/nadine/OpenFOAM/nadine-2.0.1/platforms/linux64GccDPOpt/bin/porousSolidificationtheta] Error 1

I dont get how it doesnt find llibmyinterfaceProperties even though it s compiled correctly?!?

any ideas?!?
thank you all
nadine is offline   Reply With Quote

Old   October 10, 2014, 10:04
Default
  #2
dzi
Member
 
Join Date: Nov 2011
Location: Berlin
Posts: 31
Rep Power: 12
dzi is on a distinguished road
Hi,
just a guess, but maybe the error comes because of final backslash in option file ?
-llibmyinterfaceProperties \
regards dzi
dzi is offline   Reply With Quote

Old   October 10, 2014, 10:10
Default
  #3
Member
 
nadine moussa
Join Date: Mar 2012
Posts: 30
Rep Power: 11
nadine is on a distinguished road
Hello dzi,

I actually wrote what I changed in the options file, the whole file contains the following:

EXE_INC = \
-I$(WM_PROJECT_USER_DIR)/src/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = \
-L$(FOAM_USER_LIBBIN) \
-llibmyinterfaceProperties \
-ltwoPhaseInterfaceProperties \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lfiniteVolume

so the blackslash isnt the problem, but thank you for being intrested in my thread.

Nadine
nadine is offline   Reply With Quote

Old   October 10, 2014, 10:33
Default
  #4
dzi
Member
 
Join Date: Nov 2011
Location: Berlin
Posts: 31
Rep Power: 12
dzi is on a distinguished road
or it is maybe because of lib naming,
what happens if you try :
-lmyinterfaceProperties \
instead of
-llibmyinterfaceProperties
?
songwukong likes this.
dzi is offline   Reply With Quote

Old   October 10, 2014, 10:50
Default
  #5
Member
 
nadine moussa
Join Date: Mar 2012
Posts: 30
Rep Power: 11
nadine is on a distinguished road
hey dzi,

cannot believe it!!! it worked! as simple as that!
just changed the name as u suggested and it worked! I lost 2 days on this!!!

thank you
nadine is offline   Reply With Quote

Old   October 10, 2014, 10:58
Default
  #6
dzi
Member
 
Join Date: Nov 2011
Location: Berlin
Posts: 31
Rep Power: 12
dzi is on a distinguished road
perfect
dzi is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 12:32
code compilation problem with wmake bmikuz OpenFOAM Programming & Development 2 October 17, 2012 10:30
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) Yogini Fluent UDF and Scheme Programming 7 October 3, 2012 08:24
State of the art in CFD technology Juan Carlos GARCIA SALAS Main CFD Forum 39 November 1, 1999 15:34
What kind of Cmmercial CFD code you feel well? Lans Main CFD Forum 13 October 27, 1998 11:20


All times are GMT -4. The time now is 03:58.