Dmitry Golovin via llvm-dev
2017-Jun-04 19:54 UTC
[llvm-dev] LLVM compilation problem with musl
I'm trying to compile LLVM with musl libc library. The compilation process fails on the following: x86_64-linux-musl-g++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_GLOBAL_ISEL -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I../lib/Support -Iinclude -I../include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -DNDEBUG -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o -c ../lib/Support/DynamicLibrary.cpp In file included from ../lib/Support/DynamicLibrary.cpp:111:0: ../lib/Support/Unix/DynamicLibrary.inc: In function ‘void* DoSearch(const char*)’: ../lib/Support/Unix/DynamicLibrary.inc:102:42: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive] if (!strcmp(SymbolName, #SYM)) return &SYM ^ ../lib/Support/Unix/DynamicLibrary.inc:109:5: note: in expansion of macro ‘EXPLICIT_SYMBOL’ EXPLICIT_SYMBOL(stderr); ^~~~~~~~~~~~~~~ ../lib/Support/Unix/DynamicLibrary.inc:102:42: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive] if (!strcmp(SymbolName, #SYM)) return &SYM ^ ../lib/Support/Unix/DynamicLibrary.inc:110:5: note: in expansion of macro ‘EXPLICIT_SYMBOL’ EXPLICIT_SYMBOL(stdout); ^~~~~~~~~~~~~~~ ../lib/Support/Unix/DynamicLibrary.inc:102:42: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive] if (!strcmp(SymbolName, #SYM)) return &SYM ^ ../lib/Support/Unix/DynamicLibrary.inc:111:5: note: in expansion of macro ‘EXPLICIT_SYMBOL’ EXPLICIT_SYMBOL(stdin); ^~~~~~~~~~~~~~~ Have anyone had similar problem? Maybe someone had already successfully compiled LLVM with musl? All musl-based distros (like Alpine, sabotage, void-musl) should be affected. I think that Rust team had similar problem (https://github.com/rust-lang/rust/issues/28667) and they came up with some kind of workaround for it. Regards, Dmitry
Dimitry Andric via llvm-dev
2017-Jun-04 20:01 UTC
[llvm-dev] LLVM compilation problem with musl
Most likely, you mean this particular fix? https://git.alpinelinux.org/cgit/aports/tree/main/llvm4/llvm-fix-DynamicLibrary-to-build-with-musl-libc.patch?id=HEAD Indeed, checking #if defined(__GLIBC__) seems to be a better solution that assuming all C libraries on Linux are the same. -Dimitry> On 4 Jun 2017, at 21:54, Dmitry Golovin via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > I'm trying to compile LLVM with musl libc library. The compilation process fails on the following: > > x86_64-linux-musl-g++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_GLOBAL_ISEL -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I../lib/Support -Iinclude -I../include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -DNDEBUG -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o -c ../lib/Support/DynamicLibrary.cpp > In file included from ../lib/Support/DynamicLibrary.cpp:111:0: > ../lib/Support/Unix/DynamicLibrary.inc: In function ‘void* DoSearch(const char*)’: > ../lib/Support/Unix/DynamicLibrary.inc:102:42: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive] > if (!strcmp(SymbolName, #SYM)) return &SYM > ^ > ../lib/Support/Unix/DynamicLibrary.inc:109:5: note: in expansion of macro ‘EXPLICIT_SYMBOL’ > EXPLICIT_SYMBOL(stderr); > ^~~~~~~~~~~~~~~ > ../lib/Support/Unix/DynamicLibrary.inc:102:42: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive] > if (!strcmp(SymbolName, #SYM)) return &SYM > ^ > ../lib/Support/Unix/DynamicLibrary.inc:110:5: note: in expansion of macro ‘EXPLICIT_SYMBOL’ > EXPLICIT_SYMBOL(stdout); > ^~~~~~~~~~~~~~~ > ../lib/Support/Unix/DynamicLibrary.inc:102:42: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive] > if (!strcmp(SymbolName, #SYM)) return &SYM > ^ > ../lib/Support/Unix/DynamicLibrary.inc:111:5: note: in expansion of macro ‘EXPLICIT_SYMBOL’ > EXPLICIT_SYMBOL(stdin); > ^~~~~~~~~~~~~~~ > > Have anyone had similar problem? Maybe someone had already successfully compiled LLVM with musl? > > All musl-based distros (like Alpine, sabotage, void-musl) should be affected. I think that Rust team had similar problem (https://github.com/rust-lang/rust/issues/28667) and they came up with some kind of workaround for it. > > Regards, > Dmitry > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 194 bytes Desc: Message signed with OpenPGP URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170604/dafb3c7a/attachment.sig>
Dmitry Golovin via llvm-dev
2017-Jun-04 20:20 UTC
[llvm-dev] LLVM compilation problem with musl
Thank you very much! It seems to solve the problem, only the patch should now be applied to a different file (lib/Support/Unix/DynamicLibrary.inc instead of lib/Support/DynamicLibrary.cpp), it is compiling now. Regards, Dmitry 04.06.2017, 23:01, "Dimitry Andric" <dimitry at andric.com>:> Most likely, you mean this particular fix? > > https://git.alpinelinux.org/cgit/aports/tree/main/llvm4/llvm-fix-DynamicLibrary-to-build-with-musl-libc.patch?id=HEAD > > Indeed, checking #if defined(__GLIBC__) seems to be a better solution that assuming all C libraries on Linux are the same. > > -Dimitry > >> On 4 Jun 2017, at 21:54, Dmitry Golovin via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> I'm trying to compile LLVM with musl libc library. The compilation process fails on the following: >> >> x86_64-linux-musl-g++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_GLOBAL_ISEL -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I../lib/Support -Iinclude -I../include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -DNDEBUG -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o -c ../lib/Support/DynamicLibrary.cpp >> In file included from ../lib/Support/DynamicLibrary.cpp:111:0: >> ../lib/Support/Unix/DynamicLibrary.inc: In function ‘void* DoSearch(const char*)’: >> ../lib/Support/Unix/DynamicLibrary.inc:102:42: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive] >> if (!strcmp(SymbolName, #SYM)) return &SYM >> ^ >> ../lib/Support/Unix/DynamicLibrary.inc:109:5: note: in expansion of macro ‘EXPLICIT_SYMBOL’ >> EXPLICIT_SYMBOL(stderr); >> ^~~~~~~~~~~~~~~ >> ../lib/Support/Unix/DynamicLibrary.inc:102:42: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive] >> if (!strcmp(SymbolName, #SYM)) return &SYM >> ^ >> ../lib/Support/Unix/DynamicLibrary.inc:110:5: note: in expansion of macro ‘EXPLICIT_SYMBOL’ >> EXPLICIT_SYMBOL(stdout); >> ^~~~~~~~~~~~~~~ >> ../lib/Support/Unix/DynamicLibrary.inc:102:42: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive] >> if (!strcmp(SymbolName, #SYM)) return &SYM >> ^ >> ../lib/Support/Unix/DynamicLibrary.inc:111:5: note: in expansion of macro ‘EXPLICIT_SYMBOL’ >> EXPLICIT_SYMBOL(stdin); >> ^~~~~~~~~~~~~~~ >> >> Have anyone had similar problem? Maybe someone had already successfully compiled LLVM with musl? >> >> All musl-based distros (like Alpine, sabotage, void-musl) should be affected. I think that Rust team had similar problem (https://github.com/rust-lang/rust/issues/28667) and they came up with some kind of workaround for it. >> >> Regards, >> Dmitry >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev