PDA

View Full Version : Link Swipl




Ti_Poussin
Mar 4, 2008, 08:32 PM
Hi, I run into some trouble with linking an OpenGl, Glut interface with swipl from http://www.swi-prolog.org/

I have make the change to the the code file:
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <GLUT/glut.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glu.h>
#endif

The build is made using this command:
gcc -framework GLUT -framework OpenGL -shared -I/opt/local/lib/swipl-5.6.49/include -I/usr/include -I/opt/local/include -fPIC OpenGL.c -o OpenGL.so -L/opt/local/lib/swipl-5.6.49/lib/i386-darwin9.1.0 -L/usr/X11R6/lib -lXmu -L/System/Library/Frameworks/OpenGL.framework/Libraries -L/System/Library/Frameworks/GLUT.framework/Libraries -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib

But I get some error of linking:
Undefined symbols:
"_PL_get_pointer", referenced from:
_c_gluSphere in cc9651Uo.o
...
ld: symbol(s) not found

I'm not sure what is wrong, the code compile and run fine under Linux.



yeroen
Mar 4, 2008, 10:26 PM
Hi, I run into some trouble with linking an OpenGl, Glut interface with swipl from http://www.swi-prolog.org/

I have make the change to the the code file:
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <GLUT/glut.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glu.h>
#endif

The build is made using this command:
gcc -framework GLUT -framework OpenGL -shared -I/opt/local/lib/swipl-5.6.49/include -I/usr/include -I/opt/local/include -fPIC OpenGL.c -o OpenGL.so -L/opt/local/lib/swipl-5.6.49/lib/i386-darwin9.1.0 -L/usr/X11R6/lib -lXmu -L/System/Library/Frameworks/OpenGL.framework/Libraries -L/System/Library/Frameworks/GLUT.framework/Libraries -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib

But I get some error of linking:
Undefined symbols:
"_PL_get_pointer", referenced from:
_c_gluSphere in cc9651Uo.o
...
ld: symbol(s) not found

I'm not sure what is wrong, the code compile and run fine under Linux.

I noticed you're linking against an older version of swipl. The current version is 5.6.51. Just to double check, does the line

-L/opt/local/lib/swipl-5.6.49/lib/i386-darwin9.1.0

still refer to a valid path? That is, did you update your swipl installation and not change your link flags?

Ti_Poussin
Mar 5, 2008, 10:25 PM
I just check and yes the path is valid, maybe I will try to upgrade, maybe some Leopard fix in it. Anybody else see a problem or something I'm missing here?

Ti_Poussin
Mar 5, 2008, 10:32 PM
I just try to install the newest release without more success, change the path for the new one but still got the linking error, look like the glut libraries doesn't have every call or isn't right...

Undefined symbols:
"_PL_get_pointer", referenced from:
_c_gluSphere in cc4NJ7Eg.o
"_main", referenced from:
start in crt1.10.5.o
"_PL_get_atom_chars", referenced from:
_c_glDrawText in cc4NJ7Eg.o
_c_glutCreateWindow in cc4NJ7Eg.o
"_PL_put_integer", referenced from:
_c_glut_reshape in cc4NJ7Eg.o
_c_glut_reshape in cc4NJ7Eg.o
_c_glut_keyboard in cc4NJ7Eg.o
_c_glut_keyboard in cc4NJ7Eg.o
_c_glut_keyboard in cc4NJ7Eg.o
_c_glut_mouse in cc4NJ7Eg.o
_c_glut_mouse in cc4NJ7Eg.o
_c_glut_mouse in cc4NJ7Eg.o
_c_glut_mouse in cc4NJ7Eg.o
_c_glut_motion in cc4NJ7Eg.o
_c_glut_motion in cc4NJ7Eg.o
"_PL_get_integer", referenced from:
_c_glVertex2i in cc4NJ7Eg.o
_c_glVertex2i in cc4NJ7Eg.o
_c_glShadeModel in cc4NJ7Eg.o
_c_glBegin in cc4NJ7Eg.o
_c_glViewport in cc4NJ7Eg.o
_c_glViewport in cc4NJ7Eg.o
_c_glViewport in cc4NJ7Eg.o
_c_glViewport in cc4NJ7Eg.o
_c_glCallList in cc4NJ7Eg.o
_c_glClear in cc4NJ7Eg.o
_c_glEnable in cc4NJ7Eg.o
_c_glBlendFunc in cc4NJ7Eg.o
_c_glBlendFunc in cc4NJ7Eg.o
...
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [osx] Error 1

luismirandacruz
Dec 22, 2008, 06:48 AM
The option -shared "is not supported on Mac OS X." [man g++]

Cumps ;)