Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem to regenerate a specific qt5 binding #59

Open
Fulgurance opened this issue Feb 18, 2022 · 3 comments
Open

Problem to regenerate a specific qt5 binding #59

Fulgurance opened this issue Feb 18, 2022 · 3 comments

Comments

@Fulgurance
Copy link

Hello, I'm a Gentoo Linux user and today I tried to regenerate a specific qt5 bindings to try qt5 with crystal, but when the process started, it stopped and I had an error:

Full log:

 zohran  ~  Documents  Programmation  PGM  BINDGEN_DYNAMIC=1 lib/bindgen/tool.sh qt.yml --stats
** clang/parser not found.  Building now.
-- Found LLVM: 13.0.1
-- Using LLVMConfig.cmake in: /usr/lib/llvm/13/lib64/cmake/llvm
-- LLVM Major version: 13
-- Setting std version: c++14
-- LLVM Tools Dir: /usr/lib/llvm/13/bin
-- Using clang++ exec: /usr/lib/llvm/13/bin/clang++
-- Found llvm-config bin: /usr/lib/llvm/13/bin/llvm-config
-- Using llvm-config exec: /usr/lib/llvm/13/bin/llvm-config
-- Include LLVM dirs: /usr/lib/llvm/13/include
-- Add LLVM definitions: -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-- Run: crystal find_clang.cr -- --clang /usr/lib/llvm/13/bin/clang++ --llvm-config /usr/lib/llvm/13/bin/llvm-config --quiet
-- Run: crystal find_clang.cr -- --print-clang-libs --clang /usr/lib/llvm/13/bin/clang++ --llvm-config /usr/lib/llvm/13/bin/llvm-config --quiet
-- Run: crystal find_clang.cr -- --print-llvm-libs --clang /usr/lib/llvm/13/bin/clang++ --llvm-config /usr/lib/llvm/13/bin/llvm-config --quiet
-- CMake System Name: Linux
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zohran/Documents/Programmation/PGM/lib/bindgen/clang
Consolidate compiler generated dependencies of target parser
[  7%] Building CXX object CMakeFiles/parser.dir/src/bindgen.cpp.o
/home/zohran/Documents/Programmation/PGM/lib/bindgen/clang/src/bindgen.cpp:18:38: error: calling a protected constructor of class 'clang::tooling::CommonOptionsParser'
        clang::tooling::CommonOptionsParser op(argc, argv, BindgenCategory);
                                            ^
/usr/lib/llvm/13/include/clang/Tooling/CommonOptionsParser.h:76:3: note: declared protected here
  CommonOptionsParser(
  ^
1 error generated.
make[2]: *** [CMakeFiles/parser.dir/build.make:76 : CMakeFiles/parser.dir/src/bindgen.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:164 : CMakeFiles/parser.dir/all] Erreur 2
make: *** [Makefile:91 : all] Erreur 2
  Bindgen requires a full installation of Clang, its libraries and development
  headers.  Please install these first, and restart this script.
  You can also manually run 'cmake . && make' in clang/ for debugging this issue.
  Full path to clang/: /home/zohran/Documents/Programmation/PGM/lib/bindgen/clang/
 zohran  ~  Documents  Programmation  PGM  1  ls
lib  shard.lock  shard.yml
 zohran  ~  Documents  Programmation  PGM  cd lib/
bindgen/ qt5/     spoved/  toka/    
 zohran  ~  Documents  Programmation  PGM  cd lib/qt5/
config/  ext/     images/  lib/     samples/ spec/    src/     support/ 
 zohran  ~  Documents  Programmation  PGM  cd lib/
bindgen/ qt5/     spoved/  toka/    
 zohran  ~  Documents  Programmation  PGM  cd lib/bindgen/
assets/  ci/      clang/   images/  lib/     samples/ spec/    src/     
 zohran  ~  Documents  Programmation  PGM  cd lib/bindgen/clang/
 zohran  …  lib  bindgen  clang  cmake . && make
-- Found LLVM: 13.0.1
-- Using LLVMConfig.cmake in: /usr/lib/llvm/13/lib64/cmake/llvm
-- LLVM Major version: 13
-- Setting std version: c++14
-- LLVM Tools Dir: /usr/lib/llvm/13/bin
-- Using clang++ exec: /usr/lib/llvm/13/bin/clang++
-- Found llvm-config bin: /usr/lib/llvm/13/bin/llvm-config
-- Using llvm-config exec: /usr/lib/llvm/13/bin/llvm-config
-- Include LLVM dirs: /usr/lib/llvm/13/include
-- Add LLVM definitions: -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-- Run: crystal find_clang.cr -- --clang /usr/lib/llvm/13/bin/clang++ --llvm-config /usr/lib/llvm/13/bin/llvm-config --quiet
CMake Error at crystal.cmake:28 (message):
  You're missing the LLVM and/or Clang executables or development libraries.

  

  If you've installed the binaries in a non-standard location:

    1) Make sure that `llvm-config` or `llvm-config-*` is set with --llvm_config FILE or is in PATH. The first binary found which satisfies version will be used.
    2) In rare cases if clang++ isn't found or is incorrect, you can also specify it with --clang FILE.

  

  If your distro does not support static libraries like openSUSE then set env
  var BINDGEN_DYNAMIC=1.

  This will use .so instead of .a libraries during linking.

  

  If you are missing the packages, please install them:

    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

