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

Mac OSX specific forum
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

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

Post 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 :(
Last edited by Kukulkan on Wed Feb 07, 2018 5:24 pm, edited 1 time in total.
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

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

Post 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
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

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

Post 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
Post Reply