Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ninja + cmake on Windows build error #2770

Closed
cartesius82 opened this issue Sep 7, 2021 · 4 comments
Closed

Ninja + cmake on Windows build error #2770

cartesius82 opened this issue Sep 7, 2021 · 4 comments

Comments

@cartesius82
Copy link

cartesius82 commented Sep 7, 2021

Cannot build ZSTD using ninja + cmake (versions below) on Windows. Perhaps it's the cmake's fault but is there any workaround? msbuild generator works fine.

cmake ..\build\cmake\ -G Ninja

...
-- Performing Test C_FLAG_WCAST_ALIGN
-- Performing Test C_FLAG_WCAST_ALIGN - Success
-- Performing Test CXX_FLAG_WCAST_ALIGN
-- Performing Test CXX_FLAG_WCAST_ALIGN - Success
-- Performing Test C_FLAG_WCAST_QUAL
-- Performing Test C_FLAG_WCAST_QUAL - Success
-- Performing Test CXX_FLAG_WCAST_QUAL
-- Performing Test CXX_FLAG_WCAST_QUAL - Success
-- Performing Test C_FLAG_WSTRICT_PROTOTYPES
-- Performing Test C_FLAG_WSTRICT_PROTOTYPES - Success
-- Performing Test C_FLAG_DDEBUGLEVEL_1
-- Performing Test C_FLAG_DDEBUGLEVEL_1 - Success
-- Performing Test CXX_FLAG_DDEBUGLEVEL_1
-- Performing Test CXX_FLAG_DDEBUGLEVEL_1 - Success
-- CMAKE_INSTALL_PREFIX: C:/Program Files (x86)/zstd
-- CMAKE_INSTALL_LIBDIR: lib
-- ZSTD_LEGACY_SUPPORT not defined!
-- ZSTD_MULTITHREAD_SUPPORT is enabled
-- Configuring done
-- Generating done
CMake Error:
  Running

   'C:/Users/james/scoop/shims/ninja.exe' '-C' 'C:/Users/james/src/xxx/third_party/zstd/b' '-t' 'recompact'

  failed with:

   ninja: error: build.ninja:767: multiple rules generate lib/zstd.lib [-w dupbuild=err]

Trying -w dupbuild=warn leads to errors as well.

Versions

  • cmake version 3.21.2
  • ninja 1.10.2
  • commit a488ba1 (HEAD, tag: v1.5.0, origin/release)
@cartesius82 cartesius82 changed the title Ninja + cmake on Windows error Ninja + cmake on Windows build error Sep 7, 2021
@cartesius82
Copy link
Author

@Cyan4973 Thank you for proper tagging. Any help would be appreciated.

@jannkoeker
Copy link
Contributor

You are propably using Clang (not Clang-cl)
See #2248 (comment)

@terrelln
Copy link
Contributor

Is there any action for us to take on this issue?

@jannkoeker
Copy link
Contributor

The best way would be to extend this code block

# With MSVC static library needs to be renamed to avoid conflict with import library
if (MSVC)
set(STATIC_LIBRARY_BASE_NAME zstd_static)
else ()
set(STATIC_LIBRARY_BASE_NAME zstd)
endif ()

to add an additional check for Clang on Windows.
I will create a pull request as soon as I have time.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants