blueCFD / Core

Coordination repository for the blueCFD-Core: Issue tracking, Wiki, project webpage and miscellaneous scripts
http://bluecfd.github.io/Core
53 stars 10 forks source link

unable to locate shared object files #180

Closed pjrusello closed 2 years ago

pjrusello commented 3 years ago

I recently installed blueCFD-Core 2020-1 on my Win10 computer. Trying to run any of the OpenFOAM executables generates this type of error:

MINGW64 OpenFOAM-8 ~
$ blockMesh
C:/PROGRA~1/BLUECF~1/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/bin/blockMesh.exe: error while loading shared
 libraries: libPstream.dll: cannot open shared object file: No such file or directory

I did some checks based on Issue #120 and checked to make sure the LD_LIBRARY_PATH environment variable was set correctly (it is, compared against a working blueCFD install on another computer). This didn't show anything wrong from what I could tell.

I've also tried the /x file system mapping/mount point but that didn't work. I'm not sure where the blueCFD install is picking up the Windows style paths since I think it should be referencing it's own psuedo-filesystem?

I do have the openfoam.com Msys2 based distribution installed on this laptop, but there's nothing set system wide the blueCFD version should pick up on from that (at least according to my environment variables). That install seems to be working fine still since running blockMesh generates the expected error when not being run in a case directory.

Any ideas on how to get the path set correctly so the libraries are found and loaded?

pjrusello commented 3 years ago

Here's the output of ldd /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/bin/blockMesh | sort -i:

 ldd /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/bin/blockMesh | sort -i
        ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff94c730000)
        CyMemDef64.dll => /c/Program Files/Cylance/Desktop/CyMemDef64.dll (0x7ff91f850000)
        KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff94c4e0000)
        KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff94ad10000)
        libblockMesh.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libblockMesh.dll (0x67e00000)
        libdynamicMesh.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libdynamicMesh.dll (0x63680000)
        libextrudeModel.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libextrudeModel.dll (0x67840000)
        libfileFormats.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libfileFormats.dll (0x625c0000)
        libfiniteVolume.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libfiniteVolume.dll (0x6c980000)
        libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll (0x61440000)
        libmeshTools.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libmeshTools.dll (0x6a940000)
        libOpenFOAM.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libOpenFOAM.dll (0x6c0c0000)
        libPstream.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/dummy/libPstream.dll (0x69740000)
        libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x6fc40000)
        libtriSurface.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libtriSurface.dll (0x64b40000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x64940000)
        msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff94be50000)
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff94e050000)
        RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff94b570000)
        sechost.dll => /c/Windows/System32/sechost.dll (0x7ff94c7e0000)

It's pointing to the local Msys2 filesystem and seems to be finding libPstream.dll, so I'm not really sure what's happening.

wyldckat commented 3 years ago

Greetings @pjrusello,

Many thanks for also providing the output from ldd! If you look at this line:

libPstream.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/dummy/libPstream.dll (0x69740000)

