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

Impossible to link against xcode applications #96

Open
Yuri6037 opened this issue May 25, 2022 · 3 comments
Open

Impossible to link against xcode applications #96

Yuri6037 opened this issue May 25, 2022 · 3 comments

Comments

@Yuri6037
Copy link

You've managed to break swift applications using lama-sys from rust: software now refuses to link with a lot of "undefined symbols"! Adding lzma.tbd does not work and result in "Undefined symbol: _lzma_stream_encoder_mt"!

@morganava
Copy link

I'm also hitting this when attempting to link a static lib which uses xz2 into a C library, but weirdly only on x86_64 macOS (in a macos-13 github runner), aarch64 macos-14 github runner links just fine 🤷‍♀️ :

ld: Undefined symbols:
  _lzma_stream_encoder_mt, referenced from:
      xz2::stream::MtStreamBuilder::encoder::h186d9c8edc781480 in libcgosling_impl.a[740](xz2-796297a2c5450176.xz2.bf31a726fbf3beda-cgu.0.rcgu.o)
  _lzma_stream_encoder_mt_memusage, referenced from:
      xz2::stream::MtStreamBuilder::memusage::h179f0f5c504931d2 in libcgosling_impl.a[740](xz2-796297a2c5450176.xz2.bf31a726fbf3beda-cgu.0.rcgu.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

liblzma.tbd:

--- !tapi-tbd
tbd-version:     4
targets:         [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 
                   arm64e-macos, arm64e-maccatalyst ]
install-name:    '/usr/lib/liblzma.5.dylib'
current-version: 6.3
compatibility-version: 6
exports:
  - targets:         [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 
                       arm64e-macos, arm64e-maccatalyst ]
    symbols:         [ _lzma_alone_decoder, _lzma_alone_encoder, _lzma_auto_decoder, 
                       _lzma_block_buffer_bound, _lzma_block_buffer_decode, _lzma_block_buffer_encode, 
                       _lzma_block_compressed_size, _lzma_block_decoder, _lzma_block_encoder, 
                       _lzma_block_header_decode, _lzma_block_header_encode, _lzma_block_header_size, 
                       _lzma_block_total_size, _lzma_block_unpadded_size, _lzma_check_is_supported, 
                       _lzma_check_size, _lzma_code, _lzma_crc32, _lzma_crc64, _lzma_easy_buffer_encode, 
                       _lzma_easy_decoder_memusage, _lzma_easy_encoder, _lzma_easy_encoder_memusage, 
                       _lzma_end, _lzma_filter_decoder_is_supported, _lzma_filter_encoder_is_supported, 
                       _lzma_filter_flags_decode, _lzma_filter_flags_encode, _lzma_filter_flags_size, 
                       _lzma_filters_copy, _lzma_filters_update, _lzma_get_check, 
                       _lzma_index_append, _lzma_index_block_count, _lzma_index_buffer_decode, 
                       _lzma_index_buffer_encode, _lzma_index_cat, _lzma_index_checks, 
                       _lzma_index_decoder, _lzma_index_dup, _lzma_index_encoder, 
                       _lzma_index_end, _lzma_index_file_size, _lzma_index_hash_append, 
                       _lzma_index_hash_decode, _lzma_index_hash_end, _lzma_index_hash_init, 
                       _lzma_index_hash_size, _lzma_index_init, _lzma_index_iter_init, 
                       _lzma_index_iter_locate, _lzma_index_iter_next, _lzma_index_iter_rewind, 
                       _lzma_index_memusage, _lzma_index_memused, _lzma_index_size, 
                       _lzma_index_stream_count, _lzma_index_stream_flags, _lzma_index_stream_padding, 
                       _lzma_index_stream_size, _lzma_index_total_size, _lzma_index_uncompressed_size, 
                       _lzma_lzma_preset, _lzma_memlimit_get, _lzma_memlimit_set, 
                       _lzma_memusage, _lzma_mf_is_supported, _lzma_mode_is_supported, 
                       _lzma_physmem, _lzma_properties_decode, _lzma_properties_encode, 
                       _lzma_properties_size, _lzma_raw_buffer_decode, _lzma_raw_buffer_encode, 
                       _lzma_raw_decoder, _lzma_raw_decoder_memusage, _lzma_raw_encoder, 
                       _lzma_raw_encoder_memusage, _lzma_stream_buffer_bound, _lzma_stream_buffer_decode, 
                       _lzma_stream_buffer_encode, _lzma_stream_decoder, _lzma_stream_encoder, 
                       _lzma_stream_flags_compare, _lzma_stream_footer_decode, _lzma_stream_footer_encode, 
                       _lzma_stream_header_decode, _lzma_stream_header_encode, _lzma_version_number, 
                       _lzma_version_string, _lzma_vli_decode, _lzma_vli_encode, 
                       _lzma_vli_size ]

@morganava
Copy link

Full logs attempting to build gosling:

liblzma-logs.txt

@morganava
Copy link

morganava commented Oct 7, 2024

FWIW this works fine if you link against homebrew's version of liblzma. If I had to guess, this is a problem with Apple's liblzma tbd file (on macOS framework <= 13.0 at least).

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

2 participants