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

meson: Deny shared build on MSVC compiler #2363

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions build/meson/contrib/pzstd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ zstd_rootdir = '../../../..'

pzstd_includes = include_directories(join_paths(zstd_rootdir, 'programs'),
join_paths(zstd_rootdir, 'contrib/pzstd'))
pzstd_sources = [join_paths(zstd_rootdir, 'programs/util.c'),
pzstd_sources = [
join_paths(zstd_rootdir, 'contrib/pzstd/main.cpp'),
join_paths(zstd_rootdir, 'contrib/pzstd/Options.cpp'),
join_paths(zstd_rootdir, 'contrib/pzstd/Pzstd.cpp'),
join_paths(zstd_rootdir, 'contrib/pzstd/SkippableFrame.cpp')]
join_paths(zstd_rootdir, 'contrib/pzstd/SkippableFrame.cpp'),
join_paths(zstd_rootdir, 'programs/util.c'),
]

pzstd_cpp_args = cxx.get_supported_arguments([ '-DNDEBUG', '-Wno-shadow', '-pedantic' ])

pzstd = executable('pzstd',
pzstd_sources,
cpp_args: [ '-DNDEBUG', '-Wno-shadow', '-pedantic' ],
cpp_args: pzstd_cpp_args,
include_directories: pzstd_includes,
dependencies: [ libzstd_dep, thread_dep ],
install: true)
8 changes: 6 additions & 2 deletions build/meson/lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ endif
libzstd_c_args = []
if cc_id == compiler_msvc
if default_library_type != 'static'
libzstd_sources += [windows_mod.compile_resources(
join_paths(zstd_rootdir, 'build/VS2010/libzstd-dll/libzstd-dll.rc'))]
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')),
Copy link

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?

Copy link
Contributor Author

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.

Copy link

@o-mdr o-mdr Oct 17, 2020

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)

Copy link
Contributor Author

@tesuji tesuji Oct 17, 2020

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.

Copy link
Contributor Author

@tesuji tesuji Oct 17, 2020

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.

Copy link

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

)
]
libzstd_c_args += ['-DZSTD_DLL_EXPORT=1',
'-DZSTD_HEAPMODE=0',
'-D_CONSOLE',
Expand Down
4 changes: 4 additions & 0 deletions build/meson/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ compiler_gcc = 'gcc'
compiler_clang = 'clang'
compiler_msvc = 'msvc'

if cc_id == compiler_msvc
error('MSVC 2019 compiler is not supported and not tested in Zstd')
endif

zstd_version = meson.project_version()

zstd_h_file = join_paths(meson.current_source_dir(), '../../lib/zstd.h')
Expand Down
8 changes: 6 additions & 2 deletions build/meson/programs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ endif

if cc_id == compiler_msvc
if default_library_type != 'static'
zstd_programs_sources += [windows_mod.compile_resources(
join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'))]
zstd_programs_sources += [
windows_mod.compile_resources(
join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'),
include_directories: include_directories(join_paths(zstd_rootdir, 'lib')),
)
]
endif
endif

Expand Down