abseil / abseil/abseil-cpp

[Bug]: CMake build not working on MSYS/MINGW64

Đang mở
#1,377 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C++
Star
18.1k
Fork
3.2k
Merge trung bình
20 giờ 36 phút
Pull request đã merge (30 ngày)
1

Mô tả

### Describe the issue

When incorporating absl::base into a CMake-based project built on MSYS/MINGW64 you get a dependency to `librt`.

AFAIU abseil CMake finds the msys cygwin-based librt, not the native one that MINGW toolchain would require. The `find_library` call yields a `/usr/lib/librt.a` while the native part lives under `/mingw64`. Of course librt does not exist on windows devices, and while it could make sense to have it in CYGWIN builds (don't know, I don't use it), it definitely does not do the job on MINGW64.

[Apparently other people have run into this](https://github.com/YosysHQ/nextpnr/issues/666).

Platform: windows 10, msys2, g++ 12.2.0, cmake 3.24.3

### Steps to reproduce the problem

Build an hello-world example linking absl::base on the platform:
windows 10, msys2, g++ 12.2.0, cmake 3.24.3

### What version of Abseil are you using?

tag: 20220623.0
commit: 273292d1cfc0a94a65082ee350509af1d113344d

### What operating system and version are you using?

Windows 10 19043.1237

### What compiler and version are you using?

Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-12.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev6, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++ --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Rev6, Built by MSYS2 project)

### What build system are you using?

cmake version 3.24.3

### Additional context

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.