[cmake] [macOS] building the shared library does not set `install_name`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c, cmake
- Domain
- build-system
Research direction
Start by comparing the CMake shared library configuration with the macOS install name settings in lib/Makefile (the issue links to lines 78–83). Reproduce the discrepancy with the provided CMake build and install steps, then use otool -D to check the library ID. Done when the CMake-built library has the expected install name behavior on macOS.
Written by the indexing model from the issue text.
Description
Description
[!NOTE]
This issue applies only to macOS.
When building libzstd shared lib with GNU Make, by default, it sets the install_name for the lib as seen at
https://github.com/meta/zstd/blob/98e7b6ac7a08d9cea44aa7b0f6328e064259e625/lib/Makefile#L78-L83
On the other hand, building libzstd shared lib with CMake, it does not.
Expected behavior
Since make is the main build system for libzstd, CMake should also follow the behavior and set the install_name for the shared lib as well.
Reproduction
-
Clone the repository:
git clone https://github.com/meta/zstd -
Change directory to
zstddir:cd zstd -
Build:
make PREFIX=/opt/libzstd-make -
Install:
sudo make PREFIX=/opt/libzstd-make install -
Print the
install_nameid:otool -D /opt/libzstd-make/lib/libzstd.1.6.0.dylib -
Configure with CMake:
cmake \ -DCMAKE_BUILD_TYPE=Release \ --install-prefix /opt/libzstd-cmake \ -S . \ -B /tmp/build-libzstd -
Build with CMake:
cmake --build /tmp/build-libzstd --config Release -
Install with CMake:
sudo cmake --install /tmp/build-libzstd --config Release -
Print the
install_nameid:otool -D /opt/libzstd-cmake/lib/libzstd.1.6.0.dylib -
Check the output of step (5.) is
/opt/libzstd-make/lib/libzstd.1.dylibwhile the output of step (9.) is@rpath/libzstd.1.dylib
[!TIP]
In case there is interest, I already fixed it locally and I can submit a PR for the fix.
- Dominant language
- C
- Stars
- 28.1k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from facebook/zstd
-
ZSTD_decompressStream accepts a Compressed_Block with Block_Size 0 that ZSTD_decompress rejectsPossibly taken @Artyx71 claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
-
One-shot decoding refuses some skippable framesPossibly taken @ceedot-rock claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
`ZSTD_getDictID_fromFrame` returns a skippable frame's magic variant as its dictionary IDPossibly taken @b84330808 claimed this 13 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
cover.c does not build on OpenHarmony: qsort_r is exported but not declared (musl)Possibly taken @bfs2021 claimed this 14 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
openziti/ziti-sdk-c#1254 ·
Maintainers usually reply within 1 day
-
http_fetch tests: the two no-child rows fail, not skip, where a task's children file does not existPossibly taken A pull request linked to this issue is open or already merged. Openarea:http kind:gate-defect
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
InauguralSystems/EigenScript#2397 ·
Maintainers usually reply within 1 day
-
Add SECURITY.mdOpenenhancement
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
modem: ppp: CMUX DLCI receive buffer overruns on large downlink packetsPossibly taken @pedrohqr claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
zephyrproject-rtos/zephyr#126195 ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
ly05010419/MacNativeGames#2271 ·
Maintainers usually reply within 1 day