Page 1 of 1

[PB 5.46 LTS x64] DONE! Undefined symbols for architecture

Posted: Wed Feb 07, 2018 3:46 pm
by Kukulkan
Hi,

I just try to compile my project on MacOS 10.13 (High Sierra) using PB 5.46 LTS x64. The project compilation fails by this error:

Code: Select all

Error: Linker
Undefined symbols for architecture x86_64:
  "__error", referenced from:
      _EndIf36 in purebasic.o
      PStub__error in purebasic.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The project also links some own curl compilation, but I think the line "_EndIf36 in purebasic.o" points me to a PB related issue.

Any idea how I can solve this? Sadly it is urgent :(

Re: [PB 5.46 LTS x64] Undefined symbols for architecture x86

Posted: Wed Feb 07, 2018 4:28 pm
by Kukulkan
It just turned out that it happens in our own implementation for iconv. There we import the function errno_location():

Code: Select all

ImportC ""
  errno_location() As "__error"
EndImport
This seem to fail in my configuration. I know that it worked before using PB 5.24 LTS and x32. Any idea how to solve this?

The original code was here: http://www.purebasic.fr/english/viewtop ... 13&t=62723

Re: [PB 5.46 LTS x64] DONE! Undefined symbols for architectu

Posted: Wed Feb 07, 2018 5:27 pm
by Kukulkan
Okay, I finally found the issue.

I tried to find the symbol from libc and got a list of all symbols with "error" from within the dylib by using this line:

Code: Select all

nm -gU /usr/lib/libc.dylib | grep error
I found that the symbol I need is having three _ for the name: ___error instead of __error.

Upon I changed the import to this, also the x64 version is compiling in both PB 5.46 LTS and older 5.24 LTS. Finally, you have to do it like this:

Code: Select all

ImportC ""
  errno_location() As "___error" ; use triple underscore!
EndImport