Closed ZaWertun closed 4 years ago
Hey @kalinon could you get these Makefile changes reflected in cmake? If you could pull @ZaWertun's branch, adjust, and submit a PR like you did with pull-zawertun that'd be ideal. Thanks!
(Merging this does not mean that we need to commit to LLVM 10 right now. It's just a small/not-too-obtrusive change so let's try to add it.)
Yeah, I'll look at it tomorrow 👌
On Sat, May 9, 2020 at 7:40 PM Davor Ocelic notifications@github.com wrote:
Hey @kalinon https://github.com/kalinon could you get these Makefile changes reflected in cmake? If you could pull @ZaWertun https://github.com/ZaWertun's branch, adjust, and submit a PR like you did with pull-zawertun that'd be ideal. Thanks!
(Merging this does not mean that we need to commit to LLVM 10 right now. It's just a small/not-too-obtrusive change so let's try to add it.)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Papierkorb/bindgen/issues/28#issuecomment-626250010, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK6J3BMS5O2NKZPX6NSZF3RQXSVLANCNFSM4M4X6REQ .
--
Holden Omans
Yeah, I'll look at it tomorrow ok_hand On Sat, May 9, 2020 at 7:40 PM Davor Ocelic @.**> wrote: Hey @kalinon https://github.com/kalinon could you get these Makefile changes reflected in cmake? If you could pull @ZaWertun https://github.com/ZaWertun's branch, adjust, and submit a PR like you did with pull-zawertun that'd be ideal. Thanks! (Merging this does not mean that we need to commit to LLVM 10 right now. It's just a small/not-too-obtrusive change so let's try to add it.) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#28 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK6J3BMS5O2NKZPX6NSZF3RQXSVLANCNFSM4M4X6REQ . -- Holden Omans*
I'm able to build bindgen on Fedora-32 x86_64 with llvm-10 (commit: b3f0972681a62dc8e96b0cd58b7001d6067fdaf3) after following steps:
Little change to clang/CMakeLists.txt
:
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 1fb4a44..bc9762a 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -16,6 +16,9 @@ message(STATUS "Found LLVM: ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
string(REGEX MATCH "^([0-9]+)" LLVM_VER ${LLVM_PACKAGE_VERSION})
message(STATUS "LLVM Major version: ${LLVM_VER}")
+if ("${LLVM_VER}" VERSION_GREATER_EQUAL "10")
+ set(CMAKE_CXX_STANDARD_14)
+endif ()
# Add llvm version definition
add_definitions(-D__LLVM_VERSION_${LLVM_VER})
@@ -122,4 +125,4 @@ elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
endif ()
# -ldl -lz -lcurses -lpcre
-target_link_libraries(bindgen dl z curses pcre)
+target_link_libraries(bindgen dl z curses pcre LLVM)
If I don't add LLVM to the libraries I've got this link error:
...
[ 7%] Linking CXX executable bindgen
/usr/bin/ld: missing --end-group; added as last command line option
/usr/bin/ld: missing --end-group; added as last command line option
/usr/bin/ld: CMakeFiles/bindgen.dir/src/bindgen_ast_consumer.cpp.o: undefined reference to symbol '_ZN4llvm11raw_ostream14flush_nonemptyEv@@LLVM_10'
/usr/bin/ld: /usr/lib64/libLLVM-10.so: error adding symbols: DSO missing from command line
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [clang/CMakeFiles/bindgen.dir/build.make:269: clang/bindgen] Error 1
make[1]: *** [CMakeFiles/Makefile2:174: clang/CMakeFiles/bindgen.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
...
BINDGEN_DYNAMIC=1 cmake . && make -j
@ZaWertun ill add these in PR is open for review. i think i may have fixed a few other silent issues
Actually @ZaWertun can you see if i fixed the issue with target_link_libraries(bindgen dl z curses pcre LLVM)
I did notice that the llvm libs were coming back empty, so i added a catch to manually look them up. Im wondering if it does the same thing as adding LLVM
to the links.
Also, since i dont take account of BINDGEN_DYNAMIC=1
do you need it? im wondering if cmake makes that distinction and handles it for fedora?
Just checked 00db954d05e8e8be95488768a60a6f0a89982036.
BINDGEN_DYNAMIC=1
still needed as without it I see this error:
...
CMake Error at clang/CMakeLists.txt:78 (message):
You're missing the LLVM and/or Clang development libraries.
Please install these:
ArchLinux: pacman -S llvm clang gc libyaml
Ubuntu: apt install clang-4.0 libclang-4.0-dev zlib1g-dev libncurses-dev libgc-dev llvm-4.0-dev libpcre3-dev
CentOS: yum install crystal libyaml-devel gc-devel pcre-devel zlib-devel clang-devel
openSUSE: zypper install llvm clang libyaml-devel gc-devel pcre-devel zlib-devel clang-devel ncurses-devel
Mac OS: brew install crystal bdw-gc gmp libevent libxml2 libyaml llvm
If you've installed these in a non-standard location, do one of these:
1) Make the CLANG environment variable point to your `clang++` executable
2) Add the `clang++` executable to your PATH
If your distro does not support static libraries like openSUSE then set env
BINDGEN_DYNAMIC=1
-- Configuring incomplete, errors occurred! See also "/home/zawertun/tmp/bindgen@Papierkorb/CMakeFiles/CMakeOutput.log". See also "/home/zawertun/tmp/bindgen@Papierkorb/CMakeFiles/CMakeError.log".
It's seems right.
2. When running `BINDGEN_DYNAMIC=1 cmake .` I see this warnign:
CMake Warning at clang/CMakeLists.txt:95 (message): Unable to find llvm libs. Will run command manually
But it's OK since bindgen builds without errors.
:thumbsup:
@ZaWertun ah i forgot the changes to find_clang.cr
you may want to check out #32 as we may need to add something there for dynamic?
@ZaWertun ah i forgot the changes to
find_clang.cr
you may want to check out #32 as we may need to add something there for dynamic?
For now - I don't know. It's kinda works - good :)
Just tried commit 356b527cd511fe83f7acc1deea94f75f2947f0f3 - builds without errors. So I'm closing the issue. Thanks!
You can cherrypick my commit, just change macros to the right one: https://github.com/ZaWertun/bindgen/commit/125f32cfac2c2dd98b44f28377aa5075550d9efd