Statically linking

Hi everyone,

I work on Linux and use SDL and SDL_image. I have sdl on my machine, but I want
to lunch my program via ssh on dedicated calculus machines of the lab. And they
don’t have and don’t want to install sdl.

So I thought at linking statically sdl. I replaced this :
sdl-config --cflags --libs -lSDL_image
by this, in my makefile :
-Wl,-Bstatic -lSDL_image sdl-config --static-libs -Wl,-Bdynamic

But it do not want to compile anymore (unreferenced functions of SDL).

Is it wrong?

Also any other way of making the program work without needing to install libSDL
are welcome.

Thx

azer tyuiop writes:

But it do not want to compile anymore (unreferenced functions of SDL).

Post the undefined references, please.–
Alberto

I think it is to all calls of sdl functions. Here are all the errors I get at
building, thx in advance :

/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:124: undefined
reference to SDL_LockSurface' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:135: undefined reference toSDL_UnlockSurface’
src/core/SDL_gfxPrimitives.o: In function fastPixelRGBA(SDL_Surface*, short, short, unsigned char, unsigned char, unsigned char, unsigned char)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:150: undefined reference toSDL_MapRGBA’
src/core/SDL_gfxPrimitives.o: In function fastPixelRGBANolock(SDL_Surface*, short, short, unsigned char, unsigned char, unsigned char, unsigned char)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:168: undefined reference toSDL_MapRGBA’
src/core/SDL_gfxPrimitives.o: In function _putPixelAlpha(SDL_Surface*, short, short, unsigned int, unsigned char)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:207: undefined reference toSDL_MapRGB’
src/core/SDL_gfxPrimitives.o: In function pixelColor': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:353: undefined reference toSDL_LockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:364: undefined
reference to SDL_MapRGBA' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:375: undefined reference toSDL_UnlockSurface’
src/core/SDL_gfxPrimitives.o: In function pixelColorNolock(SDL_Surface*, short, short, unsigned int)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:393: undefined reference toSDL_MapRGBA’
src/core/SDL_gfxPrimitives.o: In function _filledRectAlpha(SDL_Surface*, short, short, short, short, unsigned int, unsigned char)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:435: undefined reference toSDL_MapRGB’
src/core/SDL_gfxPrimitives.o: In function filledRectAlpha(SDL_Surface*, short, short, short, short, unsigned int)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:586: undefined reference toSDL_LockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:597: undefined
reference to SDL_MapRGBA' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:608: undefined reference toSDL_UnlockSurface’
src/core/SDL_gfxPrimitives.o: In function pixelRGBA': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:682: undefined reference toSDL_MapRGBA’
src/core/SDL_gfxPrimitives.o: In function hlineColorStore(SDL_Surface*, short, short, short, unsigned int)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:764: undefined reference toSDL_LockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:813: undefined
reference to SDL_UnlockSurface' src/core/SDL_gfxPrimitives.o: In functionhlineColor’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:907: undefined
reference to SDL_MapRGBA' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:913: undefined reference toSDL_LockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:962: undefined
reference to SDL_UnlockSurface' src/core/SDL_gfxPrimitives.o: In functionvlineColor’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1068: undefined
reference to SDL_MapRGBA' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1074: undefined reference toSDL_LockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1122: undefined
reference to SDL_UnlockSurface' src/core/SDL_gfxPrimitives.o: In functionboxColor’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1443: undefined
reference to SDL_MapRGBA' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1449: undefined reference toSDL_LockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1511: undefined
reference to SDL_UnlockSurface' src/core/SDL_gfxPrimitives.o: In functionlineColor’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1588: undefined
reference to SDL_LockSurface' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1609: undefined reference toSDL_MapRGBA’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1728: undefined
reference to SDL_UnlockSurface' src/core/SDL_gfxPrimitives.o: In functionaalineColorInt(SDL_Surface*, short,
short, short, short, unsigned int, int)’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1855: undefined
reference to SDL_LockSurface' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:1958: undefined reference toSDL_UnlockSurface’
src/core/SDL_gfxPrimitives.o: In function circleColor': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:2050: undefined reference toSDL_LockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:2071: undefined
reference to SDL_MapRGBA' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:2123: undefined reference toSDL_UnlockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:2181: undefined
reference to SDL_UnlockSurface' src/core/SDL_gfxPrimitives.o: In functionarcColor’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:2278: undefined
reference to SDL_LockSurface' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:2409: undefined reference toSDL_MapRGBA’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:2478: undefined
reference to SDL_UnlockSurface' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:2552: undefined reference toSDL_UnlockSurface’
src/core/SDL_gfxPrimitives.o: In function ellipseColor': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:2796: undefined reference toSDL_LockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:2817: undefined
reference to SDL_MapRGBA' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:3011: undefined reference toSDL_UnlockSurface’
src/core/SDL_gfxPrimitives.o: In function aaellipseColor': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:3138: undefined reference toSDL_LockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:3267: undefined
reference to SDL_UnlockSurface' src/core/SDL_gfxPrimitives.o: In functiontexturedHLine(SDL_Surface*, short,
short, short, SDL_Surface*, int, int)’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:4076: undefined
reference to SDL_UpperBlit' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:4083: undefined reference toSDL_UpperBlit’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:4095: undefined
reference to SDL_UpperBlit' src/core/SDL_gfxPrimitives.o: In functioncharacterColor’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:4400: undefined
reference to SDL_CreateRGBSurface' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:4422: undefined reference toSDL_SetAlpha’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:4426: undefined
reference to SDL_LockSurface' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:4459: undefined reference toSDL_UnlockSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitives.c:4465: undefined
reference to SDL_UpperBlit' src/core/Agent.o: In functionAgent::show()’:
/users/tao/aze/phd/Curiosity_Local/src/core/Agent.cpp:78: undefined reference to
SDL_MapRGB' /users/tao/aze/phd/Curiosity_Local/src/core/Agent.cpp:82: undefined reference toSDL_GetRGB’
src/core/Agent.o: In function Agent::move()': /users/tao/aze/phd/Curiosity_Local/src/core/Agent.cpp:183: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/Agent.cpp:186: undefined reference
to SDL_MapRGB' src/core/BalleAgent.o: In functionBalleAgent’:
/users/tao/aze/phd/Curiosity_Local/src/core/BalleAgent.cpp:33: undefined
reference to SDL_MapRGB' /users/tao/aze/phd/Curiosity_Local/src/core/BalleAgent.cpp:47: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/BalleAgent.cpp:52: undefined
reference to SDL_GetRGB' /users/tao/aze/phd/Curiosity_Local/src/core/BalleAgent.cpp:33: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/BalleAgent.cpp:47: undefined
reference to SDL_MapRGB' /users/tao/aze/phd/Curiosity_Local/src/core/BalleAgent.cpp:52: undefined reference toSDL_GetRGB’
src/core/BalleAgent.o: In function BalleAgent::isCollision()': /users/tao/aze/phd/Curiosity_Local/src/core/BalleAgent.cpp:295: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/BalleAgent.cpp:307: undefined
reference to SDL_MapRGB' src/core/BalleAgent.o: In functionBalleAgent::maj_vision()’:
/users/tao/aze/phd/Curiosity_Local/src/core/BalleAgent.cpp:416: undefined
reference to SDL_GetRGB' src/core/InspectorAgent.o: In functionInspectorAgent::show()’:
/users/tao/aze/phd/Curiosity_Local/src/core/InspectorAgent.cpp:134: undefined
reference to SDL_MapRGB' /users/tao/aze/phd/Curiosity_Local/src/core/InspectorAgent.cpp:136: undefined reference toSDL_MapRGB’
src/core/roborobo.o: In function clean_up()': /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:254: undefined reference toSDL_FreeSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:255: undefined
reference to SDL_FreeSurface' /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:256: undefined reference toSDL_FreeSurface’
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:258: undefined
reference to SDL_FreeSurface' /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:259: undefined reference toSDL_FreeSurface’
src/core/roborobo.o:/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:262:
more undefined references to SDL_FreeSurface' follow src/core/roborobo.o: In functioncheckQuitEvent()’:
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:331: undefined
reference to SDL_PollEvent' src/core/roborobo.o: In functionhandleKeyEvent(unsigned char*)’:
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:351: undefined
reference to SDL_Delay' /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:366: undefined reference toSDL_Delay’
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:374: undefined
reference to SDL_Delay' /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:379: undefined reference toSDL_Delay’
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:393: undefined
reference to SDL_Delay' src/core/roborobo.o:/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:404: more undefined references toSDL_Delay’ follow
src/core/roborobo.o: In function handleKeyEvent(unsigned char*)': /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:454: undefined reference toSDL_GetRGB’
make[1]: quittant le r?pertoire ? /users/tao/aze/phd/Curiosity_Local ?
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:500: undefined
reference to SDL_GetRGB' /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:506: undefined reference toSDL_Delay’
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:530: undefined
reference to SDL_Delay' /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:547: undefined reference toSDL_Delay’
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:563: undefined
reference to SDL_Delay' /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:577: undefined reference toSDL_Delay’
src/core/roborobo.o:/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:585:
more undefined references to SDL_Delay' follow src/core/roborobo.o: In functionupdateDisplay()’:
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:640: undefined
reference to SDL_MapRGB' /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:640: undefined reference toSDL_FillRect’
/users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:677: undefined
reference to SDL_Flip' /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:685: undefined reference toSDL_Delay’
src/core/roborobo.o: In function runRoborobo(int)': /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:1416: undefined reference toSDL_GetKeyState’
src/core/roborobo.o: In function closeRoborobo()': /users/tao/aze/phd/Curiosity_Local/src/core/roborobo.cpp:1445: undefined reference toSDL_Quit’
src/core/RobotAgent.o: In function RobotAgent': /users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:36: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:49: undefined
reference to SDL_MapRGB' /users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:54: undefined reference toSDL_GetRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:36: undefined
reference to SDL_MapRGB' /users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:49: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:54: undefined
reference to SDL_GetRGB' src/core/RobotAgent.o: In functionRobotAgent::move(int)’:
/users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:481: undefined
reference to SDL_GetRGB' /users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:487: undefined reference toSDL_GetRGB’
src/core/RobotAgent.o: In function RobotAgent::isCollision()': /users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:510: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:522: undefined
reference to SDL_MapRGB' src/core/RobotAgent.o: In functionRobotAgent::show()’:
/users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:591: undefined
reference to SDL_MapRGB' /users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:597: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:624: undefined
reference to SDL_MapRGB' /users/tao/aze/phd/Curiosity_Local/src/core/RobotAgent.cpp:628: undefined reference toSDL_GetRGB’
src/core/SDL_gfxPrimitivesExtra.o: In function traceRayRGBA(SDL_Surface*, int, int, int, int, unsigned char, unsigned char, unsigned char, unsigned char)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitivesExtra.cpp:21: undefined reference toSDL_MapRGB’
src/core/SDL_gfxPrimitivesExtra.o: In function castSensorRay(SDL_Surface*, double, double, double*, double*, int)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitivesExtra.cpp:105: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxPrimitivesExtra.cpp:135:
undefined reference to SDL_MapRGB' src/core/SDL_gfxRoborobo.o: In functioninitSDL(unsigned int)’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:24: undefined
reference to SDL_Init' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:30: undefined reference toSDL_SetVideoMode’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:39: undefined
reference to SDL_WM_SetCaption' src/core/SDL_gfxRoborobo.o: In functionputPixel32secure(SDL_Surface*, int,
int, unsigned int)’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:74: undefined
reference to SDL_CreateRGBSurface' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:78: undefined reference toSDL_FreeSurface’
src/core/SDL_gfxRoborobo.o: In function apply_surface(int, int, SDL_Surface*, SDL_Surface*, SDL_Rect*)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:92: undefined reference toSDL_UpperBlit’
src/core/SDL_gfxRoborobo.o: In function register_surface(int, int, SDL_Surface*, SDL_Surface*, int)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:101: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:103: undefined
reference to SDL_MapRGB' src/core/SDL_gfxRoborobo.o: In functionclean_surface(int, int, SDL_Surface*,
SDL_Surface*)’:
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:114: undefined
reference to SDL_MapRGB' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:115: undefined reference toSDL_MapRGB’
src/core/SDL_gfxRoborobo.o: In function load_image(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)': /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:163: undefined reference toIMG_Load’
/users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:169: undefined
reference to SDL_DisplayFormat' /users/tao/aze/phd/Curiosity_Local/src/core/SDL_gfxRoborobo.cpp:172: undefined reference toSDL_FreeSurface’
src/core/Timer.o: In function Timer::start()': /users/tao/aze/phd/Curiosity_Local/src/core/Timer.cpp:29: undefined reference toSDL_GetTicks’
src/core/Timer.o: In function Timer::pause()': /users/tao/aze/phd/Curiosity_Local/src/core/Timer.cpp:50: undefined reference toSDL_GetTicks’
src/core/Timer.o: In function Timer::unpause()': /users/tao/aze/phd/Curiosity_Local/src/core/Timer.cpp:63: undefined reference toSDL_GetTicks’
src/core/Timer.o: In function Timer::get_ticks()': /users/tao/aze/phd/Curiosity_Local/src/core/Timer.cpp:84: undefined reference toSDL_GetTicks’
src/core/World.o: In function World::loadFiles()': /users/tao/aze/phd/Curiosity_Local/src/core/World.cpp:404: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/World.cpp:404: undefined reference
to SDL_SetColorKey' /users/tao/aze/phd/Curiosity_Local/src/core/World.cpp:406: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/World.cpp:406: undefined reference
to SDL_SetColorKey' /users/tao/aze/phd/Curiosity_Local/src/core/World.cpp:407: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/World.cpp:407: undefined reference
to SDL_SetColorKey' /users/tao/aze/phd/Curiosity_Local/src/core/World.cpp:414: undefined reference toSDL_MapRGB’
/users/tao/aze/phd/Curiosity_Local/src/core/World.cpp:415: undefined reference
to `SDL_MapRGB’
collect2: ld returned 1 exit status
make[1]: [roborobo] Erreur 1 (ignor?e)
_______________________________
De : Alberto Luaces
? : sdl at libsdl.org
Envoy? le : Mer 1 d?cembre 2010, 9h 49min 08s
Objet : Re: [SDL] statically linking

azer tyuiop writes:

But it do not want to compile anymore (unreferenced functions of SDL).

Post the undefined references, please.


Alberto


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

azer tyuiop writes:

I think it is to all calls of sdl functions. Here are all the errors I get at building, thx in advance :

[…]

collect2: ld returned 1 exit status
make[1]: [roborobo] Erreur 1 (ignor?e)

Try to use again the “–cflags” option when calling sdl-config.–
Alberto

I did, it change nothing. Maybe it can be helpful so here is my makefile. Note
that by uncommenting/commenting the two successive lines LDFLAGS (to make the
lin dynamic) it compile just fine.

Apart the static linking, Is there any other way to make my program run on a
machine that don’t have sdl?

thx

CC = g++
CCFLAGS = -Wall -g
#LDFLAGS = sdl-config --cfalgs --libs -lSDL_image
LDFLAGS = -Wl,-Bstatic -lSDL_image sdl-config --cfalgs --static-libs
-Wl,-Bdynamic

RM = rm -f
MAKE = make
INCLUDE = -Iinclude/ext -Iinclude/contrib -Iinclude/core -Iinclude/toolBox
#HEADERS = $(wildcard include/ext/Observers/.h)
SRC_C = $(wildcard src/core/
.c src/contrib/.c src/ext/.c)
SRC_CC = $(wildcard src/core/.cpp src/contrib/.cpp src/ext/.cpp
src/toolBox/
.cpp)

OBJ = $(SRC_C:.c=.o) $(SRC_CC:.cpp=.o)
TARGET = roborobo

.IGNORE:
#.SILENT:

all:
clear

$(MAKE) distclean

$(MAKE) $(TARGET) 

$(MAKE) clean

$(TARGET): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^

%.o: %.cpp
$(CC) -o $@ -c $< $(CCFLAGS) $(INCLUDE)

%.o: %.c
$(CC) -o $@ -c $< $(CCFLAGS) $(INCLUDE)

clean:
$(RM) $(OBJ)

distclean:
$(MAKE) clean
$(RM) $(TARGET)________________________________
De : Alberto Luaces
? : sdl at libsdl.org
Envoy? le : Mer 1 d?cembre 2010, 16h 20min 08s
Objet : Re: [SDL] Re : statically linking

azer tyuiop writes:

I think it is to all calls of sdl functions. Here are all the errors I get at
building, thx in advance :

[…]

collect2: ld returned 1 exit status
make[1]: [roborobo] Erreur 1 (ignor?e)

Try to use again the “–cflags” option when calling sdl-config.


Alberto


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

LDFLAGS = -Wl,-Bstatic -lSDL_image sdl-config --cfalgs --static-libs

cflags, not cfalgs.On Wednesday 01 December 2010 07:53, azer tyuiop wrote:

:slight_smile: Well was subtel, but a make clean; make still show the same errors…________________________________
De : Jeff Post <j_post at pacbell.net>
? : SDL Development List
Envoy? le : Mer 1 d?cembre 2010, 17h 02min 03s
Objet : Re: [SDL] Re : Re : statically linking

On Wednesday 01 December 2010 07:53, azer tyuiop wrote:

LDFLAGS = -Wl,-Bstatic -lSDL_image sdl-config --cfalgs --static-libs

cflags, not cfalgs.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

azer tyuiop writes:

I did, it change nothing. Maybe it can be helpful so here is my makefile. Note that by uncommenting/commenting the two successive lines LDFLAGS (to make the lin dynamic) it compile just fine.

Apart the static linking, Is there any other way to make my program run on a machine that don’t have sdl?

If it is the same architecture, you could ldd' your executable, copy all dynamic libraries listed not expected to be in the other system and pack them together. Maybe even better is to issue aldd’ on the other
machine to know which ones are missing.

As for the linking problem, I’d try to see if I’m able to compile a
static SDL program without SDL Image first.–
Alberto

Yes same architecture.

Ok, I did an ldd on the target machine, and I got a not found on the
libSDL_image library (and only on this one, the others are ok). However, I
already tried in the past to copy the libSDL_image in a personal folder, and
exported a variable to tell the linker to search for the library in that rep. I
didn’t got the libSDL_image not found error, however I got an internal error
from SDL, saying that it was not able to initiate the framebuffer /dev/fb0, or
something like that. I am not sure, but I think it is a right issue, as if I
remember well, Linux give the same rights as of the owner of the lib. And so,
this solution cannot work, as the lib have to be in /usr/lib. I am not sure of
what I am saying but that’s how I interpreted the error.

So copying the .so seems not to be a solution.

However thank you so much for your help. It is the very welcome. I really can’t
figure how to solve this.________________________________
De : Alberto Luaces
? : sdl at libsdl.org
Envoy? le : Mer 1 d?cembre 2010, 17h 46min 48s
Objet : Re: [SDL] Re : Re : statically linking

azer tyuiop writes:

I did, it change nothing. Maybe it can be helpful so here is my makefile. Note
that by uncommenting/commenting the two successive lines LDFLAGS (to make the
lin dynamic) it compile just fine.

Apart the static linking, Is there any other way to make my program run on a
machine that don’t have sdl?

If it is the same architecture, you could ldd' your executable, copy all dynamic libraries listed not expected to be in the other system and pack them together. Maybe even better is to issue aldd’ on the other
machine to know which ones are missing.

As for the linking problem, I’d try to see if I’m able to compile a
static SDL program without SDL Image first.


Alberto


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Instead of linking statically, you could use the linker’s -rpath flag to
tell it to look for dynamic libraries in another location. A typical
compile line might have this appended:
-Wl,-rpath,$ORIGIN
You would double the $ to put it in a Makefile.

Then, just ship the shared object files alongside the executable.

Jonny DOn Wed, Dec 1, 2010 at 11:46 AM, Alberto Luaces wrote:

azer tyuiop writes:

I did, it change nothing. Maybe it can be helpful so here is my makefile.
Note that by uncommenting/commenting the two successive lines LDFLAGS (to
make the lin dynamic) it compile just fine.

Apart the static linking, Is there any other way to make my program run
on a machine that don’t have sdl?

If it is the same architecture, you could ldd' your executable, copy all dynamic libraries listed not expected to be in the other system and pack them together. Maybe even better is to issue aldd’ on the other
machine to know which ones are missing.

As for the linking problem, I’d try to see if I’m able to compile a
static SDL program without SDL Image first.


Alberto


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Quoth azer tyuiop <gl_disturbedid at yahoo.fr>, on 2010-12-01 17:11:13 +0000:

I think it is a right issue, as if I
remember well, Linux give the same rights as of the owner of the lib.

No. On Linux, dynamic libraries get the same credentials as the rest
of the process.

—> Drake Wilson

Well ok. So I tried again, I put the libSDL_Image in my rep. I than do :
LD_LIBRARY_PATH=/users/tao/aze/libsdl:$LD_LIBRARY_PATH, and than I lunch the
program. I do not get anymore

error while loading shared libraries: libSDL_image-1.2.so.0: cannot open shared
object file: No such file or directory

The programs starts, and than I do this error :

| DirectFB 1.2.7 |
© 2001-2008 The world wide DirectFB Open Source Community
© 2000-2004 Convergence (integrated media) GmbH----------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2009-06-02 06:33)
(!) Direct/Util: opening ‘/dev/fb0’ and ‘/dev/fb/0’ failed
–> No such file or directory
(!) DirectFB/FBDev: Error opening framebuffer device!
(!) DirectFB/FBDev: Use ‘fbdev’ option or set FRAMEBUFFER environment variable.
(!) DirectFB/Core: Could not initialize ‘system_core’ core!
–> Initialization error!
[critical] cannot initialize SDL.


But I solved partially my problem. There is a batch mode in my program that do
not call any graphical routine. It is the one I use when I lunch experiments on
other machines. So by shipping the .so with it, I can lunch in this mode. Which
is a big thing and is all what I need. However if it solves my problem, it do
not solve ‘the’ problem, how to lunch sdl apps on machines that cannot have root
access to install libSDL?


De : Drake Wilson
? : SDL Development List
Envoy? le : Mer 1 d?cembre 2010, 18h 18min 22s
Objet : Re: [SDL] Re : Re : Re : statically linking

Quoth azer tyuiop <@azer_tyuiop>, on 2010-12-01 17:11:13 +0000:

I think it is a right issue, as if I
remember well, Linux give the same rights as of the owner of the lib.

No. On Linux, dynamic libraries get the same credentials as the rest
of the process.

—> Drake Wilson


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

IIRC the order is important when staticly linking, try:
$(TARGET): $(OBJ)
$(CC) -o $@ $^ $(LDFLAGS)On Wed, Dec 01, 2010 at 03:53:32PM +0000, azer tyuiop wrote:

$(TARGET): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^

Well I tried, it made things advance. Now I get many undefined references to
other libs, like png, jpeg (exemple at the end) etc.

I used the additional links that I found here :

My LDFLAGS is no :
LDFLAGS = -Wl,-Bstatic -lSDL_image sdl-config --cflags --static-libs
-Wl,-Bdynamic directfb-config --libs -lpng12 -ltiff -ljpeg -lasound -laudio
-lesd -lpulse-simple -lcaca -laa -ldl

Now, I have nearly only a problem with pulse audio. When I don’t use the
-lpulse-simple lib I get errors like this :
/usr/lib/libSDL.a(SDL_pulseaudio.o): In function PULSE_CloseAudio': (.text+0x14e): undefined reference topa_simple_drain’

And when I add -lpulse, or -lpulse-simple, it do not find it.
/usr/bin/ld: cannot find -lpulse-simple

But I checked and I do have libpulse ad libpulse-simple in /usr/lib. What can I
do?
Thx for the help.

/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x12): undefined reference tojpeg_calc_output_dimensions’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x1c): undefined reference tojpeg_CreateDecompress’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x26): undefined reference tojpeg_destroy_decompress’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x30): undefined reference tojpeg_finish_decompress’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x3a): undefined reference tojpeg_read_header’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x44): undefined reference tojpeg_read_scanlines’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x4e): undefined reference tojpeg_resync_to_restart’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG’:________________________________
De : Mikael Eriksson <mikael_eriksson at miffe.org>
? : sdl at lists.libsdl.org
Envoy? le : Jeu 2 d?cembre 2010, 5h 03min 27s
Objet : Re: [SDL] statically linking

On Wed, Dec 01, 2010 at 03:53:32PM +0000, azer tyuiop wrote:

$(TARGET): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^

IIRC the order is important when staticly linking, try:
$(TARGET): $(OBJ)
$(CC) -o $@ $^ $(LDFLAGS)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Well I tried, it made things advance. Now I get many undefined references to
other libs, like png, jpeg (exemple at the end) etc.

I used the additional links that I found here :
http://stackoverflow.com/questions/115813/how-to-statically-compile-an-sdl-game-on-windows

My LDFLAGS is no :
LDFLAGS = -Wl,-Bstatic -lSDL_image sdl-config --cflags --static-libs
-Wl,-Bdynamic directfb-config --libs -lpng12 -ltiff -ljpeg -lasound -laudio
-lesd -lpulse-simple -lcaca -laa -ldl

Now, I have nearly only a problem with pulse audio. When I don’t use the
-lpulse-simple lib I get errors like this :
/usr/lib/libSDL.a(SDL_pulseaudio.o): In function PULSE_CloseAudio': (.text+0x14e): undefined reference topa_simple_drain’

Seems like your distribution doen’t provide you with a static version of
libpulse (it isn’t built by default, which might be why). sdl-config
–static-libs list -lpulse-simple so it tries to link it staticly. You
can work around it with something like:

LDFLAGS = -Wl,-Bstatic -lSDL_image -lSDL -Wl,-Bdynamic
directfb-config --libs -lpng12 -ltiff -ljpeg -lasound -laudio -lesd
-lpulse-simple -lcaca -laa -ldl -lm -lpthread

And when I add -lpulse, or -lpulse-simple, it do not find it.
/usr/bin/ld: cannot find -lpulse-simple

But I checked and I do have libpulse ad libpulse-simple in /usr/lib. What can I
do?
Thx for the help.

/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x12): undefined reference tojpeg_calc_output_dimensions’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x1c): undefined reference tojpeg_CreateDecompress’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x26): undefined reference tojpeg_destroy_decompress’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x30): undefined reference tojpeg_finish_decompress’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x3a): undefined reference tojpeg_read_header’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x44): undefined reference tojpeg_read_scanlines’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x4e): undefined reference tojpeg_resync_to_restart’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG’:

I have no idea why this happens, it should work since you link with
libjpeg.On Thu, Dec 02, 2010 at 09:44:20AM +0000, azer tyuiop wrote:

The errors I exhibited at the end was before I link with ljpeg. It works fine
after. The only remaining problem seems to be pulse-audio.

As for the distribution, I have ubuntu 10.04 on my machine, and I can ask the
admin to install any package on it. So if the static version of pulse audio is
available on the repositories, it should be no prolem to install.

I will try this tomorrow and also try your modified LDFLAGS.

Thx for the help.________________________________
De : Mikael Eriksson <mikael_eriksson at miffe.org>
? : sdl at lists.libsdl.org
Envoy? le : Jeu 2 d?cembre 2010, 19h 11min 16s
Objet : Re: [SDL] Re : statically linking

On Thu, Dec 02, 2010 at 09:44:20AM +0000, azer tyuiop wrote:

Well I tried, it made things advance. Now I get many undefined references to
other libs, like png, jpeg (exemple at the end) etc.

I used the additional links that I found here :
http://stackoverflow.com/questions/115813/how-to-statically-compile-an-sdl-game-on-windows
s

My LDFLAGS is no :
LDFLAGS = -Wl,-Bstatic -lSDL_image sdl-config --cflags --static-libs
-Wl,-Bdynamic directfb-config --libs -lpng12 -ltiff -ljpeg -lasound -laudio
-lesd -lpulse-simple -lcaca -laa -ldl

Now, I have nearly only a problem with pulse audio. When I don’t use the
-lpulse-simple lib I get errors like this :
/usr/lib/libSDL.a(SDL_pulseaudio.o): In function PULSE_CloseAudio': (.text+0x14e): undefined reference topa_simple_drain’

Seems like your distribution doen’t provide you with a static version of
libpulse (it isn’t built by default, which might be why). sdl-config
–static-libs list -lpulse-simple so it tries to link it staticly. You
can work around it with something like:

LDFLAGS = -Wl,-Bstatic -lSDL_image -lSDL -Wl,-Bdynamic
directfb-config --libs -lpng12 -ltiff -ljpeg -lasound -laudio -lesd
-lpulse-simple -lcaca -laa -ldl -lm -lpthread

And when I add -lpulse, or -lpulse-simple, it do not find it.
/usr/bin/ld: cannot find -lpulse-simple

But I checked and I do have libpulse ad libpulse-simple in /usr/lib. What can I

do?
Thx for the help.

/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x12): undefined reference tojpeg_calc_output_dimensions’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x1c): undefined reference tojpeg_CreateDecompress’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x26): undefined reference tojpeg_destroy_decompress’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x30): undefined reference tojpeg_finish_decompress’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x3a): undefined reference tojpeg_read_header’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x44): undefined reference tojpeg_read_scanlines’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function IMG_InitJPG': (.text+0x4e): undefined reference tojpeg_resync_to_restart’
/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG’:

I have no idea why this happens, it should work since you link with
libjpeg.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org