Call Stack (most recent call first):
  CMakeLists.txt:4 (include)


-- Configuring incomplete, errors occurred!
See also "/home/zohran/Documents/Programmation/PGM/lib/bindgen/clang/CMakeFiles/CMakeOutput.log".
 zohran  …  lib  bindgen  clang  1  

And clang and llvm are installed with the following setup:

[I] sys-devel/clang
     Available versions:  
     (11)   11.1.0(11/11.1)^t
     (12)   12.0.1^t
     (13)   13.0.0^t (~)13.0.1^t
     (14)   **14.0.0_rc1^t **14.0.0.9999*l^t
     (15)   **15.0.0.9999*l^t
       {debug default-compiler-rt default-libcxx default-lld doc llvm-libunwind +pie +static-analyzer test xml ABI_MIPS="n32 n64 o32" ABI_S390="32 64" ABI_X86="32 64 x32" LLVM_TARGETS="AArch64 AMDGPU ARC ARM AVR BPF CSKY Hexagon Lanai LoongArch M68k MSP430 Mips NVPTX PowerPC RISCV Sparc SystemZ VE WebAssembly X86 XCore" PYTHON_SINGLE_TARGET="python3_8 python3_9 python3_10"}
     Installed versions:  13.0.1(13)^t(03:25:51 18/02/2022)(default-compiler-rt default-lld llvm-libunwind static-analyzer -debug -default-libcxx -doc -test -xml ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="32 64 -x32" LLVM_TARGETS="AArch64 AMDGPU ARM AVR BPF Hexagon Lanai MSP430 Mips NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore -ARC -CSKY -M68k -VE" PYTHON_SINGLE_TARGET="python3_9 -python3_8 -python3_10")
     Homepage:            https://llvm.org/
     Description:         C language family frontend for LLVM

[I] sys-devel/llvm
     Available versions:  
     (11)   11.1.0^t
     (12)   12.0.1^t
     (13)   13.0.0^t (~)13.0.1^t
     (14)   **14.0.0_rc1^t **14.0.0.9999*l^t
     (15)   **15.0.0.9999*l^t
       {+binutils-plugin debug doc exegesis +gold libedit +libffi ncurses test xar xml z3 ABI_MIPS="n32 n64 o32" ABI_S390="32 64" ABI_X86="32 64 x32" LLVM_TARGETS="AArch64 AMDGPU ARC ARM AVR BPF CSKY Hexagon Lanai LoongArch M68k MSP430 Mips NVPTX PowerPC RISCV Sparc SystemZ VE WebAssembly X86 XCore"}
     Installed versions:  13.0.1(13)^t(12:56:23 04/02/2022)(binutils-plugin libffi ncurses -debug -doc -exegesis -libedit -test -xar -xml -z3 ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="32 64 -x32" LLVM_TARGETS="AArch64 AMDGPU ARM AVR BPF Hexagon Lanai MSP430 Mips NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore -ARC -CSKY -M68k -VE")
     Homepage:            https://llvm.org/
     Description:         Low Level Virtual Machine

I missed to install something ?

@docelic
Copy link
Collaborator

docelic commented Feb 21, 2022

Heya,

I believe the error starts at the beginning where the parser can't be built due to:

error: calling a protected constructor of class 'clang::tooling::CommonOptionsParser'
        clang::tooling::CommonOptionsParser op(argc, argv, BindgenCategory);

So it doesn't look like you missed to install something.

I'll try reproducing it here and follow up with any news. Thanks for the report.

@docelic
Copy link
Collaborator

docelic commented Feb 21, 2022

Heya,

  1. Which version of Qt is this for?

  2. There's a lot in your report. Did you try the basic thing first? This one:

sudo apt install qt5-default # (Installs dependencies)
git clone https://github.com/Papierkorb/qt5.cr
cd qt5.cr
shards
edit support/generate_bindings.cr  # Configure which versions you want to build, temporarily
crystal support/generate_bindings.cr

@PhitherekReborn
Copy link

Hello,

If it helps, applying the change described here to bindgen/clang/src/bindgen.cpp fixed this for me: https://stackoverflow.com/questions/22577741/an-odd-bug-in-commonoptionsparser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants