Hello,
I recently got started with gradle for c++ and seems great. However, I yet wasn’t able to debug my app with GDB. So, here is my simple app:
apply plugin: 'cpp'
model {
components {
hello(NativeLibrarySpec) {
binaries.all {
cppCompiler.define "HELLO_EXPORT"
}
}
main(NativeExecutableSpec) {
binaries.all {
lib library: "hello"
cppCompiler.args "-g"
}
}
}
}
Basically, I got a main at src/main/cpp and a module at src/hello/cpp. I’m simply trying to compile this project with the argument -g in order to be able to debug it with GDB. So I just installed the project with gradle clean build installMainExecutable
and it was succesfull, I can actually run my application with ./build/install/main/main
, however this main is a script, so I can’t use gdb on it, so I tried to run gdb with ./build/install/main/lib/main and it loads succesfully, however when I actually run the program, gdb says it could not find the shared libraries: error while loading shared libraries: libhello.so
.
So, what am I getting wrong? Is there a way of debugging with that main shell script? Or should I just keep looking on how to load the shared libraries “by hand” with GDB?
Best Regards, Ernani