mdolab / idwarp

IDWarp is a mesh warping package for the MACH framework.
Other
17 stars 29 forks source link

Error: idwarp was not imported correctly #74

Closed PavelSchor closed 1 year ago

PavelSchor commented 2 years ago

Description

Calling import libidwarp ends with following error:

<python-input-1-9208cb37fd3f> in <module>
----> 1 import libidwarp

ImportError: /home/user/dafoam/repos/idwarp/src/f2py/libidwarp.so: undefined symbol: __cgns_MOD_bctypename

Steps to reproduce issue

  1. follow instructions how to build dafoam from source: https://dafoam.github.io/mydoc_installation_source.html

  2. cd $HOME/dafoam/repos && \ wget https://github.com/mdolab/idwarp/archive/v2.6.0.tar.gz -O idwarp.tar.gz && \ tar -xvf idwarp.tar.gz && cd idwarp-2.6.0 && \ cp -r config/defaults/config.LINUX_GFORTRAN_OPENMPI.mk config/config.mk && \ make && pip install . && \

  3. the make fails with following error: python importTest.py Testing if module libidwarp can be imported... Error: idwarp was not imported correctly make: *** [Makefile:42: all] Error 1

  4. go to ~/dafoam/repos/idwarp-2.6.0/src/f2py

  5. run python and import libidwarp

Current behavior

The build fails on my system

Expected behavior

The build works

Code versions

eirikurj commented 2 years ago

Seems that your cgns library is not found. Make sure the relevant paths in config.mk are valid, and you have LD_LIBRARY_PATH set properly. The docs here might be helpful.

PavelSchor commented 2 years ago

Thanks, now it works

I have recompiled CGNS with:

cmake -D CGNS_ENABLE_FORTRAN=ON -D CMAKE_INSTALL_PREFIX=$CGNS_HOME -D CGNS_ENABLE_64BIT=OFF -D CGNS_BUILD_CGNSTOOLS=OFF -D CMAKE_C_FLAGS="-fPIC" -D CMAKE_Fortran_FLAGS="-fPIC" -D CMAKE_C_COMPILER=mpicc -D CMAKE_Fortran_COMPILER=mpifort .

Also I had to use a static link in src/f2py/Makefile at line 57 $(FF90) -shared $(PYTHON_OBJECTS) $(LINKER_ALL_FLAGS) /home/user/dafoam/packages/CGNS-4.1.2/opt-gfortran/lib/libcgns.a -o libidwarp.so

My issue was that libcgns was without __cgnsMOD symbols

Shall we close this, or forward to daFoam?

eirikurj commented 1 year ago

Closing since you found a solution that works for you. However, CGNS should by default build a shared library, so if compiled correctly everything should be there, so you should not need to bake in the static library. Note that we now support a more recent version that mentioned here. Please open a new issue if there are further problems.