I'm trying to build my openGL project, all worked well until I tried to use the SOIL library (http://www.lonesock.net/soil.html) for loading textures from images. This library comes with a SOIL.h and a libSOIL.a files.
That's what I get when doing make:
g++ -I./src -Wl,-rpath,./lib -O3 -g -c -o src/main.o src/main.cpp
g++ -I./src -Wl,-rpath,./lib -O3 -g -c -o src/file_ply_stl.o src/file_ply_stl.cpp
g++ -I./src -Wl,-rpath,./lib -O3 -g -c -o src/Proyecto.o src/Proyecto.cpp
g++ -I./src -Wl,-rpath,./lib -O3 -g -c -o src/Clock.o src/Clock.cpp
g++ -I./src -Wl,-rpath,./lib -O3 -g -c -o src/utils.o src/utils.cpp
...
g++ -I./src -Wl,-rpath,./lib -O3 -g -c -o src/primitives/cilindro.o src/primitives/cilindro.cpp
g++ -I./src -Wl,-rpath,./lib -O3 -g -c -o src/primitives/cono.o src/primitives/cono.cpp
g++ -I./src -Wl,-rpath,./lib -O3 -g -o app -L./lib src/main.o src/file_ply_stl.o src/Proyecto.o src/Clock.o src/utils.o src/Window.o src/Light.o src/Material.o src/PlyModel.o src/Placeable.o src/Moveable.o src/Model.o src/Texture.o src/Geometry.o src/TriGeometry.o src/TriIndGeometry.o src/Entity.o src/Camera.o src/Bounded.o src/Animatable.o src/Scene.o src/Graphics.o src/Vert.o src/Path.o src/Ant.o src/Tank.o src/Chess.o src/primitives/tetra.o src/primitives/cubo.o src/primitives/cilindro.o src/primitives/cono.o -lsfml-window -lsfml-system -lX11 -lXext -lXmu -lXi -lXt -lSM -lICE -lGLU -lGL -lglut -lSOIL
src/Texture.o: In function `Texture::ini(char const*)':
/home/roger/t/ig/prac/proyecto/src/Texture.cpp:9: undefined reference to `SOIL_load_OGL_texture'
collect2: ld devolvió el estado de salida 1
make: *** [app] Error 1
And that's my Makefile:
TARGET = app
MODULES = src/main.o src/file_ply_stl.o src/Proyecto.o src/Clock.o src/utils.o
ENGINE = src/Window.o src/Light.o src/Material.o src/PlyModel.o src/Placeable.o src/Moveable.o src/Model.o src/Texture.o src/Geometry.o src/TriGeometry.o src/TriIndGeometry.o src/Entity.o src/Camera.o src/Bounded.o src/Animatable.o src/Scene.o src/Graphics.o src/Vert.o
GAME = src/Path.o src/Ant.o src/Tank.o
PRIMITIVES = src/Chess.o src/primitives/tetra.o src/primitives/cubo.o src/primitives/cilindro.o src/primitives/cono.o
CXX = g++
LIBDIR = ./lib
INCDIR = ./src
LIBS = -lsfml-window -lsfml-system -lX11 -lXext -lXmu -lXi -lXt -lSM -lICE -lGLU -lGL -lglut -lSOIL
LDFLAGS = -L$(LIBDIR)
CXXFLAGS = -I$(INCDIR) -Wl,-rpath,$(LIBDIR) -O3 -g
$(TARGET): $(MODULES) $(ENGINE) $(GAME) $(PRIMITIVES)
$(CXX) $(CXXFLAGS) -o $(TARGET) $(LDFLAGS) $(MODULES) $(ENGINE) $(GAME) $(PRIMITIVES) $(LIBS)
clean:
rm -f $(MODULES) $(ENGINE) $(GAME) $(PRIMITIVES) $(TARGET)
And that's my file hierachy:
.:
lib Makefile src
./lib:
libsfml-audio.so libsfml-graphics.so.2.0 libsfml-system.so.2 libSOIL.a
libsfml-audio.so.2 libsfml-network.so libsfml-system.so.2.0 libSOIL.a.1
libsfml-audio.so.2.0 libsfml-network.so.2 libsfml-window.so libSOIL.a.1.0
libsfml-graphics.so libsfml-network.so.2.0 libsfml-window.so.2
libsfml-graphics.so.2 libsfml-system.so libsfml-window.so.2.0
./src:
Animatable.cpp Clock.cpp Light.cpp Moveable.h random.h TriGeometry.h
Animatable.h Clock.h Light.h Path.cpp Scene.cpp TriIndGeometry.cpp
Ant.cpp Entity.cpp main.cpp Path.h Scene.h TriIndGeometry.h
Ant.h Entity.h main.h Placeable.cpp SFML utils.cpp
Bounded.cpp file_ply_stl.cpp Material.cpp Placeable.h SOIL utils.h
Bounded.h file_ply_stl.h Material.h PlyModel.cpp Tank.cpp Vert.cpp
Camera.cpp Geometry.cpp matrix.h PlyModel.h Tank.h vertex.h
Camera.h Geometry.h Model.cpp primitives Texture.cpp Vert.h
Chess.cpp Graphics.cpp Model.h Proyecto.cpp Texture.h Window.cpp
Chess.h Graphics.h Moveable.cpp Proyecto.h TriGeometry.cpp Window.h
./src/primitives:
...
./src/SFML:
...
./src/SFML/Audio:
...
./src/SFML/Graphics:
...
./src/SFML/Network:
...
./src/SFML/System:
...
./src/SFML/Window:
...
./src/SOIL:
SOIL.h
I don't know what's going on, and why the compiler doesn't find the library file.
I've got #include "SOIL/SOIL.h" in Texture.h and the call to SOIL_load_OGL_texture in Texture.cpp:9, that's the name on the function as defined in SOIL.h. ¿What I am doing bad?
EDIT
I was using the library provided, I compiled it myself and it worked.
I must write down this answer when I compile the SOIL library even the question is asked 4 year ago, because it is so hard to write the CMakeLists.txt myself before I find the CMakeLists.txt.
the CMakeLists.txt
cmake_minimum_required (VERSION 2.6)
project (SOIL)
set (SOIL_BUILD_TESTS false CACHE BOOL "Build tests")
if(ANDROID)
# Android requires GL ES 2.0 package automatically
set(LIBRARIES GLESv2)
else()
find_package (OpenGL REQUIRED)
include_directories (${OPENGL_INCLUDE_DIR})
set(LIBRARIES ${OPENGL_LIBRARIES})
endif()
file (GLOB SOIL_SOURCES src/*.c)
file (GLOB SOIL_HEADERS src/*.h)
add_library (SOIL ${SOIL_SOURCES} ${SOIL_HEADERS})
target_link_libraries (SOIL ${LIBRARIES})
install (TARGETS SOIL
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install (FILES ${SOIL_HEADERS} DESTINATION include/SOIL)
if (SOIL_BUILD_TESTS)
add_executable (test_SOIL src/test_SOIL.cpp)
target_link_libraries (test_SOIL SOIL)
install (TARGETS SOIL test_SOIL RUNTIME DESTINATION bin)
endif ()
Related
I have this target that compiles ok.
#
file(GLOB SOURCE_FILES
8021QBG/*.h
8021QBG/*.cpp
)
add_library(8021qbg SHARED
${SOURCE_FILES}
)
set_target_properties(8021qbg PROPERTIES LINKER_LANGUAGE CXX)
set(CMAKE_CXX_FLAGS_CUSTOM " ")
set_target_properties(8021qbg PROPERTIES COMPILE_FLAGS " ${CMAKE_CXX_FLAGS_CUSTOM} ${CMAKE_CXX_FLAGS_COMMON}")
add_dependencies(8021qbg core )
target_link_libraries(8021qbg -L${PROJECT_BINARY_DIR})
target_link_libraries(8021qbg -L/home/user/protocol_so )
target_link_libraries(8021qbg -L${PROJECT_SOURCE_DIR}/lib64 )
target_link_libraries(8021qbg -L${PROJECT_SOURCE_DIR})
target_link_libraries(8021qbg protocol_common thread vip core m xml2)
target_include_directories(8021qbg PUBLIC
8021QBG
nte-encap
)
and this that fails.
#
file(GLOB SOURCE_FILES
Agent/*.h
Agent/*.cpp
)
add_library(agent SHARED
${SOURCE_FILES}
)
set_target_properties(agent PROPERTIES LINKER_LANGUAGE CXX)
set(CMAKE_CXX_FLAGS_CUSTOM " ")
set_target_properties(agent PROPERTIES COMPILE_FLAGS " ${CMAKE_CXX_FLAGS_CUSTOM} ${CMAKE_CXX_FLAGS_COMMON}")
add_dependencies(agent core)
target_link_libraries(agent -L${PROJECT_BINARY_DIR})
target_link_libraries(agent -L/home/user/protocol_so )
target_link_libraries(agent -L${PROJECT_SOURCE_DIR}/lib64 )
target_link_libraries(agent -L${PROJECT_SOURCE_DIR})
target_link_libraries(agent protocol_common thread vip core xml2 pthread)
target_include_directories(agent PUBLIC
Agent
nte-encap
)
Also these targets have the same flags:
set (CMAKE_CXX_FLAGS_COMMON "-g -fpermissive -std=gnu89 -Wall -O0 -m64 -fPIC -DLINUX -DCPU_64 -DXSTREAM ")
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--unresolved-symbols=ignore-in-shared-libs -shared -Wl,-rpath,/home/user/protocol_so:/home/user/cmake_libs/lib64:libwifi")
if(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
endif()
This is linker stage
/usr/bin/g++ -fPIC -g -Wl,--unresolved-symbols=ignore-in-shared-libs -shared -Wl,-rpath,/home/user/protocol_so:/home/user/cmake_libs/lib64:libwifi -shared -Wl,-soname,libagent.so -o libagent.so CMakeFiles/agent.dir/Agent/agent_common.cpp.o CMakeFiles/agent.dir/Agent/agent_main.cpp.o CMakeFiles/agent.dir/Agent/agent_client.cpp.o CMakeFiles/agent.dir/Agent/agent_cmd.cpp.o CMakeFiles/agent.dir/Agent/agent_go.cpp.o -L/home/user/cmake_libs/cmake-build-debug-rurem -L/home/user/protocol_so -L/home/user/cmake_libs/lib64 -L/home/user/cmake_libs -lprotocol_common -lthread -lvip libcore.so -lxml2 -lpthread -L/home/user/cmake_libs/lib64 -lprotocol_common -lthread -lvip -lcrypto -lglib-2.0 -lm -lxml2 -lpthread -Wl,-rpath,/home/user/cmake_libs/cmake-build-debug-rurem
This is error codes
/home/user/cmake_libs/Agent/agent_main.cpp:47: undefined reference to `agent_client_register'
/home/user/cmake_libs/Agent/agent_main.cpp:48: undefined reference to `agent_client_unregister'
/home/user/cmake_libs/Agent/agent_main.cpp:49: undefined reference to `agent_client_register_task'
/home/user/cmake_libs/Agent/agent_main.cpp:50: undefined reference to `agent_client_unregister_task'
Cmake compiles each *.cpp file to *.o object and than linker combine them in one *.so lib -> in the linker stage I got this error.
Sources located in "Agent" folder and I add it to the target 'agent'.
UDP>
simple makefile and GCC build this library.
makefile part:
libagent.so: ${wildcard Agent/*.[c,h]} libcore.so
$(CC) $(CFLAGS) -fPIC -shared -o $# $(filter %.c,$^) $(IPATH) $(RPATH) $(TE_VIP) -lcore -lxml2 -lpthread
gcc command
gcc -g -Wall -O0 -m64 -Wl,--unresolved-symbols=ignore-in-shared-libs -fPIC -shared -o libagent.so -Inte-include -Ixst_inc -Ixst_tls -L./lib64 -L./cmake-build-debug-rurem -Wl,-rpath,/home/user/protocol_so:/home/user/lib64:libwifi -DLINUX -DCPU_64 -DXSTREAM -lprotocol_common -lthread -lvip -lcore -lxml2 -lpthread
UDP#2.
on arm machine with gcc v9.1.0 it builds successfully via makefile.
on x86 machine with gcc v4.3.4 I have such undefined referencies.
this is compiling command
g++ -g -Wall -O0 -m64 -Wl,--unresolved-symbols=ignore-in-shared-libs -fPIC -shared -o 0libagent.so -Inte-include -Iinc -Itls -L/home/user/cmake_libs/lib64 -L/home/user/cmake_libs -Wl,-rpath,/home/user/protocol_so:/home/user/cmake_libs/lib64:libwifi -DLINUX -DCPU_64 -DXSTREAM -lprotocol_common -lthread -lvip -lcore -lxml2 -lpthread Agent/agent_main.cpp Agent/agent_cmd.cpp Agent/agent_client.cpp Agent/agent_go.cpp Agent/agent_common.cpp
This is piece of agent_main.cpp that causes errors:
This is function that defined in agent_client.cpp that causes undefined reference
UPD#3
nm says that definitions are in objects.
> nm CMakeFiles/agent.dir/Agent/agent_client.cpp.o
...
00000000000007e2 T _Z21agent_client_registeriP20_protocol_callback_t
0000000000000000 T _Z21agent_client_run_taskiPv
0000000000000033 T _Z22agent_client_do_actionPviS_S_
...
x86 machine - SUSE 11 sp3 x64
Why it fails?
How to fix it?
The main point was not in cmake, and even not in make commands. I think this is about gcc versions support. On x86 I have gcc v4.3.4.
As #AlexCohn said in the comments
I would try to declare agent_client_register() and the rest of them as
extern "C" in agent_client.h and make sure this header is included in
both agent_client.cpp and agent_main.cpp
This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 5 years ago.
I am trying to compile a FLTK project from linux, using the output of the commands:
fltk-config --use-gl --use-images --ldflags
And:
fltk-config --use-gl --use-images --cxxflags
I am using this makefile to compile the project:
I installed the latest FLTK version by just downloading it from fltk.org, and then I compiled and installed it. I also installed X11 and OpenGL. But I still get these errors:
I checked the file system and these headers are in /usr/local/include/FL even if they are not recognized, although I included the directory (-I/usr/local/include) and then in the .cpp and .h files:
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_Box.H>
etc...
What could be the problem? do I need to install more libraries?
EDIT
I tried to change the makefile:
CXXFLAGS=-I/usr/local/include -I/usr/local/include/FL/images -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -I/home/ramy/boost_1_63_0 -std=c++11
LDFLAGS=-L/usr/local/lib -lfltk_images -lfltk_png -lz -lfltk_jpeg -lfltk_gl -lGLU -lGL -lfltk -lXrender -lXcursor -lXfixes -lXext -lXinerama -lpthread -ldl -lm -lX11 -L/home/ramy/boost_1_63_0/lib
SOURCES=Car.cpp Map.cpp CarState.cpp Utilities.cpp CarCollection.cpp TableView.cpp MapView.cpp
OBJECTS=Car.o Map.o CarState.o Utilities.o CarCollection.o TableView.o MapView.o
make:
g++ $(LDFLAGS) $(CXXFLAGS) -c $(SOURCES)
g++ $(LDFLAGS) $(CXXFLAGS) -o ../Evolution table-example.cpp $(OBJECTS)
clean:
rm -f $(OBJECTS) ../Evolution
But I still get the same errors.
Those errors don't mean that you are lacking headers, but libraries.
Here you can read the basis (go down to "Compiling Programs with Standard Compilers").
Basically add -L/usr/local/lib -lfltk -lXext -lX11 -lm to your app compiler command; or use fltk-config --cxxflags.
Downloaded the code from this source: http://n.ethz.ch/~vartokb/gl-shaders.html
I run the make file and I get undefined references to xlib and glut libraries. e.g.,
undefined reference to `XOpenDisplay'
undefined reference to `XDefaultScreen'
undefined reference to `glXChooseVisual'
.
.
.
undefined reference to `__glewGenBuffers'
undefined reference to `__glewBindBuffer'
undefined reference to `__glewBufferData'
The compile line looks like this and the makefile is below:
g++ -L/usr/include/GL/ -L/usr/include/X11/ -lm -lrt -lglut -lGLEW -lGL -lGLU -lX11 main.o events.o graphics.o -o gl-shaders
The Makefile:
NAME = gl-shaders
CXX = g++
CXXFLAGS = -O3
LDFLAGS = -L/usr/include/GL/ -L/usr/include/X11/ -lm -lrt -lglut -lGLEW -lGL -lGLU -lX11
SRCS = main.cpp events.cpp graphics.cpp
OBJS = $(SRCS:%.cpp=%.o)
HDRS = config.hpp main.hpp
all: $(NAME)
$(NAME): $(OBJS)
$(CXX) $(LDFLAGS) $(OBJS) -o $(NAME)
.cpp.o:
$(CXX) $(CFLAGS) $(LFLAGS) -c $< -o $#
$(OBJS): $(HDRS)
clean:
rm -f $(OBJS)
rm -f $(NAME)
I have installed Xlib by running:
sudo aptitude install xorg-dev
sudo apt install xorg-dev
sudo apt-get install libx11-dev
And I installed freeglut a while ago. When I list the contents of the directories linked in the makefile I see:
:l /usr/include/GL/
freeglut_ext.h freeglut_std.h glew.h gl.h glu.h glut.h glxext.h glxint.h glxmd.h glxtokens.h wglew.h
freeglut.h glcorearb.h glext.h gl_mangle.h glu_mangle.h glxew.h glx.h glx_mangle.h glxproto.h internal/
and for Xlib:
l /usr/include/X11/
ap_keysym.h Constraint.h DECkeysym.h HPkeysym.h IntrinsicP.h RectObj.h ShellI.h TranslateI.h Xatom.h Xdmcp.h XKBlib.h Xmd.h Xpoll.h Xthreads.h Xwindows.h
bitmaps/ ConvertI.h dri/ ICE/ keysymdef.h RectObjP.h ShellP.h VarargsI.h Xauth.h XF86keysym.h XlibConf.h Xmu/ Xproto.h Xtos.h Xwinsock.h
CallbackI.h Core.h EventI.h ImUtil.h keysym.h ResConfigP.h SM/ Vendor.h Xaw/ Xft/ Xlib.h Xosdefs.h Xprotostr.h Xtrans/
Composite.h CoreP.h extensions/ InitialI.h Object.h ResourceI.h StringDefs.h VendorP.h Xcms.h Xfuncproto.h Xlibint.h Xos.h Xregion.h Xutil.h
CompositeP.h CreateI.h fonts/ Intrinsic.h ObjectP.h SelectionI.h Sunkeysym.h Xalloca.h Xcursor/ Xfuncs.h Xlib-xcb.h Xos_r.h Xresource.h Xw32defs.h
ConstrainP.h cursorfont.h HookObjI.h IntrinsicI.h PassivGraI.h Shell.h ThreadsI.h Xarch.h Xdefs.h X.h Xlocale.h xpm.h xshmfence.h XWDFile.h
Why do I get undefined references when I have all the required files for compilation?
My problem was parameter ordering, as user cyberguijarro points out over here: Linker problems in Ubuntu 11.10
#boto I know that. Actually, the problem was in the parameter order.
Ubuntu 11.10 ships GCC 4.6.1, which apparently introduces stricter
parameter ordering constraints. g++ test.cpp -lX11 works fine. –
cyberguijarro Jan 24 '12 at 9:37
So by changing the compile line from this:
g++ -I/usr/include/GL/ -lglut -lGL -lGLEW -lGLU -I/usr/include/X11/ -lm -lrt -lX11 main.o events.o graphics.o -o gl-shaders
to this:
g++ main.o events.o graphics.o -I/usr/include/GL/ -lglut -lGL -lGLEW -lGLU -I/usr/include/X11/ -lm -lrt -lX11 -o gl-shaders
allowed it to compile.
I have an SDL game I have been working on as my first somewhat real project. I decided to introduce Box2D physics as I was not happy with the collision detection. So I installed it to /usr/local/lib/Box2D and in the folder is Box2D.h and supporting folders. I am using MacVim to code on OSX 10.9.2 to develop, and clang++ compiler from the command line.
In my game code I am just trying to create a simple world to test things out:
#include <Box2D/Box2D.h>
.......
world = new b2World(b2Vec2(0.0,9.81));
My make command finds the library, but errors out trying to build.
$ make clean && make
rm -rf obj bin
clang++ -Wall -c -std=c++11 -I/usr/local/lib src/Ball.cpp -o obj/Ball.o
clang++ -Wall -c -std=c++11 -I/usr/local/lib src/Game.cpp -o obj/Game.o
clang++ -Wall -c -std=c++11 -I/usr/local/lib src/Paddle.cpp -o obj/Paddle.o
clang++ -Wall -c -std=c++11 -I/usr/local/lib src/TextureManager.cpp -o obj/TextureManager.o
clang++ -Wall -c -std=c++11 -I/usr/local/lib src/main.cpp -o obj/main.o
clang++ -framework SDL2 -framework SDL2_image -F /Library/Frameworks -L/usr/local/lib/Box2D obj/Ball.o obj/Game.o obj/Paddle.o obj/TextureManager.o obj/main.o -o bin/game
Undefined symbols for architecture x86_64:
"b2World::b2World(b2Vec2 const&)", referenced from:
Game::init() in Game.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [game] Error 1
And here is my Makefile. Box2D is in /usr/local/lib/Box2D/Box2D.h. I am pretty sure my issue is somewhere in the Makefile.
CXX = clang++
CXXFLAGS = -Wall -c -std=c++11 -I/usr/local/lib
SDL = -framework SDL2 -framework SDL2_image
LDFLAGS = $(SDL) -F /Library/Frameworks -L/usr/local/lib/Box2D
SRC_DIR = src
SOURCES = $(wildcard $(SRC_DIR)/*.cpp)
OBJ_DIR = obj
OBJECTS = $(subst $(SRC_DIR)/, $(OBJ_DIR)/, $(patsubst %.cpp, %.o, $(SOURCES)))
#$(warning $(OBJECTS))
BIN_DIR = bin
EXE = game
# run these no matter what
.PHONY: all clean run
all: $(EXE)
$(EXE): $(OBJECTS)
#mkdir -p $(BIN_DIR)
$(CXX) $(LDFLAGS) $(OBJECTS) -o $(BIN_DIR)/$(EXE)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
#mkdir -p $(OBJ_DIR)
$(CXX) $(CXXFLAGS) $< -o $#
clean:
rm -rf obj bin
run:
./$(BIN_DIR)/$(EXE)
It does not appear that you ever actually link the Box2D library anywhere? You use -L to specify directories to search while linking, but I don't see a -l option to actually link the Box2D library (whatever it's called).
Your output line seems to bear this out:
clang++ -framework SDL2 -framework SDL2_image -F /Library/Frameworks -L/usr/local/lib/Box2D obj/Ball.o obj/Game.o obj/Paddle.o obj/TextureManager.o obj/main.o -o bin/game
You need to get -lbox2d (or whatever the correct name for the Box2D library is) in there.
I'm trying to compile a OpenGL program on my MacBook and can't figure out how to convert this makefile.
CFLAGS= -I/usr/X11R6/include -I/usr/local/include
LDFLAGS= -L/usr/X11R6/lib -L/usr/local/lib -lGL -lGLU -lm -lglut
BINARIES=q2
all: $(BINARIES)
clean:
-rm *.o $(BINARIES)
q2 : q2.o
g++ $(LDFLAGS) $^ -o q2
q2.o: q2.cpp
g++ -c $(CFLAGS) q2.cpp
depend:
makedepend *.cpp
Change the source code
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
Don't include GL.h or GLU.h. glut.h should pull them for you regardless of the platform.
And change your Makefile
CFLAGS=
LDFLAGS= -framework GLUT -framework OpenGL -framework Cocoa
Note that I was also able to build something using your original Makefile but I think that's because I have Apple X11 installed.