Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
I am trying to convert a cmake project from static linking to dynamic linking and I am having some problems with liblzma. The main source expects the target lzma, instead of LibLZMA::LibLZMA, so my cmake code looks like this:
if(USE_SYSTEM_LIBS)
find_package(LibLZMA)
add_library(lzma ALIAS LibLZMA::LibLZMA)
# lzma seems to expect e.g. "#include <lzma/LzmaEnc.h>" but src uses "#include <LzmaEnc.h>" so we need to set the subdirectory explicitly
find_path(lzma_HEADER_DIR PATH_SUFFIXES lzma NAMES lzma12.h)
target_include_directories(LibLZMA::LibLZMA INTERFACE ${lzma_HEADER_DIR})
endif()
All seems well and it compiles but during linking I get:
/usr/bin/ld: ../../dep/libchdr/liblibchdr.a(libchdr_chd.c.o): in function `cdlz_codec_init':
libchdr_chd.c:(.text+0x2bf3): undefined reference to `LzmaEncProps_Init'
/usr/bin/ld: libchdr_chd.c:(.text+0x2c07): undefined reference to `LzmaEncProps_Normalize'
/usr/bin/ld: libchdr_chd.c:(.text+0x2c4a): undefined reference to `LzmaEnc_Create'
/usr/bin/ld: libchdr_chd.c:(.text+0x2c5f): undefined reference to `LzmaEnc_SetProps'
/usr/bin/ld: libchdr_chd.c:(.text+0x2c73): undefined reference to `LzmaEnc_Destroy'
/usr/bin/ld: libchdr_chd.c:(.text+0x2c97): undefined reference to `LzmaEnc_WriteProperties'
/usr/bin/ld: libchdr_chd.c:(.text+0x2ca8): undefined reference to `LzmaEnc_Destroy'
/usr/bin/ld: libchdr_chd.c:(.text+0x2cc2): undefined reference to `LzmaDec_Allocate'
/usr/bin/ld: ../../dep/libchdr/liblibchdr.a(libchdr_chd.c.o): in function `cdlz_codec_free':
libchdr_chd.c:(.text+0x2d9e): undefined reference to `LzmaDec_Free'
/usr/bin/ld: ../../dep/libchdr/liblibchdr.a(libchdr_chd.c.o): in function `cdlz_codec_decompress':
libchdr_chd.c:(.text+0x2e9d): undefined reference to `LzmaDec_Init'
/usr/bin/ld: libchdr_chd.c:(.text+0x2ed2): undefined reference to `LzmaDec_DecodeToBuf'
Using "grep -r 'LzmaEncProps_Init' /usr/include/lzma gives:
Using "objdump -tT /usr/lib/x86_64-linux-gnu/liblzma.so | grep "LzmaEncProps_Init" gives no results.
This is where my confusion is. Am I linking to the wrong library? Why are there .c files in a /usr/include directory? I thought only header files went in there? Am I supposed to link the .c files statically? Whats the .so file for in that case?
I'm sorry if these questions sound dumb. I just don't get it
MultiplexLayout wrote: ↑2022-09-14 16:21
Using "objdump -tT /usr/lib/x86_64-linux-gnu/liblzma.so | grep "LzmaEncProps_Init" gives no results.
Remove the pipeline to 'grep' and see what will happen
... i.e. the Debian implementation of LZMA is based on XZ, which is better and faster (but, zstd is even better )
Regards.
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system." The_full_story and Nothing_have_changed
MultiplexLayout wrote: ↑2022-09-14 16:21
Using "objdump -tT /usr/lib/x86_64-linux-gnu/liblzma.so | grep "LzmaEncProps_Init" gives no results.
Remove the pipeline to 'grep' and see what will happen
... i.e. the Debian implementation of LZMA is based on XZ, which is better and faster (but, zstd is even better )
Regards.
Without grep there is no sign of the symbols that ld says is missing. FWIW here's the output:
MultiplexLayout wrote: ↑2022-09-14 16:21
I am trying to convert a cmake project from static linking to dynamic linking and I am having some problems with liblzma.
What is this project ? Is its source code freely available ?
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀
MultiplexLayout wrote: ↑2022-09-14 16:21
I am trying to convert a cmake project from static linking to dynamic linking and I am having some problems with liblzma.
What is this project ? Is its source code freely available ?