Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows only | ffi-libarchive-binary/libarchive-13.dll': . (LoadError) #118

Closed
CAMOBAP opened this issue Sep 9, 2021 · 6 comments
Closed
Assignees

Comments

@CAMOBAP
Copy link
Contributor

CAMOBAP commented Sep 9, 2021

C:/Users/IEUser/packed-mn/build/ocrC328.tmp/lib/ruby/gems/2.7.0/gems/ffi-1.15.4-x64-mingw32/lib/ffi/library.rb:145:in `block in ffi_lib': Could not open library 'C:/Users/IEUser/packed-mn/build/ocrC328.tmp/lib/ruby/gems/2.7.0/gems/ffi-libarchive-binary-0.2.4-x64-mingw32/lib/ffi-libarchive-binary/libarchive-13.dll': . (LoadError)
Could not open library 'libarchive.so.13': The specified module could not be found.\r
.
Could not open library 'libarchive.so.13.dll': The specified module could not be found.\r
.
Could not open library 'libarchive.13': The specified module could not be found.\r
.
Could not open library 'libarchive.13.dll': The specified module could not be found.\r
.
Could not open library 'libarchive-13': The specified module could not be found.\r
.
Could not open library 'libarchive-13.dll': The specified module could not be found.\r
.
Could not open library 'libarchive.so': The specified module could not be found.\r
.
Could not open library 'libarchive.so.dll': The specified module could not be found.\r
.
Could not open library 'libarchive': The specified module could not be found.\r
.
Could not open library 'libarchive.dll': The specified module could not be found.\r
.
Could not open library 'archive': The specified module could not be found.\r
.
Could not open library 'archive.dll': The specified module could not be found.\r
@CAMOBAP CAMOBAP self-assigned this Sep 9, 2021
@CAMOBAP
Copy link
Contributor Author

CAMOBAP commented Sep 11, 2021

Originally found in https://github.com/metanorma/iso-10303-2/issues/49

Crash related to missing dll dependency (ffi-libarchive->ffi-libarchive-binary->libarchive->libexpat-1). The last one libexpat-1 comes from msys2 this is why it doesn't fail on CI and in my environment initially

What I have done so far:

  1. spent much time to find the root of the issue
  2. checked possibility to build libarchive with static libexpat, there is no such option out of the box
  3. tried to put all dependencies in the same directory as libexpat-1, doesn't work too
  4. now I checking how ocra script will handle metadata["msys2_mingw_dependencies"] in gemfile

@CAMOBAP CAMOBAP changed the title ffi-libarchive-binary/libarchive-13.dll': . (LoadError) Windows only | ffi-libarchive-binary/libarchive-13.dll': . (LoadError) Sep 11, 2021
CAMOBAP added a commit to fontist/ffi-libarchive-binary that referenced this issue Sep 18, 2021
@maxirmx
Copy link
Contributor

maxirmx commented Sep 20, 2021

libarchive is the module that creates pain :)
On Linux its share version looks around to find other shared libraries which can do the real work. For example, if liblzma.so is found then libarchive supports lzma encoding. Static libary is compiled against predefined set of static archive libraries at the time when binary distribution created. This is not necessarily theset of libraries which is present at the system where this script is executed.
.
It looks like Windows version is eevn worse and seeks to replicate build environment even for shared (dll) version. It is possible that it is necessary to use the same pre-set of libraries both for build and distribution.

There is similar problem solved here: https://github.com/mhx/dwarfs/blob/main/CMakeLists.txt . Look for keyword "pain"

@CAMOBAP
Copy link
Contributor Author

CAMOBAP commented Sep 20, 2021

On Linux its share version looks around to find other shared libraries which can do the real work.

As far as I understood it depends on which flags were feeded to ./configure.
if we will pass --without-lzma it will not even try to lookup 'backend' library to do compression.

Static libary is compiled against predefined set of static archive libraries at the time when binary distribution created. This is not necessarily theset of libraries which is present at the system where this script is executed.

Agree this is what we did in fontist/ffi-libarchive-binary#8

It looks like Windows version is eevn worse and seeks to replicate build environment even for shared (dll) version

Yep, I have tried to put those missing DLLs in the same package where libarchive was, but "Windows doesn't like it" and still try to go own way to search places to load those DLLs (

BTW PR is green now so I hope we will not face this issue in future

@CAMOBAP
Copy link
Contributor Author

CAMOBAP commented Sep 20, 2021

@maxirmx maybe you can share your opinion what are downsides of static link, I trying to decide should we do static link only for windows or for all our platforms.

  • Size not much different
  • AFAIK zlib and libexpat present on all Linux distribs because it's very basic libraries

Anything else we should consider?

ronaldtse pushed a commit to fontist/ffi-libarchive-binary that referenced this issue Sep 20, 2021
@CAMOBAP
Copy link
Contributor Author

CAMOBAP commented Sep 20, 2021

Fix verified

@maxirmx
Copy link
Contributor

maxirmx commented Sep 20, 2021

@maxirmx maybe you can share your opinion what are downsides of static link, I trying to decide should we do static link only for windows or for all our platforms.

  • Size not much different
  • AFAIK zlib and libexpat present on all Linux distribs because it's very basic libraries

Anything else we should consider?

IMHO statically linked module is easier to maintain. No other thoughts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants