Undefined symbols during linking...

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Undefined symbols during linking...

Kustaa Nyholm
Hi,

my first time with SWIG but otherwise no noobie with C/C++ nor Java.

I'm on Mac OS with Xcode 6.4 in case that makes a difference.

I'm trying to access SgCode library with SWIG

http://www.geometros.com

This is what I do:

swig -java -c++ -I../sgCoreSDK/MacOS/sgCore/ SgCore.i
JAVA_HOME=`/usr/libexec/java_home`
CPPFLAGS="-c -fPIC -I $JAVA_HOME/include -I $JAVA_HOME/include/darwin -I ../sgCoreSDK/MacOS/sgCore"
echo $CPPFLAGS
gcc $CPPFLAGS SgCore_wrap.cxx
libtool -dynamic SgCore_wrap.o -o libSgCore_wrap.dylib ../sgCoreSDK/MacOS/sgCore/libsgCore64.dylib -lSystem


this results in four missing symbols:


Undefined symbols for architecture x86_64:
  "__Z15sgPrivateAccessiPvS_", referenced from:
      _Java_SgCoreJNI_sgPrivateAccess in SgCore_wrap.o
  "__ZdlPv", referenced from:
      _Java_SgCoreJNI_delete_1SG_1POINT in SgCore_wrap.o
      ...
  "__Znwm", referenced from:
      _Java_SgCoreJNI_new_1SG_1POINT in SgCore_wrap.o
      ...
  "___gxx_personality_v0", referenced from:
      Dwarf Exception Unwind Info (__eh_frame) in SgCore_wrap.o
ld: symbol(s) not found for architecture x86_64

because there are *only* these four missing symbols I suspect
that I'm missing something else than a missing library to link
against.

In file "sgDefs.h" is defined as:

void*    sgPrivateAccess(int, void*, void*);

If I list the functions in 'libsgCore64.dylib' with:

nm -g ../sgCoreSDK/MacOS/sgCore/libsgCore64.dylib

I do not see 'sgPrivateAccess' anywhere, but a demo
ObjC program linked against that library (and that
library only) builds and runs just fine.

The other three functions seem to have something to do
with memory allocation that SWIG has is referencing
or something...

I'm at loss how to debug this further.


Any pointers would be highly appreciated....

wbr Kusti









------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Undefined symbols during linking...

Kustaa Nyholm
>
> Undefined symbols for architecture x86_64:
>  "__Z15sgPrivateAccessiPvS_", referenced from:
>      _Java_SgCoreJNI_sgPrivateAccess in SgCore_wrap.o
>  "__ZdlPv", referenced from:
>      _Java_SgCoreJNI_delete_1SG_1POINT in SgCore_wrap.o
>      ...
>  "__Znwm", referenced from:
>      _Java_SgCoreJNI_new_1SG_1POINT in SgCore_wrap.o
>      ...
>  "___gxx_personality_v0", referenced from:
>      Dwarf Exception Unwind Info (__eh_frame) in SgCore_wrap.o
> ld: symbol(s) not found for architecture x86_64
>
> because there are *only* these four missing symbols I suspect
> that I'm missing something else than a missing library to link
> against.

Partially answering my own question:

adding '-lstdc++' to the libtool command solved everything except
undefined sgPrivateAccess.

Could it be this functions is actually missing and not used
and that with ObjC it does not matter if the symbol is missing?

But then again this library is cross platform and on Windows
it is used with C++ demo code so I would expect this
having surfaced before.

wbr Kusti


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Undefined symbols during linking...

Kustaa Nyholm

> On 7 Nov 2016, at 18:07, Kustaa Nyholm <[hidden email]> wrote:
>
>>
>> Undefined symbols for architecture x86_64:
>> "__Z15sgPrivateAccessiPvS_", referenced from:
>>     _Java_SgCoreJNI_sgPrivateAccess in SgCore_wrap.o
>> "__ZdlPv", referenced from:
>>     _Java_SgCoreJNI_delete_1SG_1POINT in SgCore_wrap.o
>>     ...
>> "__Znwm", referenced from:
>>     _Java_SgCoreJNI_new_1SG_1POINT in SgCore_wrap.o
>>     ...
>> "___gxx_personality_v0", referenced from:
>>     Dwarf Exception Unwind Info (__eh_frame) in SgCore_wrap.o
>> ld: symbol(s) not found for architecture x86_64
>>
>> because there are *only* these four missing symbols I suspect
>> that I'm missing something else than a missing library to link
>> against.
>
> Partially answering my own question:
>
> adding '-lstdc++' to the libtool command solved everything except
> undefined sgPrivateAccess.


Again answering my own post, adding '-undefined dynamic_lookup' to libtool
allows linking and thus produces the '.dylib'

Next try to see if it works.

wbr Kusti



------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user