-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Installing a package as a static library for Linux/mac target should not require patchelf to be installed #40032
Comments
For extra reference, here is my toolchain file: C:/path/to/toolchain/arm32-linux.cmake:
and my triplets file is
When I exclude .a files from patching, the install succeeds, and I see my lib.a in vcpkg_installed/arm32-linux/lib |
It is a little bit more complicated.
OTOH there is a direct switch if you don't want to deal with patchelf. Add set(VCPKG_FIXUP_ELF_RPATH OFF) to your custom triplet file. |
When a port builds a dynamic library, does it typically set the extension as so, dylib, dll, etc. for the platform? Can we assume that the .a extension says it's a static library (and can be excluded)? I'll take a look at the switch, either way, since it should fix my issue and allow me to still use main on this repo. |
Excluding |
Describe the bug
The current regex for excluding files does not exclude static libraries (.a files). Static libraries cannot have an rpath, and they will be rejected by patchelf since they don't start with the ELF header. Therefore, static libraries should be excluded.
This issue arose while cross-building a custom package from Windows to Linux, using a custom triplet to set the GCC compiler path. To avoid requiring patchelf on the developer's system, it's necessary to exclude static libraries. Since only a static binary is being built, patchelf isn't needed.
Currently,
z_vcpkg_fixup_rpath_in_dir
is always called when building for Linux, which mandates the use of patchelf even for static builds.Environment
Expected behavior
A clear and concise description of what you expected to happen.
I would expect that .a files will not require patchelf to run, since static libraries don't have a rpath
Failure logs
-(please attached failure logs)
Additional context
Add any other context about the problem here.
I confirmed locally that changing
list(FILTER elf_files EXCLUDE REGEX "\\\.(cpp|cc|cxx|c|hpp|h|hh|hxx|inc|json|toml|yaml|man|m4|ac|am|in|log|txt|pyi?|pyc|pyx|pxd|pc|cmake|f77|f90|f03|fi|f|cu|mod|ini|whl|cat|csv|rst|md|npy|npz|template|build)$")
to
list(FILTER elf_files EXCLUDE REGEX "\\\.(a|cpp|cc|cxx|c|hpp|h|hh|hxx|inc|json|toml|yaml|man|m4|ac|am|in|log|txt|pyi?|pyc|pyx|pxd|pc|cmake|f77|f90|f03|fi|f|cu|mod|ini|whl|cat|csv|rst|md|npy|npz|template|build)$")
resolves my issue.
The text was updated successfully, but these errors were encountered: