-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
meson: Deny shared build on MSVC compiler #2363
Conversation
with the hope that it will pick c++ compiler instead of c in worse cases.
libzstd_sources += [ | ||
windows_mod.compile_resources( | ||
join_paths(zstd_rootdir, 'build/VS2010/libzstd-dll/libzstd-dll.rc'), | ||
include_directories: include_directories(join_paths(zstd_rootdir, 'lib')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the output from meson compile -v -C builddir
, I am not sure include_directories
are actually passed in to the resource compiler.
Anyone else observes this issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will, but I have MSVC compiler error about syntax: https://github.com/lzutao/zstd/runs/1264653094#step:8:130.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I cannot get beyond compiling resources on my system, whereas in your build it goes passed it and compiles the resource just fine.
That error is not about syntax, it's a linker error, basically it's saying that there were a couple of symbols observed in functions (ZSTD_cycleLog
, ZSTD_XXH64
, ZDICT_trainFromBuffer_unsafe_legacy
) that were not actually defined. Could it be a missing source/header file or compiler/linker flag?
It's probably ok to compile it with MSVC compiler, just needs to get all the files. It seems like this used to work with previous versions of the compiler, so should work with the newer (maybe just missing some flags)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a shared build. All the missing symbols were in zstd.lib
, which was included the the link
command.
There was also a static build, which has syntax error: https://github.com/lzutao/zstd/runs/1267569335#step:8:124.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry for giving the wrong link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so it is, not seen that one
@lzutao It looks like |
Thank you, @terrelln. Your way really fixes the static build. At worst case, I could disable shared build for msvc. |
Could you add
In zstd v1.4.5, just turn on this option, no code changed, run a test code: In the upcoming zstd v1.4.6, commit cc88eb7 accelerates from This option was added in MSVC2019, if use this option in MSVC2017, it will emit a warning: |
@animalize I could. However is the same flag used anywhere else in the other build systems? |
Thanks. A separated PR sounds reasonable. |
Adding Line 972 in 614e446
Like ZDICTLIB_VISIBILITY size_t ZDICT_trainFromBuffer_unsafe_legacy(
void* dictBuffer, size_t maxDictSize,
const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
ZDICT_legacy_params_t params); |
I need some help to resolve this error: https://github.com/facebook/zstd/pull/2363/checks?check_run_id=1275024168#step:3:1708 |
I initially thought that the topic was about the shared dynamic library, The For the CLI to link against a shared library, the library would need to expose basically all symbols, But there is a reason we only expose selected symbols by default : the rest is considered "internal stuff", and may change at any moment. So it's not good to let applications believe they can depend on these accidental features. I would suggest to not attempt delivering this feature through |
Thanks for your explanation. I think Meson had a way to disable statically linking with the library. I've been away from my computer for a while. If anyone want to patch this issue, please don't hesitate. |
Apparently, zstd has never tested on MSVC 2019 and currently fall to build on that compiler.
It would make sense to gate Meson until there is proper support for that compiler.
cc #2358
This PR also fixes some minor correctness issues.