-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
make: Add ZSTD_PROGRAMS_LINK_SHARED to dll-link zstd #2450
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.
@@ -1198,6 +1198,9 @@ size_t ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSe | |||
|
|||
/** ZSTD_cycleLog() : | |||
* condition for correct operation : hashLog > 1 */ | |||
#if defined(ZSTD_PROGRAMS_LINK_SHARED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -968,6 +968,9 @@ static size_t ZDICT_addEntropyTablesFromBuffer_advanced( | |||
} | |||
|
|||
/* Hidden declaration for dbio.c */ | |||
#if defined(ZSTD_PROGRAMS_LINK_SHARED) | |||
ZSTDLIB_API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.)