Bug 435854 - Problems building clazy with MinGW
Summary: Problems building clazy with MinGW
Status: REPORTED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-17 19:50 UTC by Björn Schäpers
Modified: 2021-05-16 08:03 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Schäpers 2021-04-17 19:50:17 UTC
SUMMARY
I'm trying to build clazy with (MSYS2's) MinGW on Windows. I hit some issues, for two I need help.

STEPS TO REPRODUCE
1. cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../$(LLVMINSTALLDIR) -DCMAKE_FIND_LIBRARY_SUFFIXES=.a -DCLAZY_MAN_PAGE=OFF ../clazy
2. mingw32-make

OBSERVED RESULT
First Issue: Linking ClazyPlugin.dll fails, because the LLVM lib files have mixed path separators and \ is not escaped, GCC eats it.
> llvm-config --libfiles
E:\llvm/lib/libLLVMWindowsManifest.a ...
I don't know if this is an error from LLVM, CMake (or its MinGW Makefiles generator), GCC, or clazy. But I never had such an issue building QtCreator (and its clang based plugins) or doxygen. I've found a work around with adding
string(REPLACE "\\" "/" LLVM_LIBS ${LLVM_LIBS})
in the FindLLVM.cmake.

Second Issue:
[100%] Linking CXX executable bin\clazy-standalone.exe
E:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/llvm/lib/libclangASTMatchers.a(ASTMatchersInternal.cpp.obj):ASTMatchersInternal.cpp:(.text+0x1310): multiple definition of `clang::ast_matchers::internal::ASTMatchFinder::isTraversalIgnoringImplicitNodes() const'; lib/libClazyPlugin.dll.a(d027125.o):(.text+0x0): first defined here

Following multiple symbols.

EXPECTED RESULT
First Issue: Either escaped backslashes or only forward slashes.

Second Issue: I assume the symbols should not be exported from the clazy plugin.

SOFTWARE/OS VERSIONS
Windows: 7
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Up to date msys2, self compiled Qt and LLVM.
Comment 1 Sergio Martins 2021-05-15 09:11:00 UTC
Git commit 96de05dd7795d045258db28270b5b27c6ce37021 by Sergio Martins.
Committed on 15/05/2021 at 09:07.
Pushed by smartins into branch 'master'.

README: Mention supported platforms

M  +7    -0    README.md

https://invent.kde.org/sdk/clazy/commit/96de05dd7795d045258db28270b5b27c6ce37021
Comment 2 Sergio Martins 2021-05-15 09:14:24 UTC
I don't have bandwidth to support MinGW so won't work on it

Can you try if -DLINK_CLAZY_TO_LLVM=OFF helps ?

Windows is very tricky to get right MSVC works very differently than MinGW, regarding llvm and plugin symbols
Comment 3 Björn Schäpers 2021-05-16 08:03:41 UTC
That did not help.