fix w64-mingw32-ld linking error#3184
Conversation
use shlwapi instead of Shlwapi.lib in mingw-w64 build environment (prevents "/usr/bin/x86_64-w64-mingw32-ld: cannot find -lShlwapi" error)
firewave
left a comment
There was a problem hiding this comment.
This also needs to be done in test/CMakeLists.txt and tools/CMakeLists.txt.
For MinGW it will actually work without the .lib suffix - that is only required for MSVC. So the code should actually be
if(MSVC)
target_link_libraries(cppcheck Shlwapi.lib)
else()
target_link_libraries(cppcheck shlwapi)
endif()
|
Thanks for your contribution. I see - the cross-compilation doesn't work. Was baffled since MinGW links fine locally for me - on Windows. Also something to considered for the CI build matrix. |
d3fabad to
c2d4609
Compare
c2d4609 to
97a66e3
Compare
Done. |
Do you mean some additional testing environment for cross-compilation? |
Yes, currently there is no cross-compilation done at all in the CI. |
firewave
left a comment
There was a problem hiding this comment.
Looks fine. Will apply the inverted MSVC checks later on.
use shlwapi instead of Shlwapi.lib in mingw-w64 build environment
(prevents "/usr/bin/x86_64-w64-mingw32-ld: cannot find -lShlwapi" error)
$ dpkg-query -S /usr/x86_64-w64-mingw32/lib/libshlwapi.a
mingw-w64-x86-64-dev: /usr/x86_64-w64-mingw32/lib/libshlwapi.a
$ dpkg -l|grep mingw-w64
ii binutils-mingw-w64-i686 2.30-7ubuntu1+8ubuntu1 amd64 Cross-binutils for Win32 (x86) using MinGW-w64
ii binutils-mingw-w64-x86-64 2.30-7ubuntu1+8ubuntu1 amd64 Cross-binutils for Win64 (x64) using MinGW-w64
ii g++-mingw-w64-i686 5.3.1-8ubuntu3+17 amd64 GNU C++ compiler for MinGW-w64 targeting Win32
ii g++-mingw-w64-x86-64 5.3.1-8ubuntu3+17 amd64 GNU C++ compiler for MinGW-w64 targeting Win64
ii gcc-mingw-w64-base 5.3.1-8ubuntu3+17 amd64 GNU Compiler Collection for MinGW-w64 (base package)
ii gcc-mingw-w64-i686 5.3.1-8ubuntu3+17 amd64 GNU C compiler for MinGW-w64 targeting Win32
ii gcc-mingw-w64-x86-64 5.3.1-8ubuntu3+17 amd64 GNU C compiler for MinGW-w64 targeting Win64
ii mingw-w64-common 5.0.3-1 all Common files for Mingw-w64
ii mingw-w64-i686-dev 5.0.3-1 all Development files for MinGW-w64 targeting Win32
ii mingw-w64-x86-64-dev 5.0.3-1 all Development files for MinGW-w64 targeting Win64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic