google-code-export / la-pe

Automatically exported from code.google.com/p/la-pe
0 stars 0 forks source link

Statically linking ffi on OS X #35

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm attempting to compile la-pe on OS X. I realize you haven't really built 
support for this yet and you have a todo in the ffi.pas file to do Mac support, 
but I was just having a go at it.

I was able to change a few IFDEF's in order to get the project to compile 
however now I'm running into some linking issues. When set to dynamically link 
everything compiles and links fine (obviously because it's not trying to link 
ffi at compile time). However, when I set it to static linking I'm getting 
errors with the linking.

Undefined symbols for architecture i386:
  "_ffi_closure_free", referenced from:
      _INIT$_FFI in ffi.o
  "_ffi_prep_closure_loc", referenced from:
      _INIT$_FFI in ffi.o
  "_ffi_closure_alloc", referenced from:
      _INIT$_FFI in ffi.o
ld: symbol(s) not found for architecture i386
An error occurred while linking 

I've made an extra directory under extensions/ffi/bin named "darwin" because 
that is where the linker is pointing. And I've added libffi.a and libffi.dylib 
to that folder but it's not helping. Apparently the linker is not finding it.

Just in case, I did a symbol dump on libffi.dylib and was able to find 
ffi_closure_free, ffi_prep_closure_loc, and ffi_closure_alloc in the list. 
Another interesting thing is that it's not complaining about not being able to 
find ffi_prep_cif or ffi_call which are also referenced from ffi.pas.

I don't specifically think this is necessarily a la-pe problem, I'm more 
leaning towards it might be something weird with how OS X does linking but I 
was just wondering if you might have any info or places you might start 
investigating.

Original issue reported on code.google.com by willtca...@gmail.com on 22 Sep 2014 at 7:05

GoogleCodeExporter commented 9 years ago
Did you compile ffi yourself? Or are you using pre-built binaries?

Original comment by Dgby...@gmail.com on 28 Sep 2014 at 3:37

GoogleCodeExporter commented 9 years ago
I compiled it myself

Original comment by willtca...@gmail.com on 28 Sep 2014 at 7:23

GoogleCodeExporter commented 9 years ago
It seems like your libffi doesn't support closures, what version are you 
compiling?

Original comment by Dgby...@gmail.com on 2 Oct 2014 at 2:18

GoogleCodeExporter commented 9 years ago
I had grabbed the most recent version from their website, 
https://sourceware.org/libffi/. So version 3.1

Original comment by willtca...@gmail.com on 2 Oct 2014 at 3:18

GoogleCodeExporter commented 9 years ago
Might have to look into if libffi supports closures on Mac.

Original comment by Dgby...@gmail.com on 23 Oct 2014 at 4:29

GoogleCodeExporter commented 9 years ago
Or maybe you forgot some compile options?

Original comment by Dgby...@gmail.com on 23 Oct 2014 at 4:31