it has dummy/libPstream.dll near the end of it, when it should be pointing to MS-MPI-7.1/libPstream.dll. Here is the complete output on a working installation:

 ldd /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/bin/blockMesh | sort -i
        ADVAPI32.dll => /c/windows/System32/ADVAPI32.dll (0x7ff918b10000)
        AUTHZ.dll => /c/windows/SYSTEM32/AUTHZ.dll (0x7ff9162d0000)
        DSPARSE.DLL => /c/windows/SYSTEM32/DSPARSE.DLL (0x7ff90dfe0000)
        imagehlp.dll => /c/windows/System32/imagehlp.dll (0x7ff918800000)
        KERNEL32.DLL => /c/windows/System32/KERNEL32.DLL (0x7ff918740000)
        KERNELBASE.dll => /c/windows/System32/KERNELBASE.dll (0x7ff9176e0000)
        libblockMesh.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libblockMesh.dll (0x67e00000)
        libdynamicMesh.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libdynamicMesh.dll (0x63680000)
        libextrudeModel.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libextrudeModel.dll (0x67840000)
        libfileFormats.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libfileFormats.dll (0x625c0000)
        libfiniteVolume.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libfiniteVolume.dll (0x6c980000)
        libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll (0x61440000)
        libiconv-2.dll => /mingw64/bin/libiconv-2.dll (0x66000000)
        libintl-8.dll => /mingw64/bin/libintl-8.dll (0x61cc0000)
        libmeshTools.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libmeshTools.dll (0x6a940000)
        libOpenFOAM.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libOpenFOAM.dll (0x6c0c0000)
        libPstream.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/MS-MPI-7.1/libPstream.dll (0x170000)
        libPstream.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/MS-MPI-7.1/libPstream.dll (0x170000)
        libstack_trace.dll => /home/ofuser/blueCFD/ThirdParty-8/platforms/mingw_w64GccDPInt32/lib/libstack_trace.dll (0x626c0000)
        libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x6fc40000)
        libsurfMesh.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libsurfMesh.dll (0x65540000)
        libsystre-0.dll => /mingw64/bin/libsystre-0.dll (0x6bcc0000)
        libtre-5.dll => /mingw64/bin/libtre-5.dll (0x63bc0000)
        libtriSurface.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libtriSurface.dll (0x64b40000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x64940000)
        msmpi.dll => /c/windows/SYSTEM32/msmpi.dll (0x7ff8ea770000)
        msvcrt.dll => /c/windows/System32/msvcrt.dll (0x7ff918a70000)
        MSWSOCK.dll => /c/windows/SYSTEM32/MSWSOCK.dll (0x7ff916c60000)
        ntdll.dll => /c/windows/SYSTEM32/ntdll.dll (0x7ff919d50000)
        NTDSAPI.dll => /c/windows/SYSTEM32/NTDSAPI.dll (0x7ff8fb390000)
        RPCRT4.dll => /c/windows/System32/RPCRT4.dll (0x7ff918610000)
        sechost.dll => /c/windows/System32/sechost.dll (0x7ff918460000)
        ucrtbase.dll => /c/windows/System32/ucrtbase.dll (0x7ff9179b0000)
        WS2_32.dll => /c/windows/System32/WS2_32.dll (0x7ff918950000)
        zlib1.dll => /mingw64/bin/zlib1.dll (0x62e80000)

If you run this command:

echo $FOAM_MPI

it should show you this:

MS-MPI-7.1

But it's more likely it's showing you dummy instead, which is the default DLL. That said, the expected output when set to dummy is this:

ldd /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/bin/blockMesh | sort -i
        ADVAPI32.dll => /c/windows/System32/ADVAPI32.dll (0x7ff918b10000)
        imagehlp.dll => /c/windows/System32/imagehlp.dll (0x7ff918800000)
        KERNEL32.DLL => /c/windows/System32/KERNEL32.DLL (0x7ff918740000)
        KERNELBASE.dll => /c/windows/System32/KERNELBASE.dll (0x7ff9176e0000)
        libblockMesh.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libblockMesh.dll (0x67e00000)
        libdynamicMesh.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libdynamicMesh.dll (0x63680000)
        libextrudeModel.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libextrudeModel.dll (0x67840000)
        libfileFormats.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libfileFormats.dll (0x625c0000)
        libfiniteVolume.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libfiniteVolume.dll (0x6c980000)
        libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll (0x61440000)
        libiconv-2.dll => /mingw64/bin/libiconv-2.dll (0x66000000)
        libintl-8.dll => /mingw64/bin/libintl-8.dll (0x61cc0000)
        libmeshTools.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libmeshTools.dll (0x6a940000)
        libOpenFOAM.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libOpenFOAM.dll (0x6c0c0000)
        libPstream.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/dummy/libPstream.dll (0x69740000)
        libstack_trace.dll => /home/ofuser/blueCFD/ThirdParty-8/platforms/mingw_w64GccDPInt32/lib/libstack_trace.dll (0x626c0000)
        libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x6fc40000)
        libsurfMesh.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libsurfMesh.dll (0x65540000)
        libsystre-0.dll => /mingw64/bin/libsystre-0.dll (0x6bcc0000)
        libtre-5.dll => /mingw64/bin/libtre-5.dll (0x63bc0000)
        libtriSurface.dll => /home/ofuser/blueCFD/OpenFOAM-8/platforms/mingw_w64GccDPInt32Opt/lib/libtriSurface.dll (0x64b40000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x170000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x64940000)
        msvcrt.dll => /c/windows/System32/msvcrt.dll (0x7ff918a70000)
        ntdll.dll => /c/windows/SYSTEM32/ntdll.dll (0x7ff919d50000)
        RPCRT4.dll => /c/windows/System32/RPCRT4.dll (0x7ff918610000)
        sechost.dll => /c/windows/System32/sechost.dll (0x7ff918460000)
        ucrtbase.dll => /c/windows/System32/ucrtbase.dll (0x7ff9179b0000)
        zlib1.dll => /mingw64/bin/zlib1.dll (0x62e80000)

