CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   error libswakPythonIntegration (http://www.cfd-online.com/Forums/openfoam-solving/115377-error-libswakpythonintegration.html)

eelcovv March 29, 2013 08:22

error libswakPythonIntegration
 
Hi All,

I just installed OF 2.2.0 and the latest swak4foam version from the tar ball
Swak4Foam_2.x_release_0.2.3

Compilation went like a charm, and swak4foam seems to ok except for one issue: when using the libswakPythonIntegration.so library I got an message

Code:

--> FOAM Warning :
    From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : /home/eelco/OpenFOAM/eelco-2.2.x/platforms/linux64GccDPOpt/lib/libswakPythonIntegration.so: undefined symbol: PyFunction_Type
--> FOAM Warning :
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
    could not load "libswakPythonIntegration.so"

At the start of the run. PyFoam was installed as well and
I have set the environment variables


Code:

export SWAK4FOAM_SRC="$WM_PROJECT_SITE_DIR/swak4foam/Swak4Foam_2.x_release_0.2.3/Libraries"
export SWAK_PYTHON_INCLUDE="-I/usr/include/python2.7"
export SWAK_PYTHON_LINK="-L/usr/lib/python2.7 -lpython2.7

Also, python 2.7 is correctly installed.

Any idea what could be wrong?

Any hints appreciated!

Regards
Eelco

gschaider April 5, 2013 13:59

Quote:

Originally Posted by eelcovv (Post 417174)
Hi All,

I just installed OF 2.2.0 and the latest swak4foam version from the tar ball
Swak4Foam_2.x_release_0.2.3

Compilation went like a charm, and swak4foam seems to ok except for one issue: when using the libswakPythonIntegration.so library I got an message

Code:

--> FOAM Warning :
    From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : /home/eelco/OpenFOAM/eelco-2.2.x/platforms/linux64GccDPOpt/lib/libswakPythonIntegration.so: undefined symbol: PyFunction_Type
--> FOAM Warning :
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
    could not load "libswakPythonIntegration.so"

At the start of the run. PyFoam was installed as well and
I have set the environment variables


Code:

export SWAK4FOAM_SRC="$WM_PROJECT_SITE_DIR/swak4foam/Swak4Foam_2.x_release_0.2.3/Libraries"
export SWAK_PYTHON_INCLUDE="-I/usr/include/python2.7"
export SWAK_PYTHON_LINK="-L/usr/lib/python2.7 -lpython2.7

Also, python 2.7 is correctly installed.

Any idea what could be wrong?

Any hints appreciated!

Regards
Eelco

No idea. Probably ANOTHER library is needed. Could you let me know which linux-distro you're using (I remember that dynamic linker in recent distros does less automatic loading)

One more thing: is you system 64 bit and maybe you want to link to "/usr/lib64/python2.7" (but your milage may vary).

Another possibility. Do

grep PyFunction_Type /usr/lib/python2.7/*.so

and if additional libraries pop up try adding them to SWAK_PYTHON_LINK

MB2 April 19, 2013 11:36

Link swak4foam 0.2.3
 
The links on http://openfoamwiki.net/index.php/Co...am#Downloading do not work at the moment.
Can you post a link for swak4foam 0.2.3 (for OF 2.2.0) ?

gschaider April 19, 2013 15:17

Quote:

Originally Posted by MB2 (Post 421771)
The links on http://openfoamwiki.net/index.php/Co...am#Downloading do not work at the moment.
Can you post a link for swak4foam 0.2.3 (for OF 2.2.0) ?

If you had spent just 20 seconds to read the rest of the paragraph you might have spotted the lines "temporary download" with the links you spent 23 seconds asking for in your post. Would have saved you 3 seconds of your lifetime and the embarrassment.

Sorry for being sarcastic, but people keep asking for this on almost a daily basis when the solution is looking straight in their eye

jherb September 11, 2013 18:16

I got the same error if I forgot to add -lpython2.7 (or actually -lpython2.6 in my case) to SWAK_PYTHON_LINK. But I guess you can drop the -L/usr/lib/python2.7 because the libpython2.7.so.* files are stored in /usr/lib (or /usr/lib on a 64bit machine) which is used automatically.


Quote:

Originally Posted by eelcovv (Post 417174)
Hi All,
Code:

--> FOAM Warning :
    From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : /home/eelco/OpenFOAM/eelco-2.2.x/platforms/linux64GccDPOpt/lib/libswakPythonIntegration.so: undefined symbol: PyFunction_Type
--> FOAM Warning :
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
    could not load "libswakPythonIntegration.so"

At the start of the run. PyFoam was installed as well and
I have set the environment variables


Code:

export SWAK4FOAM_SRC="$WM_PROJECT_SITE_DIR/swak4foam/Swak4Foam_2.x_release_0.2.3/Libraries"
export SWAK_PYTHON_INCLUDE="-I/usr/include/python2.7"
export SWAK_PYTHON_LINK="-L/usr/lib/python2.7 -lpython2.7



aerogt3 October 20, 2013 07:18

Code:

--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libsimpleSwakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libsimpleSwakFunctionObjects.so"
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libswakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libswakFunctionObjects.so"
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libswakPythonIntegration.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libswakPythonIntegration.so"

I have the same issue, I get the above errors despite everything compiling correctly. Questions:

1.) these files are actually in /root/OpenFOAM/root-2.2.x. Is there a way to control where they are placed? I would like to have everything together in /usr/local/OpenFOAM

2.) How can I get openfoam to see the .so files? I believe I have the environment variables from the first post correctly set...

Code:

$SWAK_PYTHON_LINK
bash: /usr/lib/python2.7: Is a directory
$SWAK_PYTHON_INCLUDE
bash: /usr/include/python2.7: Is a directory
$SWAK4FOAM_SRC
bash: /usr/local/OpenFOAM/swak4Foam_2.x/Libraries: Is a directory

SWAK4FOAM_SRC is set manually like this: export SWAK4FOAM_SRC="/usr/local/OpenFOAM/swak4Foam_2.x/Libraries"

I don't even know if that's correct, but I tried using the following line from the first post, but $WM_PROJECT_SITE_DIR does not exist, and I don't see it defined in OpenFOAM/etc/bash_rc or anywhere else.

Code:

export SWAK4FOAM_SRC="$WM_PROJECT_SITE_DIR/swak4foam/Swak4Foam_2.x_release_0.2.3/Libraries"

gschaider October 20, 2013 07:39

Quote:

Originally Posted by aerogt3 (Post 457897)
Code:

--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libsimpleSwakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libsimpleSwakFunctionObjects.so"
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libswakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libswakFunctionObjects.so"
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libswakPythonIntegration.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libswakPythonIntegration.so"

I have the same issue, I get the above errors despite everything compiling correctly. Questions:

The Python-integration doesn't compile if the environment variables are not set. There is a mention of this during the compilation
Quote:

Originally Posted by aerogt3 (Post 457897)
1.) these files are actually in /root/OpenFOAM/root-2.2.x. Is there a way to control where they are placed? I would like to have everything together in /usr/local/OpenFOAM

There are but I don't endorse them as they may lead to subtle problems (they are mentioned in the documentation. I don't point out where on purpose because people not finding them should take this a sign that this isn't for them. I have no intention in leading people into a "DLL-hell" that causes more questions on the message board). Anyway. Compiling swak as root is not recommended

Quote:

Originally Posted by aerogt3 (Post 457897)
2.) How can I get openfoam to see the .so files? I believe I have the environment variables from the first post correctly set...

Code:

$SWAK_PYTHON_LINK
bash: /usr/lib/python2.7: Is a directory
$SWAK_PYTHON_INCLUDE
bash: /usr/include/python2.7: Is a directory
$SWAK4FOAM_SRC
bash: /usr/local/OpenFOAM/swak4Foam_2.x/Libraries: Is a directory


Add an "echo" before it and you get the real values of the variables
Quote:

Originally Posted by aerogt3 (Post 457897)
SWAK4FOAM_SRC is set manually like this: export SWAK4FOAM_SRC="/usr/local/OpenFOAM/swak4Foam_2.x/Libraries"

I don't even know if that's correct, but I tried using the following line from the first post, but $WM_PROJECT_SITE_DIR does not exist, and I don't see it defined in OpenFOAM/etc/bash_rc or anywhere else.

Code:

export SWAK4FOAM_SRC="$WM_PROJECT_SITE_DIR/swak4foam/Swak4Foam_2.x_release_0.2.3/Libraries"

SWAK4FOAM_SRC is not needed for the python-integration. It's good to set it but not necessary

Start from the beginning: create a swakConfiguration file that reflects your setup (from the examples in the sources). Recompile swak as yourself (not root) and the python-integration should work

aerogt3 October 24, 2013 06:06

Quote:

Originally Posted by gschaider (Post 457901)
There are but I don't endorse them as they may lead to subtle problems (they are mentioned in the documentation. I don't point out where on purpose because people not finding them should take this a sign that this isn't for them. I have no intention in leading people into a "DLL-hell" that causes more questions on the message board). Anyway. Compiling swak as root is not recommended

Well, the reasoning was that if the files are places in the compiling users' home, the installation becomes user specific. I usually like to install software in common locations to avoid this, but if it causes problems to move files around I'll leave it as is.

gschaider October 24, 2013 06:49

Quote:

Originally Posted by aerogt3 (Post 458739)
Well, the reasoning was that if the files are places in the compiling users' home, the installation becomes user specific. I usually like to install software in common locations to avoid this, but if it causes problems to move files around I'll leave it as is.

The thing is that as soon as people start compiling their own copy of swak because "I need this feature from the development version" they might experience problems (because they might get libraries from different swak-versions). But if you're sure that people will not do this look into the maintainanceScripts (but you've been warned)


All times are GMT -4. The time now is 20:46.