Dear all,
I'm trying to solve a link issue. I think that the solution is very simple, but I cannot reach this solution.
Let's start:
I'm trying to build an B.so that uses A.so.
A.so is compiled using C;
B.so is compiled using C++;
Inside "Aso.h" file I'had declared:
Code:
#ifdef __cplusplus
extern "C" {
#endif
int foo(int iFoo_param1, int iFoo_param2, int iFoo_param3);
#ifdef __cplusplus
}
#endif
The makefile is:
Quote:
gcc -Wall -fPIC -c ./src/Aso.c -O3
mv ./*.o ./lib/
gcc -shared -Wl,-soname,libA.so.1 -o ./lib/libA.so.1.0 ./lib/*.o
|
At this point everything is OK. Using the "nm" command I'm able to see that the foo function is defined with a "T" at the libAso.so.
The problem starts when I try to compile the B.so.
Inside "Bso.h" I have the Aso.h header file included (Aso.h is the same above):
Code:
#include "../include/Aso.h"
The makefile of Bso seems to be right:
Code:
g++ -Wall -fPIC -c ./src/Bso.cpp -O3
mv ./*.o ./lib/
g++ -shared -Wl,-soname,libBso.so.1 -o ./lib/libBso.so.1.0 ./lib/*.o -lAso
There's no error to compile that, this library seems to be compiled correctly, but using the "nm" command the Aso.so functions appear with "U" of undefined.
Trying to build an executable using the Bso.so library, I got this error:
/lib/../lib/libBso.so: undefined reference to `foo(int, int, int)'
I think that to solve this problem it's only link the Aso.so with the .o files generated at the compilation phase of my Bso.
Using the "ldd" command I'm able to see that Bso.so depends on Aso.so, so what am I missing?
I've made some google searches all day, but no success.
Could someone post a tip or a link to help me to solve this issue?
Thanks in advance.