rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.79k stars 314 forks source link

use bear make in freebsd and have error #378

Closed AimerYi closed 3 years ago

AimerYi commented 3 years ago

I build bear in freebsd from github but when use bear -- make in freebsd it have an error: wrapper: failed with : system call "dlopen " failed : Resource temporarily unavailable. how can i fix this and use bear in freebsd

rizsotto commented 3 years ago

Hey @AimerYi , can you give me more context?

AimerYi commented 3 years ago

Hey @rizsotto this is freebsd version: 2021-05-24 14-59-20 的屏幕截图-1 problem: 2021-05-24 15-09-45 的屏幕截图

and this is the verbose log after run the command bear --verbose -- make 2021-05-24 15-06-37 的屏幕截图 2021-05-24 15-07-08 的屏幕截图 2021-05-24 15-07-25 的屏幕截图 2021-05-24 15-07-42 的屏幕截图 2021-05-24 15-07-59 的屏幕截图

rizsotto commented 3 years ago

Thanks @AimerYi for this.

void *handle = ::dlopen(LIBC_SO, RTLD_LAZY);
if (handle == nullptr) {
  return rust::Err(std::runtime_error(
    fmt::format("System call \"dlopen\" failed: {}", sys::error_string(errno))));
}

This is the fragment which cause the error... I presume the LIBC_SO definition is not available on FreeBSD. Can you confirm this? Or suggest a similar symbol to it? (For reference this is what the linux defines this.)

As a workaround I can suggest to use the compiler wrappers (instead of the preload). bear --force-wrapper -- make is the way to use it.

AimerYi commented 3 years ago

@rizsotto sorry i just use freebsd to get it's kernel's compile_commands.json.I don't know how to confirm it. and if i use bear --force-wrapper -- make to finish the make ,the file: "compile_commands.json" have nothing....

rizsotto commented 3 years ago

@AimerYi could you test this for me?

AimerYi commented 3 years ago
rizsotto commented 3 years ago

Yay, that's a good news... Is this a virtual machine that you can increase the size of the memory? Or can you increase the size of the swap space? Or check if you are running the build parallel and reduce the parallelism to lower the number of processes running at the same time?

Otherwise we need to go into the details... Check the allocation of Bear processes? (it's intercept, citnames and bear) Check how much memory you have? How much parallelism do you use? In order to fix this, I need to know these to reproduce the problem.

But thank you to try out those changes. I think we are close to get a compilation database for you! :smile:

AimerYi commented 3 years ago

@rizsotto after increse the memory to 2GB ,the bear can work without any error ,thank u very much ,have a nice day!