Skip to content

[elfutils] Builds shared libraries when static are requested, vice versa #22051

@csw

Description

@csw

Is your feature request related to a problem? Please describe.
When I build elfutils with vcpkg on Linux, I need a static library, but I get shared libraries only (e.g. libdw.so). All the other libraries I use vcpkg for are static. If I build elfutils from source outside of vcpkg, it builds both static and shared libraries. From looking at the portfile, the problem seems to be that its logic for keeping only the desired type of library is reversed: if VCPKG_LIBRARY_LINKAGE is dynamic, it deletes the shared libraries, and likewise for static.

Proposed solution
Reverse this logic in the portfile (swapping lines 40 and 42) so the requested type of library is built, consistent with other vcpkg libraries.

Describe alternatives you've considered
We could unconditionally build both types of library, to preserve compatibility if someone currently had a dependency on elfutils being dynamically linked even when it should have been a static library. That seems like it would be even more of a departure from expected vcpkg behavior, though.

Additional context

$ ls build/vcpkg_installed/x64-linux/lib
libasm-0.182.so          libaws-cpp-sdk-core.a  libboost_exception.a    libdebuginfod.so.1  libloguru.a
libasm.so                libaws-cpp-sdk-s3.a    libboost_filesystem.a   libdw-0.182.so      liblzma.a
libasm.so.1              libaws-crt-cpp.a       libboost_regex.a        libdw.so            libs2n.a
libaws-c-auth.a          libaws-c-s3.a          libboost_system.a       libdw.so.1          libssl.a
libaws-c-cal.a           libbenchmark.a         libboost_thread.a       libelf-0.182.so     libz.a
libaws-c-common.a        libbenchmark_main.a    libbz2.a                libelf.so           libzstd.a
libaws-c-compression.a   libboost_atomic.a      libcivetweb.a           libelf.so.1         manual-link
libaws-c-event-stream.a  libboost_chrono.a      libcivetweb-cpp.a       libflatbuffers.a    pkgconfig
libaws-checksums.a       libboost_container.a   libcrypto.a             libfmt.a
libaws-c-http.a          libboost_context.a     libcurl.a               libgmock.a
libaws-c-io.a            libboost_coroutine.a   libdebuginfod-0.182.so  libgtest.a
libaws-c-mqtt.a          libboost_date_time.a   libdebuginfod.so        liblmdb.a

Metadata

Metadata

Assignees

Labels

category:port-bugThe issue is with a library, which is something the port should already support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions