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

Build2 compatibility #584

Open
b3n-h4il opened this issue Jul 12, 2024 · 5 comments
Open

Build2 compatibility #584

b3n-h4il opened this issue Jul 12, 2024 · 5 comments

Comments

@b3n-h4il
Copy link

b3n-h4il commented Jul 12, 2024

Hello. First of all, congratulations on your great work. I'm transiotining from Windows to Linux and still creating a C++ dev environment, tools like bear are a huge help. I'd like to ask a question.
I'm trying to use Bear with Build2. It's not a make based build system and doesn't have a plugin for compile database generation. The wiki (Bear's wiki) says that we can use some compiler wrapper for Bear to intercept the build commands. Even with ccache installed and replacing clang in the build configuration, Bear
only generates a blank compile_commands.json file. Is there someone also trying to use Bear and Build2 who might have some pointers?

@rizsotto
Copy link
Owner

Hi @b4dW01ff ,

I am not familiar with the Build2 tool. If you can attach a verbose log output (bear -vvvv -- ...) then we can find out what tune we need to do. Also, could you check if the Build2 tool is linked statically or dynamically. And if I understand correctly, you are trying this on Linux. Is that correct?

@b3n-h4il
Copy link
Author

Thank you for your reply. I'm away from my computer at the moment, but I'll get the info you asked for.

And if I understand correctly, you are trying this on Linux. Is that correct?

  • Yes, trying on Linux

@b3n-h4il
Copy link
Author

b3n-h4il commented Jul 18, 2024

Also, could you check if the Build2 tool is linked statically or dynamically.

Are you talking about how it's built? The docs say that in the build process it's linked against static libraries: "At the high level, the bootstrap process involves the following 5 steps.

  1. Bootstrap, Phase 1
    First, a minimal build system executable is built using provided shell scripts/batch files or a GNU makefile. The result is only guaranteed to be able to rebuild the build system itself.
  2. Bootstrap, Phase 2
    Then, the build system is rebuilt with static libraries. The result is only guaranteed to be able to build the build system and the package manager.
  3. Stage
    At this step the build system and package manager are built with shared libraries and then staged.
  4. Install
    Next, the staged tools are used to build and install the entire toolchain from the package repository with the package manager.
  5. Clean
    Finally, the staged at step 3 tools are uninstalled.
    The end result of the bootstrap process is the installed toolchain as well as the package manager configuration (created at step 4) that can be used to upgrade to newer versions."

@b3n-h4il
Copy link
Author

I am not familiar with the Build2 tool. If you can attach a verbose log output (bear -vvvv -- ...) then we can find out what tune we need to do.

Do you mean bear --verbose?

@Norman-Normandy
Copy link

I am not familiar with the Build2 tool. If you can attach a verbose log output (bear -vvvv -- ...) then we can find out what tune we need to do. Also, could you check if the Build2 tool is linked statically or dynamically. And if I understand correctly, you are trying this on Linux. Is that correct?

On Void Linux this is the verbose output of a simple hello project.
This is the non-verbose output of the same project.

The result is an empty compile_commands.json with just "{}".

Build2 itself is a entire native build-system & toolchain written in C++. It has separate commands for different parts of the toolchain. For example the front-end userspace driver is just called "b". This is the output from ldd:

ldd /usr/local/bin/b
linux-vdso.so.1 (0x00007f28b4ab8000)
libbuild2-0.17.so => /usr/local/lib/libbuild2-0.17.so (0x00007f28b4400000)
libbutl-0.17.so => /usr/local/lib/libbutl-0.17.so (0x00007f28b42b4000)
libbuild2-bash-0.17-0.17.so => /usr/local/lib/libbuild2-bash-0.17-0.17.so (0x00007f28b4a66000)
libbuild2-c-0.17-0.17.so => /usr/local/lib/libbuild2-c-0.17-0.17.so (0x00007f28b4a46000)
libbuild2-cli-0.17-0.17.so => /usr/local/lib/libbuild2-cli-0.17-0.17.so (0x00007f28b4a14000)
libbuild2-cxx-0.17-0.17.so => /usr/local/lib/libbuild2-cxx-0.17-0.17.so (0x00007f28b49e4000)
libbuild2-cc-0.17-0.17.so => /usr/local/lib/libbuild2-cc-0.17-0.17.so (0x00007f28b4124000)
libbuild2-bin-0.17-0.17.so => /usr/local/lib/libbuild2-bin-0.17-0.17.so (0x00007f28b40af000)
libbuild2-version-0.17-0.17.so => /usr/local/lib/libbuild2-version-0.17-0.17.so (0x00007f28b49af000)
libbuild2-in-0.17-0.17.so => /usr/local/lib/libbuild2-in-0.17-0.17.so (0x00007f28b4991000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f28b3c00000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f28b3fcb000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f28b3fa7000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f28b3a16000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f28b4aba000)
libbutl-pkg-config-0.17.so => /usr/local/lib/libbutl-pkg-config-0.17.so (0x00007f28b3f98000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f28b3fa7000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f28b3a16000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f28b4aba000)
libbutl-pkg-config-0.17.so => /usr/local/lib/libbutl-pkg-config-0.17.so (0x00007f28b3f98000)`

For reference the command "b -vn clean update |& compiledb" generates a compile_commands.json using compiledb, a python program.

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