thliebig / openEMS

openEMS is a free and open-source electromagnetic field solver using the EC-FDTD method.
http://openEMS.de
GNU General Public License v3.0
459 stars 156 forks source link

Fixed HDF5 library path import #110

Closed CGrassin closed 2 months ago

CGrassin commented 1 year ago

As stated in the last comment of issue https://github.com/thliebig/openEMS/issues/36, there is still an issue with the setup.m in Linux when both the serial and openmpi versions of hdf5 are installed. This simple fix applies the same correction that was already done to the hdf5 include path.

Before fix:

>> setup
setting up openEMS matlab/octave interface
compiling oct files
HDF5 library path found at: /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so
/usr/lib/x86_64-linux-gnu/hdf5/serial
HDF5 include path found at: /usr/include/hdf5/serial
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
collect2: error: ld returned 1 exit status
sh: 2: /usr/lib/x86_64-linux-gnu/hdf5/serial: Permission denied
error: mkoctfile: building exited with failure status

After fix:

>> setup
setting up openEMS matlab/octave interface
compiling oct files
HDF5 library path found at: /usr/lib/x86_64-linux-gnu/hdf5/openmpi
HDF5 include path found at: /usr/include/hdf5/serial

Thank you for the great work!

luzpaz commented 1 year ago

is this a valid fix?

thliebig commented 1 year ago

I think that this is not the correct approach. Not saying that the current version is good/better. But the ordering of find is not fixed, thus always using the first entry can be as bad as having multiple files?

I think we need much more logic to first search and then select the correct file?

thliebig commented 2 months ago

I don't think that this is the correct approach. I feel that a more complex approach is needed if any...