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 LNK2019 unresolved external symbol ___chkstk_ms referenced in function LZ4_compress_fast liblz4_static.lib(lz4.o) #920

Closed
TimelifeCzy opened this issue Sep 24, 2020 · 7 comments

Comments

@TimelifeCzy
Copy link

TimelifeCzy commented Sep 24, 2020

liblz4_staic.lib(lz4.o) referenced in function LZ4_compress_fast()?

  1. #include "lz4.h"
  2. Linker liblz4_static.lib
  3. Add Library Directory

code:
int nRet = LZ4_decompress_safe((char*)(SectionAddress + m_lpbase), (char*)(pSections->VirtualAddress + m_lpbase), g_stud.s_blen[i], pSections->SizeOfRawData);

need help !Thank

@TimelifeCzy TimelifeCzy changed the title Error LNK2019 unresolved external symbol ___chkstk_ms referenced in function LZ4_compress_fast \Stud\liblz4_static.lib(lz4.o) Error LNK2019 unresolved external symbol ___chkstk_ms referenced in function LZ4_compress_fast liblz4_static.lib(lz4.o) Sep 24, 2020
@TimelifeCzy
Copy link
Author

图片

@TimelifeCzy
Copy link
Author

TimelifeCzy commented Sep 24, 2020

static no-import? dll\liblz4.dll.a Success, run error: msys-lz4-1.dll

@Ruiyang19
Copy link

Have you solved the problem? I ran into the same problem just like yours.

@Cyan4973
Copy link
Member

Cyan4973 commented Oct 3, 2020

I have no experience with this setup unfortunately.

For Windows + MSVC compilation and link, lz4.h can receive special declaration instructions, using LZ4_DLL_EXPORT or LZ4_DLL_IMPORT, that will influence the way MS exposes and link symbols. Try any of these and see if they help.
I would expect EXPORT to be useful with .dll, and IMPORT maybe for .lib.

Hopefully, other users of LZ4 on MSVC may be able to help more.

@TimelifeCzy
Copy link
Author

Recompile, the release version is invalid

@JohnAlcatraz
Copy link

JohnAlcatraz commented Dec 6, 2020

Have the same issue here, how was this solved?

Edit: Well, solved it by manually compiling the .lib from the .sln in the build folder. Seems, as TimelifeCzy mentioned, the .lib in the lz4_win64_v1_9_3.zip from the releases is just broken.

@Cyan4973
Copy link
Member

I suspect the issue is that the binary files in the package lz4_win64_v1_9_3.zip were built using mingw64, not msvc.
When it comes to linking, this is likely an incompatibility issue, compilers probably expect different conventions.

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

4 participants