genotrance / nimarchive

libarchive wrapper for Nim
MIT License
17 stars 3 forks source link

Dynamic linking #5

Open SolitudeSF opened 4 years ago

SolitudeSF commented 4 years ago

Can this be linked dynamically?

genotrance commented 4 years ago

I haven't enabled it since there were some issues building the .so file. You can try enabling it by removing archiveStatic and all xxxStd lines from here - https://github.com/genotrance/nimarchive/blob/master/nimarchive/archive.nim#L11. Have to remove standard .a files since they aren't built with -fPIC which is required for the .so. Have to build dependencies from scratch.

Also, need to remove this multi-replace: https://github.com/genotrance/nimarchive/blob/master/nimarchive/archive.nim#L74 which disables building the .so.

SolitudeSF commented 4 years ago

tried that and it built fine choosenim built fine. would be nice to have that as a switch.

also, why would i need building .so for that?

genotrance commented 4 years ago

Actually, the easiest way to do this is to install libarchive with your package manager, remove all instances of xxxStatic and add archiveStd.

I agree this should be an option for nimarchive and it shouldn't be hard-coded. However, covering every scenario is not trivial.

SolitudeSF commented 4 years ago

well, doesn't look like its more complex than simple when

timotheecour commented 4 years ago

the fact that static linking is used may be causing this https://github.com/dom96/choosenim/issues/122 see https://github.com/dom96/choosenim/issues/122#issuecomment-576043187

dyld: lazy symbol binding failed: Symbol not found: _futimens

/Users/travis/build/dom96/choosenim/src/choosenimpkg/utils.nim(47) extract /Users/travis/.nimble/pkgs/nimarchive-0.3.5/nimarchive.nim(84) extract SIGABRT: Abnormal termination.