And with this mode, blockMesh does run without problems.

Let me try and look more closely to your output... I'll make another comment once I've tried to analyze it more closely...

wyldckat commented 3 years ago

OK, looks like the main suspect is the zlib1.dll that is missing from your output. If you run:

which zlib1.dll

If should give you:

/mingw64/bin/zlib1.dll

If it gives you something else, then it's that something else that is tampering with blueCFD-Core's MSys2 installation.

On Windows, the critical environment variable for both executable and library path finding is PATH. LD_LIBRARY_PATH is left in blueCFD-Core as an auxiliary variable, but it's not used by the path finding system in Windows, even though MSys2.

You can check what is in your PATH more easily variable by running this command:

echo $PATH | sed -e 's=:=\n=g'

Best regards, Bruno

pjrusello commented 3 years ago

Thanks for helping to troubleshoot this Bruno.

So which zlib1.dll returns the expected result pointing to /mingw64/bin/zlib1.dll. The other libraries are pointing to dummy because I didn't want to clobber/mess with an existing MS-MPI installation (v10), so I had deselected the MS-MPI install option.

I reinstalled with the MS-MPI v7 option selected and that seems to have fixed the issue with libraries as blockMesh will now run and throw the expected FOAM FATAL ERROR when I run it outside a case directory. I was also able to run a tutorial case (planarCouette) without any errors.

--

My MSys2 path doesn't seem to be picking up my local Windows PATH though. The openfoam.com MSys2 install does pick it up.

E.g. I have the Windows binary of ParaView 5.8 installed and available at C:\Users\prusello\AppData\Local\ParaView-5.8.0-Windows-Python3.7-msvc2015-64bit\bin which is on my Windows PATH, but doesn't show up in my blueCFD MSys2 PATH (in either the non-MPI or MPI installs).

Should the blueCFD MSys2 pick that up or is there a way to prepend/append the Windows path in my .bashrc?

thanks again,

P.J.

wyldckat commented 3 years ago

Hi P.J.,

I'm not sure why installing the MS-MPI v7 component solved the issue, but that's good to know just the same. The blueCFD-Core installer has two specific installation options associated to MS-MPI:

  1. The MS-MPI linking libraries and the MS-MPI toolkit present in blueCFD-Core's installation.
  2. If the first is chosen, then the option to install MS-MPI v7 on Windows is provided, but it's optional.

Either way, MS-MPI's installers do not allow installing an older version of itself, therefore it should not affect your existing MS-MPI v10 installation.

--

Yes, blueCFD-Core contains its PATH variable to paths we regarded as minimally safe, to avoid situations like the zlib1.dll library from another application getting loaded in, that in the past has affected blueCFD-Core's workflow.

The instructions on how to add other applications to blueCFD-Core's path is explained here: http://bluecfd.github.io/Core/FAQ/how-to-install-additional-software-such-as-gmsh/

Best regards, Bruno

pjrusello commented 3 years ago

I'm not sure why that fixed things either, but it worked so I'll take it.

Seems like adding other applications works like I would expect, so I'll test that out to see if I can launch my ParaView v5.8.

thanks again,

P.J.