New material ElasticPPcpp in Linux environment

For developers writing C++, Fortran, Java, code who have questions or comments to make.

Moderators: silvia, selimgunay, Moderators

Post Reply
mkumar3
Posts: 23
Joined: Sat Jun 11, 2011 11:23 am
Location: University at Buffalo

New material ElasticPPcpp in Linux environment

Post by mkumar3 »

Hello,

I am trying to add a new material in a Linux environment. I have already done so on Windows. For the purpose I started with the example in AddingYourCode.pdf.

I have been able to generate the .so file, but the new material ElasticPPcpp is not found by OpenSees. I searched on the forum and found that it might have something to do with LD_LIBRARY_PATH. Frank suggested for that particular problem to issue "echo LD_LIBRARY_PATH=./". I am trying to generate the new material on the linux based computing system at my university. One by one I used following commands for the same in the relevant input file before OpenSees.exe is invoked, besides the one suggested by Frank:

LD_LIBRARY_PATH=/panfs/panfs.ccr.buffalo.edu/scratch/mkumar3_2013.09.13/CCR_Trial/Developer/material/cpp
export LD_LIBRARY_PATH=/panfs/panfs.ccr.buffalo.edu/scratch/mkumar3_2013.09.13/CCR_Trial/Developer/material/cpp
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/panasas/scratch/mkumar3_2013.09.13/CCR_Trial/Developer/material/cpp
export LD_LIBRARY_PATH=/panasas/scratch/mkumar3_2013.09.13/CCR_Trial/Developer/material/cpp

All of them yield similar response:

getLibraryFunction()
libName = ElasticPPcpp
funcName = ElasticPPcpp
Loading dynamic library for Linux OS (ElasticPPcpp.so)
stat() function returned (null)
dlopen() failed
/panasas/scratch/mkumar3_2013.09.13/CCR_Trial/Developer/material/cpp/ElasticPPcpp.so: undefined symbol: _ZN16UniaxialMaterial11setResponseEPPKciR10OPS_Stream
WARNING could not create uniaxialMaterial ElasticPPcpp

Looking at the error, the system manager of the university computing facility suggested that OpenSees is able to recognize the .so file, but there may be some problems with the source files themselves. He asked me if win32functions.cpp file in "core" directory was used in the .so file. If yes, then some changes might need to be made in the file.

Has anyone experienced this problem before or can suggest me a way out?

Thanks,
Manish
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: New material ElasticPPcpp in Linux environment

Post by fmk »

it is loading the dll , so it is not the LD_LIBRARYPATH issue .. the problem is it cannot find the setResponse function for the material .. do you define one in the .h and not implement it in the .cpp?

the win32 functions are not required. they are only needed when using windows dll files on a windows machine.
mkumar3
Posts: 23
Joined: Sat Jun 11, 2011 11:23 am
Location: University at Buffalo

Re: New material ElasticPPcpp in Linux environment

Post by mkumar3 »

Hello Frank,

Thanks for your response. These errors I am getting are for the example in Addingyourcode.pdf file. I have obtained the entire directory along with ElasticPPcpp.cpp and ElasticPPcpp.h files from the svn repository and have not made any changes there. I am trying to run those very files on the computing facility. They did work on my Windows machine.

Here is what the system administrator had responded on the errors.

"OpenSees is able to find the .so file --- so the "export LD_LIBRARY_PATH" is working as it should. However, there are unresolved symbols in the shared library and these are causing the dynamic library commands (dlopen() and dlsym()) to fail.

I think you need to compile and link in the contents of the "core" folder that is referenced in Makefile.def ---- many of the missing symbols are located there. Try adding something like:

buildcore: ../../core/*.cpp
$(CC++) -fPIC $(INCLUDES) -g -c -Wall ../../core/*.cpp

To your Makefile and then issuing "make buildcore". There is a win32Functions.cpp file in the core folder ---- I wonder if the code that you are basing your .so file off of is intended for Windows. If it is you should try to locate a working Linux example instead. If you can't find one you are probably going to have to get into the win32functions.cpp file and make some changes."

I had tried the buildcore command, which generated many .o files, but the final outcome was the same.

Please let me know if you can think of some other source of problem.

Manish
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: New material ElasticPPcpp in Linux environment

Post by fmk »

i have never needed the core files built and linked on a linux system. what operating system are you on and what compilers do you have. i will see if i can start a similar machine on Amazon EC2.
mkumar3
Posts: 23
Joined: Sat Jun 11, 2011 11:23 am
Location: University at Buffalo

Re: New material ElasticPPcpp in Linux environment

Post by mkumar3 »

Hello Frank,

They have the CentOS version 6.4 operating system and gcc 4.3.6 compiler suite. It’s an older version of the compiler that is needed for matlab compatibility.

Thanks,
Manish
Post Reply