make: Add ZSTD_PROGRAMS_LINK_SHARED to dll-link zstd#2450
make: Add ZSTD_PROGRAMS_LINK_SHARED to dll-link zstd#2450cemeyer wants to merge 1 commit intofacebook:devfrom
Conversation
Add a make variable ZSTD_PROGRAMS_LINK_SHARED. When set, libzstd exports private symbols needed to shared-link the zstd program. zstd is linked against this libzstd.so.
|
|
||
| /** ZSTD_cycleLog() : | ||
| * condition for correct operation : hashLog > 1 */ | ||
| #if defined(ZSTD_PROGRAMS_LINK_SHARED) |
There was a problem hiding this comment.
This could instead be some conditionally-defined ZSTDLIB_CLI_DLL_API (or whatever) in lib/zstd.h. I don't feel strongly about it; the number of instances needed will probably remain very small.
There was a problem hiding this comment.
We could probably remove ZSTD_cycleLog() dependency. It's a trivial code to copy.
Fix non-FreeBSD CI build after v1.4.8. This definition was only used in zstd(1), which isn't part of non-FreeBSD CI (I guess). The ifdef was added in v1.4.5 import. Upstream does not currently support shared-linked zstd(1), but I have proposed facebook/zstd#2450 . If that is adopted, we can add -DZSTD_PROGRAMS_LINK_SHARED to our libzstd build and drop some diffs. Reported by: uqs
|
|
||
| /* Hidden declaration for dbio.c */ | ||
| #if defined(ZSTD_PROGRAMS_LINK_SHARED) | ||
| ZSTDLIB_API |
There was a problem hiding this comment.
Here, we could make ZDICT_trainFromBuffer_unsafe_legacy() function part of the "unstable"/"experimental" section of zdict API.
Another alternative is to not use it in dibio.c and use the safe variant instead.
It comes at an additional memory allocation cost, but might be worth it to remove this dependency.
ZSTD_cycleLog() is a very short function, creating a rather large dependency onto libzstd's internal just for it is overkill. Prefer duplicating this 2-lines function. This PR makes the zstd CLI one step closer to being linkable to the dynamic library (see #2450) More steps are still needed to reach this goal.
|
In #2457, there is a proposed PR The proposed method ( |
|
Both proposals work well for me. |
|
Superseded by #257 |
Fix non-FreeBSD CI build after v1.4.8. This definition was only used in zstd(1), which isn't part of non-FreeBSD CI (I guess). The ifdef was added in v1.4.5 import. Upstream does not currently support shared-linked zstd(1), but I have proposed facebook/zstd#2450 . If that is adopted, we can add -DZSTD_PROGRAMS_LINK_SHARED to our libzstd build and drop some diffs. Reported by: uqs (cherry picked from commit bcae12b)
Fix non-FreeBSD CI build after v1.4.8. This definition was only used in zstd(1), which isn't part of non-FreeBSD CI (I guess). The ifdef was added in v1.4.5 import. Upstream does not currently support shared-linked zstd(1), but I have proposed facebook/zstd#2450 . If that is adopted, we can add -DZSTD_PROGRAMS_LINK_SHARED to our libzstd build and drop some diffs. Reported by: uqs (cherry picked from commit bcae12b)
Fix non-FreeBSD CI build after v1.4.8. This definition was only used in zstd(1), which isn't part of non-FreeBSD CI (I guess). The ifdef was added in v1.4.5 import. Upstream does not currently support shared-linked zstd(1), but I have proposed facebook/zstd#2450 . If that is adopted, we can add -DZSTD_PROGRAMS_LINK_SHARED to our libzstd build and drop some diffs. Reported by: uqs
Fix non-FreeBSD CI build after v1.4.8. This definition was only used in zstd(1), which isn't part of non-FreeBSD CI (I guess). The ifdef was added in v1.4.5 import. Upstream does not currently support shared-linked zstd(1), but I have proposed facebook/zstd#2450 . If that is adopted, we can add -DZSTD_PROGRAMS_LINK_SHARED to our libzstd build and drop some diffs. Reported by: uqs
Add a make variable ZSTD_PROGRAMS_LINK_SHARED. When set, libzstd
exports private symbols needed to shared-link the zstd program. zstd is
linked against this libzstd.so.
(See issues #2261, #1680.)