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

error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined #856

Closed
AbduSharif opened this issue Sep 6, 2023 · 8 comments

Comments

@AbduSharif
Copy link

AbduSharif commented Sep 6, 2023

With NDK 26-rc1, Zlib fails to compile for this:

ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined

Reason was most likely was:
https://reviews.llvm.org/D135402

That means, the error (for now) could be ignored with passing this:

 -Wl,--undefined-version
@davidgraeff
Copy link

A fix for me was to edit the https://github.com/madler/zlib/blob/develop/zlib.map file and remove gz_intmax in line 18

ZLIB_1.2.0 {
  global:
    compressBound;
    deflateBound;
    inflateBack;
    inflateBackEnd;
    inflateBackInit_;
    inflateCopy;
  local:
    deflate_copyright;
    inflate_copyright;
    inflate_fast;
    inflate_table;
    zcalloc;
    zcfree;
    z_errmsg;
    gz_error;
-    gz_intmax;
    _*;
};

mbautin added a commit to mbautin/zlib that referenced this issue Sep 25, 2023
@emmenlau
Copy link

emmenlau commented Oct 5, 2023

Same issue when building latest zlib with LLVM clang 17.0.2 on Ubuntu 22.04 x86_64. The exact error from clang is:

ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined                                                                                                  
clang: error: linker command failed with exit code 1 (use -v to see invocation)              

@emmenlau
Copy link

emmenlau commented Oct 5, 2023

The workaround suggested in the upstream issue is to add -Wl,--undefined-version to the linker flags. I have added this to LDFLAGS before calling cmake and the build now works.

I think the problem here with zlib is that the symbol gz_intmax should be conditionally enabled. It depends on the definition of INT_MAX. But the map-file unconditionally asks the linker to provide it, which seems wrong. However I'm not sure what a better solution would be...

@speedym
Copy link
Contributor

speedym commented Oct 13, 2023

Note that I have, a few days ago, posted a proposal for a proper fix for this issue.

@Neustradamus
Copy link

@madler: Can you look this ticket?

fuzzard pushed a commit to fuzzard/xbmc that referenced this issue Dec 24, 2023
Patch proposed upstream to fix the following issue
  ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Upstream issue: madler/zlib#856
Upstream patch: madler/zlib#865
fuzzard pushed a commit to fuzzard/xbmc that referenced this issue Dec 24, 2023
Patch proposed upstream to fix the following issue
  ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Upstream issue: madler/zlib#856
Upstream patch: madler/zlib#865
fuzzard pushed a commit to fuzzard/xbmc that referenced this issue Dec 24, 2023
Patch proposed upstream to fix the following issue
  ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Upstream issue: madler/zlib#856
Upstream patch: madler/zlib#865
fuzzard pushed a commit to fuzzard/xbmc that referenced this issue Dec 24, 2023
Patch proposed upstream to fix the following issue
  ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Upstream issue: madler/zlib#856
Upstream patch: madler/zlib#865
heitbaum pushed a commit to heitbaum/xbmc that referenced this issue Dec 28, 2023
Patch proposed upstream to fix the following issue
  ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Upstream issue: madler/zlib#856
Upstream patch: madler/zlib#865
@Neustradamus
Copy link

@madler: Can you look this ticket?

@madler
Copy link
Owner

madler commented Jan 22, 2024

gz_intmax() is now always there.

@madler madler closed this as completed Jan 22, 2024
@Neustradamus
Copy link

Merged commit:

robUx4 added a commit to robUx4/zlib that referenced this issue Apr 15, 2024
According to the documentation [1] it's only useful for shared libraries.
With recent Android NDK this leads to linking issues with gz_intmax similar to madler#856.
In autotools it's only set with LDSHARED.

[1]https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_chapter/ld_3.html
AdamFelt pushed a commit to autodesk-forks/USD that referenced this issue Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants