Linking to static library containing duplicate filename fails #2142
|
I worry about replacing llvm-ar with a from-scratch script, and this seems like a corner case, so the risk is high for little gain. Perhaps the best solution is to fix this upstream in llvm-ar by adding support for that GNU ar option? |
|
I pushed a commit to add hashing to each object in This will break people that expect to be able to read the objects themselves. We'll see if this is a problem on incoming. If it is, we might need to put it behind a flag. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When emcc links to a static library, it first runs
LLVM_AR x fto extract the objects to a temporary directory (in tools/shared.py:link). If the archive contains a duplicate filename, it will be overwritten during the extraction process and linking will fail due to missing symbols in the file(s) that were destroyed.GNU ar seems have a specific option to get around this,
ar xN count archive filename, though it doesn't seem that llvm-ar has the same feature. To work around the issue personally I've replaced LLVM_AR with the following replacement extractor, which simply extracts an archive while ignoring the original filenames:https://gist.github.com/AerialX/5f6763559769bf9c30e6
I'm not sure of the best approach for emscripten to take, but is it possible for this to be somehow fixed?