[GH-ISSUE #410] undefined reference to symbol 'deflate' , when I cross compile #324

Closed
opened 2026-05-05 12:09:08 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @justdomyself on GitHub (Sep 18, 2023).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/410

Originally assigned to: @jmcnamara on GitHub.

I mv .a flie to my project, and crsoss compile my project, errors happend.

the full error messge below :

/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.3.0/real-ld: libs/arm32/lib/libxlsxwriter.a(zip.c.o): undefined reference to symbol 'deflate'
/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi/lib/libz.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/mqt.dir/build.make:346: mqt] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/mqt.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
make failed???
Originally created by @justdomyself on GitHub (Sep 18, 2023). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/410 Originally assigned to: @jmcnamara on GitHub. I mv .a flie to my project, and crsoss compile my project, errors happend. the full error messge below : ``` /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.3.0/real-ld: libs/arm32/lib/libxlsxwriter.a(zip.c.o): undefined reference to symbol 'deflate' /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi/lib/libz.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/mqt.dir/build.make:346: mqt] Error 1 make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/mqt.dir/all] Error 2 make: *** [Makefile:84: all] Error 2 make failed??? ```
gitea-mirror 2026-05-05 12:09:08 -06:00
Author
Owner

@justdomyself commented on GitHub (Sep 18, 2023):

the zlib is in my compiler, but it still has errors?

<!-- gh-comment-id:1722722079 --> @justdomyself commented on GitHub (Sep 18, 2023): the zlib is in my compiler, but it still has errors?
Author
Owner

@jmcnamara commented on GitHub (Sep 18, 2023):

You probably need to add the zlib library to your link commands with -lz or the equivalent in your Cmake file. See the following:

https://stackoverflow.com/questions/22337896/how-to-fix-undefined-references-to-inflate-deflate-functions

<!-- gh-comment-id:1722935357 --> @jmcnamara commented on GitHub (Sep 18, 2023): You probably need to add the zlib library to your link commands with `-lz` or the equivalent in your Cmake file. See the following: https://stackoverflow.com/questions/22337896/how-to-fix-undefined-references-to-inflate-deflate-functions
Author
Owner

@justdomyself commented on GitHub (Sep 19, 2023):

You probably need to add the zlib library to your link commands with -lz or the equivalent in your Cmake file. See the following:

https://stackoverflow.com/questions/22337896/how-to-fix-undefined-references-to-inflate-deflate-functions

I have add below line in my cmakelists.txt,but still has this error;
target_link_libraries( ${TARGET} z)

<!-- gh-comment-id:1724732330 --> @justdomyself commented on GitHub (Sep 19, 2023): > You probably need to add the zlib library to your link commands with `-lz` or the equivalent in your Cmake file. See the following: > > https://stackoverflow.com/questions/22337896/how-to-fix-undefined-references-to-inflate-deflate-functions I have add below line in my cmakelists.txt,but still has this error; target_link_libraries( ${TARGET} z)
Author
Owner

@justdomyself commented on GitHub (Sep 19, 2023):

You probably need to add the zlib library to your link commands with -lz or the equivalent in your Cmake file. See the following:
https://stackoverflow.com/questions/22337896/how-to-fix-undefined-references-to-inflate-deflate-functions

I have add below line in my cmakelists.txt,but still has this error; target_link_libraries( ${TARGET} z)

I have resolve my question。

the problem is :

I install two toolchain , one is for imx6, the other is for imx8m。 they both has zlib ,but diffrent version。

1、when I build libxlsxwriter.a, I add absolute path into cmakelists.txt in line 221:

set(ZLIB_ROOT "/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi/usr/lib")

find_package(ZLIB "1.0" REQUIRED)
list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
message("zlib version: " ${ZLIB_VERSION})

2、when I build my project , I add below line in my cmakelists.txt:
target_link_libraries( ${TARGET} z)

<!-- gh-comment-id:1724923008 --> @justdomyself commented on GitHub (Sep 19, 2023): > > You probably need to add the zlib library to your link commands with `-lz` or the equivalent in your Cmake file. See the following: > > https://stackoverflow.com/questions/22337896/how-to-fix-undefined-references-to-inflate-deflate-functions > > I have add below line in my cmakelists.txt,but still has this error; target_link_libraries( ${TARGET} z) I have resolve my question。 the problem is : I install two toolchain , one is for imx6, the other is for imx8m。 they both has zlib ,but diffrent version。 1、when I build libxlsxwriter.a, I add absolute path into cmakelists.txt in line 221: set(ZLIB_ROOT "/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi/usr/lib") find_package(ZLIB "1.0" REQUIRED) list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) message("zlib version: " ${ZLIB_VERSION}) 2、when I build my project , I add below line in my cmakelists.txt: target_link_libraries( ${TARGET} z)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#324
No description provided.