Ahh, I understand... It should be building a shared object not an executable.

Thank makes sense... Duh. I guess I thought Inline would know how to do that implicitly. Not on OS X yet it seems. So I have to tell Inline how to compile a shared object on OS X.

The option -shared is not supported on Mac OS X according to `man gcc`

After reading `man ld` a bit, I needed to add:

        -bundle
        -bundle_loader <EXE>

.. to LDDFLAGS. <EXE> is the executable that will load the bundle we're compiling (strange). For me, that's /sw/bin/perl. I'll make that determination generic later.

So It's "working" now.  Thanks for the help!

Brian




Peter Sinnott wrote:
On Tue, Oct 11, 2005 at 01:44:28PM -0400, Brian Hammond wrote:

Anyone got a clue on this?



I tried building on linux at the time but couldn't quite get it to work.
After another quick look today it seems your problem may be solved by
adding --shared to LDDLFLAGS. For my install( and maybe yours ) Inline
seems to be telling gcc to build an executable when it should
be telling it to build a shared lib ( Undefined symbols: _main ).

With --share added the error messages reduce to
Can't load '/tmp/_Inline/lib/auto/GLFW_ae09/GLFW_ae09.so' for module
GLFW_ae09: /tmp/_Inline/lib/auto/GLFW_ae09/GLFW_ae09.so: undefined
symbol: XF86VidModeQueryExtension at /usr/lib/perl/5.8/DynaLoader.pm
line 225.
 at /usr/local/share/perl/5.8.2/Inline.pm line 500

which seems to be because libXxf86vm is not being included. Can not for the life of me manage to convince gcc to include it.



On 10/3/05 10:50 AM Brian Hammond wrote:

Hello -

This is my first time using Inline.

I am trying to autowrap a C library called GLFW using Inline C (0.44) on Mac OS X. GLFW is a very nice cross-platform OpenGL Framework. It deals with the system issues and gets out of the way of your OpenGL app. Once I get this working I plan on wrapping a few other libraries and making a decent framework for developing games in Perl (ala PyGame for Python, but for 3D).

GLFW is built as a static library (libglfw.a) and is installed in the usual location (/usr/local/lib). GCC finds it without issue. I am having an issue however. To use OpenGL on Mac OS X "natively" (read: not through X11), one must link using the -framework OpenGL option to GCC. You'll also end up needing -framework AGL (Apple OpenGL) and -framework Carbon (GLFW uses Carbon on Mac OS X).

So I have GLFW.pm at the moment compiling fine but failing to find certain symbols that I find strange:

ld: Undefined symbols:
_main
_Perl_Gthr_key_ptr
_Perl_Isv_yes_ptr
_Perl_Tcurpad_ptr
_Perl_Tmarkstack_ptr_ptr

<snip>

Note that I have to use LDDLFLAGS for the -framework options and not LIBS as I get "unknown option to LIBS: -framework" otherwise.

To make this easy for someone to help me, here's how to set this all up:

* Download and install GLFW on Mac OS X 10.3 (I am running 10.3.9)

http://easynews.dl.sourceforge.net/sourceforge/glfw/glfw-2.5.0.tar.bz2

make macosx-gcc

sudo mkdir -p /usr/local/lib

sudo cp libglfw.a /usr/local/lib

sudo ranlib /usr/local/lib/libglfw.a

sudo mkdir -p /usr/local/include/GL

sudo cp glfw.h /usr/local/include/GL

* Download my script (didn't want to make this email *too* big):

http://brianhammond.com/perl/GLFW.pm
http://brianhammond.com/perl/glfw-test.pl

* Try my script

perl -MInline=FORCE,NOISY ./glfw-test.pl


Let me know if you have any insights on this!

Thanks, Brian H.

PS - I'm not sure it matters but I am using Fink's perl in /sw/bin/perl which is Perl 5.8.6

$ which perl
/sw/bin/perl

$ perl -v
This is perl, v5.8.6 built for darwin-thread-multi-2level





Reply via email to