I was successful building a 32-bit version clang from source on Windows using gcc-5.3. When I try to build a 64-bit version of clang on Windows with the triplet x86_64-w64-mingw32 and the 64-bit version of gcc-5.3 I get as an error:
I was successful building a 32-bit version clang from source on Windows
using gcc-5.3. When I try to build a 64-bit version of clang on Windows
with the triplet x86_64-w64-mingw32 and the 64-bit version of gcc-5.3 I get
as an error:
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x3066): undefined reference to
`xmlRelaxNGNewParserCtxt'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x307a): undefined reference to `xmlRelaxNGParse'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x3085): undefined reference to `xmlParseDoc'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x3099): undefined reference to
`xmlRelaxNGNewValidCtxt'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x30a7): undefined reference to
`xmlRelaxNGValidateDoc'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x30bb): undefined reference to `xmlGetLastError'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x30d3): undefined reference to
`xmlRelaxNGFreeValidCtxt'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x30db): undefined reference to `xmlFreeDoc'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x30e3): undefined reference to `xmlRelaxNGFree'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x30eb): undefined reference to
`xmlRelaxNGFreeParserCtxt'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text+0x3452): undefined reference to `xmlGetLastError'
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.obj:c-
index-test.c:(.text.startup+0x23): undefined reference to
`xmlCheckVersion'
collect2.exe: error: ld returned 1 exit status
Anyone know what I have to do to correct this problem ?
You are failing to link against libxml2. I don't have any idea why that
would be the case. I would recommend that you look at the cake output and
see if it failed to find the 64-bit version of libxml2 on your installation.
I guess you are building on msys2 with external mingw-w64.
No, I am not. Ninja is calling mingw-64/gcc-5.3 directly to build llvm/clang.
CMake picks up msys2's libxml2, I guess.
I do have a 32-bit libxml2 on my Windows PATH from the GnuWin32 package. But why is a build of llvm/clang requiring libxml2, whether a 32-bit or 64-bit version ?
Could you try overriding CMake and reconfigure?
-DCMAKE_LIBRARY_PATH="C:/mingw-w64/x86_64-4.9.3-posix-seh-rt_v4-rev1/mingw64/x86_64-w64-mingw32/lib"
I guess you are building on msys2 with external mingw-w64.
No, I am not. Ninja is calling mingw-64/gcc-5.3 directly to build
llvm/clang
.
CMake picks up msys2’s libxml2, I guess.
I do have a 32-bit libxml2 on my Windows PATH from the GnuWin32 package.
But why is a build of llvm/clang requiring libxml2, whether a 32-bit or
64-bit version ?
I don’t know why CMake finds but doesn’t ignore it.
c-index-test uses libxml2 if available. libxml2 is not essential.
We could add extra checks if libxml2 would be really available.
Could you try overriding CMake and reconfigure?
-DCMAKE_LIBRARY_PATH=“C:/mingw-w64/x86_64-4.9.3-posix-seh-rt_v4-rev1/mingw64/x86_64-w64-mingw32/lib”
Why would using gcc-4.9.3 make any difference ?
Excuse me. It was just an example. Please substitute with your mingw-w64’s path.
Where in the llvm/clang CMake files is libxml specified ?
Maybe CMake finds your libxml2 but does not check if its 32 or 64 bit,
just assumes it's the right one?
I queried this on the CMake mailing list and am awaiting some answer from them. But I expect that if I get one it will be to ask where llvm/clang specifies libxml in its CMakeLists.txt files.
clang calls CMake find_package(libxml2) to find libxml2.
This is implemented in the CMake standard module “/usr/share/cmake-3.5/Modules/FindLibXml2.cmake”.
Thanks I found it also just searching for 'libxml2' with case being ignored in all the .txt files in clang.
Evidently CMake cannot distinguish between finding a package that corresponds to the compiler 32-bit or 64-bit build that you are doing. This surprises me as it says that if I have a 32-bit version of a package and I am doing a 64-bit build, or vice-versa, CMake will act as if it has found the package even when the package cannot work with the build. I do not see this as correct behavior for a build system.