View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0013769 | CMake | Modules | public | 2012-12-02 03:53 | 2013-05-06 09:32 | ||||
Reporter | R Cullen | ||||||||
Assigned To | Benjamin Eikel | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | MinGW | OS | Windows | OS Version | 7 | ||||
Product Version | CMake 2.8.10.1 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0013769: FindSDL.cmake libraries in wrong order | ||||||||
Description | The FindSDL.cmake file does not order the SDL libraries correctly. "-lSDLmain" must be added to the g++ arguments before "-lSDL", not doing this results in linking errors like those below : c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/lib\libSDLmain.a(SDL_win32_main.o): In function `redirect_output': /Users/slouken/release/SDL/SDL-1.2.15/./src/main/win32/SDL_win32_main.c:219: undefined reference to `SDL_strlcpy' /Users/slouken/release/SDL/SDL-1.2.15/./src/main/win32/SDL_win32_main.c:220: undefined reference to `SDL_strlcat' ... | ||||||||
Steps To Reproduce | Install MinGW Compile SDL using MinGW Compile attached program using : cmake -Wdev -DSDL_BUILDING_LIBRARY=FALSE -G"MSYS Makefiles" .. && make VERBOSE=1 | ||||||||
Additional Information | Here are the sources if you dont trust the .zip test.cpp #include "SDL.h" #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 #define SCREEN_DEPTH 8 int main(int argc, char *argv[]) { SDL_Surface *screen; Uint8 *p; int x = 10; int y = 20; SDL_Init(SDL_INIT_VIDEO); screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_DEPTH, SDL_SWSURFACE); p = (Uint8 *)screen->pixels + y * screen->pitch + x * screen->format->BytesPerPixel; *p=0xf0; SDL_Flip(screen); while(1); } CMakeLists.txt cmake_minimum_required(VERSION 2.6) project(MyProject) set(EXECUTABLE_NAME "sdl_bug") #SET THIS TO YOUR MING INSTALATION if( WIN32 ) set(CMAKE_PREFIX_PATH "c:/MinGW/") endif() add_executable(${EXECUTABLE_NAME} test.cpp) find_package(SDL REQUIRED) if(SDL_FOUND) include_directories(${SDL_INCLUDE_DIR}) target_link_libraries(${EXECUTABLE_NAME} ${SDL_LIBRARY}) endif() | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | sources.zip [^] (898 bytes) 2012-12-02 03:53 | ||||||||
Relationships | |
Relationships |
Notes | |
(0031795) Benjamin Eikel (developer) 2012-12-02 07:53 |
I tried it and I can reproduce your problem. The problem is gone if I link against "bin/SDL.dll" instead of "lib/libSDL.dll.a", or if I change the order of "libSDL.dll.a" and "libSDLmain.a", as you suggested. |
(0031796) Benjamin Eikel (developer) 2012-12-02 08:38 |
I pushed a possible fix (http://cmake.org/gitweb?p=stage/cmake.git;a=commit;h=981629f701c598f58115445456ee733077beae8d [^]) to the CMake topic stage. I have tested the change on Windows, where it fixed the problem described in this bug, and on Linux, where it did not produce any new bugs. I have not tested it on OS X. |
(0032995) Robert Maynard (manager) 2013-05-06 09:32 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2012-12-02 03:53 | R Cullen | New Issue | |
2012-12-02 03:53 | R Cullen | File Added: sources.zip | |
2012-12-02 07:53 | Benjamin Eikel | Note Added: 0031795 | |
2012-12-02 08:38 | Benjamin Eikel | Note Added: 0031796 | |
2012-12-31 11:20 | Benjamin Eikel | Status | new => resolved |
2012-12-31 11:20 | Benjamin Eikel | Resolution | open => fixed |
2012-12-31 11:20 | Benjamin Eikel | Assigned To | => Benjamin Eikel |
2013-05-06 09:32 | Robert Maynard | Note Added: 0032995 | |
2013-05-06 09:32 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |