Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

cemeyer
Copy link
Contributor

@cemeyer cemeyer commented Jan 3, 2021

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.)

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)
Copy link
Contributor Author

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.

Copy link
Contributor

@Cyan4973 Cyan4973 Jan 5, 2021

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.

uqs pushed a commit to freebsd/freebsd-src that referenced this pull request Jan 3, 2021
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
Copy link
Contributor

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.

Cyan4973 added a commit that referenced this pull request Jan 6, 2021
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.
@Cyan4973
Copy link
Contributor

Cyan4973 commented Jan 7, 2021

In #2457, there is a proposed PR
which makes possible a zstd CLI linked against libzstd dynamic library.

The proposed method (make zstd-dll) is a bit different from the one suggested here,
that being said it's not settled in the marble, and could be updated for a "better" one if there is such a proposal.

@cemeyer
Copy link
Contributor Author

cemeyer commented Jan 7, 2021

Both proposals work well for me.

@Cyan4973
Copy link
Contributor

Cyan4973 commented Jan 8, 2021

Superseded by #257

@Cyan4973 Cyan4973 closed this Jan 8, 2021
brooksdavis pushed a commit to CTSRD-CHERI/cheribsd that referenced this pull request Oct 15, 2021
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)
brooksdavis pushed a commit to CTSRD-CHERI/cheribsd that referenced this pull request Oct 15, 2021
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)
brooksdavis pushed a commit to CTSRD-CHERI/cheribsd that referenced this pull request Oct 19, 2021
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
brooksdavis pushed a commit to CTSRD-CHERI/cheribsd that referenced this pull request Oct 20, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants