The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.
SDL
Simple Directmedia Layer Forums
SDL Linkage problems
Almamu
Joined: 16 Jan 2015
Posts: 1
Posted: Tue Jan 20, 2015 3:24 pm
I'm working on a medium-sized game that targets platforms like Windows, Linux, MacOSx, Nintendo DS and PlayStationPortable, I'm actually working on the Linux build system for the game code and I'm stuck with the linkage of SDL.
The game is developed under the Nintendo DS (as is the one that has less power) and is re-compiled for better platforms. The build system (based in Makefiles) works like a charm for DS and without any problem, I can also compile for Windows (under Visual Studio) and run exactly the same code as Linux (so It's not really a problem with the way I include things or link libs, at least that's what I think).
The Makefiles I'm using for the Linux are a modified version of the DS' Makefiles, so most of the build system should be working correctly (of course I've modified them to include needed libraries so It can link to SDL and custom libraries [some ported libraries from the DS that allow to port the game to different platforms as fast as possible]).
In my testing environment I'm using Ubuntu 14.04 with the needed development packages for SDL 1.2 (I've checked that libSDL.so exists on my system and SDL_* do, too). These are the lines generated by the Makefile to build the project and link them.
As you can see I've included the needed args to link the project with SDL (generated by sdl-config --libs) without any luck, this is the output of the linkage command:
Code:
/home/almamu/Escritorio/smash_tmp/smash/render/lib/librender.a(graphics.o): In function `R_PrecacheBackground(assetHeader_t*, unsigned char, unsigned char, bool)':
/home/almamu/Escritorio/smash_tmp/smash/render/win/source/graphics.cpp:492: reference to `SDL_CreateRGBSurface' not defined
/home/almamu/Escritorio/smash_tmp/smash/render/win/source/graphics.cpp:514: reference to `SDL_CreateRGBSurfaceFrom' not defined
/home/almamu/Escritorio/smash_tmp/smash/render/win/source/graphics.cpp:515: reference to `SDL_UpperBlit' not defined
/home/almamu/Escritorio/smash_tmp/smash/render/lib/librender.a(graphics.o): In function `R_UpdateBackground(background_t*)':
/home/almamu/Escritorio/smash_tmp/smash/render/win/source/graphics.cpp:568: reference to `SDL_UpperBlit' not defined
/home/almamu/Escritorio/smash_tmp/smash/render/lib/librender.a(graphics.o): In function `R_SetBackgroundVisibility(unsigned char, unsigned char, bool)':
/home/almamu/Escritorio/smash_tmp/smash/render/win/source/graphics.cpp:599: reference to `SDL_FillRect' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/lib/libnflib.a(nf_2d.o): In function `NF_Set2D(unsigned char, unsigned char)':
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/nf_2d.cpp:31: reference to `SDL_MapRGB' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/nf_2d.cpp:31: reference to `SDL_FillRect' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/lib/libnflib.a(nf_tiledbg.o): In function `NF_ResetTiledBgBuffers()':
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/nf_tiledbg.cpp:98: reference to `SDL_FreeSurface' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/lib/libnflib.a(keys.o): In function `scanKeys':
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/keys.c:22: reference to `SDL_PollEvent' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/keys.c:153: reference to `SDL_Quit' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/keys.c:22: reference to `SDL_PollEvent' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/lib/libnflib.a(video.o): In function `defaultExceptionHandler':
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:75: reference to `SDL_Init' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:81: reference to `SDL_SetVideoMode' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:87: reference to `SDL_EnableUNICODE' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:88: reference to `SDL_WM_SetCaption' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:94: reference to `SDL_MapRGB' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:95: reference to `SDL_SetColorKey' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:102: reference to `SDL_CreateRGBSurface' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:103: reference to `SDL_SetColorKey' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:108: reference to `SDL_CreateRGBSurface' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:111: reference to `SDL_FillRect' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:112: reference to `SDL_SetColorKey' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/lib/libnflib.a(video.o): In function `swiWaitForVBlank':
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:150: reference to `SDL_UpperBlit' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:163: reference to `SDL_UpperBlit' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:167: reference to `SDL_Flip' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:175: reference to `SDL_FillRect' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:184: reference to `SDL_GetTicks' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:189: reference to `SDL_Delay' not defined
/home/almamu/Escritorio/smash_tmp/smash/nflib/win/source/libnds/nds/arm9/video.c:192: reference to `SDL_GetTicks' not defined
These are the Makefiles used in the project build system
Rules.linux
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
include $(MKFILE_PATH)Rules.linux
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
TARGET := $(NFLIB_NAME)
BUILD := build
SOURCES := win/source win/source/libnds win/source/libnds/nds win/source/libnds/nds/arm9
DATA := data
INCLUDES := $(NFLIB_INC)
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
include $(MKFILE_PATH)Rules.linux
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
TARGET := $(RENDER_NAME)
BUILD := build
SOURCES := win/source
DATA := data
INCLUDES := $(RENDER_INC)
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(GAME_DIR)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
# Makefile for NightFox's Lib Projects
# Modified By Almamu
#
# Changelog:
# Support for paths defined from superior Makefiles added
# This should make the compilation more dynamic and easy to maintain
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
include $(MKFILE_PATH)Rules.linux
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
#---------------------------------------------------------------------------------
TARGET := $(GAME_NAME)
BUILD := build
SOURCES := source
INCLUDES := $(GAME_INC)
DATA := data
GRAPHICS := gfx
NITRODATA := nitrofiles
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -l$(RENDER_NAME) -l$(NFLIB_NAME)
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(NFLIB_DIR) $(RENDER_DIR)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
I'm completely out of ideas, the thing is that It should be linking correctly as the *.so files from libSDL are in the correct folder, and the packages are correctly installed, has anyone had the same problem or any idea of how I could fix it?