hex007 / freej2me

A free J2ME emulator with libretro, awt and sdl2 frontends.
Other
500 stars 78 forks source link

SDL2 frontend fails to build on linux #87

Closed fcard closed 4 years ago

fcard commented 4 years ago

On the step

$ make

It spits out the following error message:

Building Anbu, sdl_interface for FreeJ2ME ...
/usr/bin/ld: /tmp/cczPz4JN.o: in function `addJoystick(int)':
anbu.cpp:(.text+0xb7): undefined reference to `SDL_NumJoysticks'
/usr/bin/ld: anbu.cpp:(.text+0xe5): undefined reference to `SDL_JoystickOpen'
/usr/bin/ld: anbu.cpp:(.text+0x11b): undefined reference to `SDL_JoystickInstanceID'
/usr/bin/ld: anbu.cpp:(.text+0x144): undefined reference to `SDL_JoystickNumAxes'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `removeJoystick(int)':
anbu.cpp:(.text+0x2df): undefined reference to `SDL_JoystickClose'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `sendQuitEvent()':
anbu.cpp:(.text+0x404): undefined reference to `SDL_PushEvent'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `loadDisplayDimentions()':
anbu.cpp:(.text+0x437): undefined reference to `SDL_GetDesktopDisplayMode'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `saveFrame(unsigned char*)':
anbu.cpp:(.text+0x846): undefined reference to `FreeImage_ConvertFromRawBits'
/usr/bin/ld: anbu.cpp:(.text+0x8bc): undefined reference to `FreeImage_Save'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `drawFrame(unsigned char*, unsigned long, SDL_Rect*, int, int)':
anbu.cpp:(.text+0x945): undefined reference to `SDL_GetTicks'
/usr/bin/ld: anbu.cpp:(.text+0x964): undefined reference to `SDL_GetTicks'
/usr/bin/ld: anbu.cpp:(.text+0x979): undefined reference to `SDL_RenderClear'
/usr/bin/ld: anbu.cpp:(.text+0x997): undefined reference to `SDL_UpdateTexture'
/usr/bin/ld: anbu.cpp:(.text+0x9b7): undefined reference to `SDL_RenderCopy'
/usr/bin/ld: anbu.cpp:(.text+0x9ea): undefined reference to `SDL_RenderCopyEx'
/usr/bin/ld: anbu.cpp:(.text+0xa1d): undefined reference to `SDL_RenderCopyEx'
/usr/bin/ld: anbu.cpp:(.text+0xa2c): undefined reference to `SDL_RenderPresent'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `loadBackground(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
anbu.cpp:(.text+0xa6e): undefined reference to `FreeImage_GetFileType'
/usr/bin/ld: anbu.cpp:(.text+0xa92): undefined reference to `FreeImage_Load'
/usr/bin/ld: anbu.cpp:(.text+0xaa2): undefined reference to `FreeImage_GetWidth'
/usr/bin/ld: anbu.cpp:(.text+0xab1): undefined reference to `FreeImage_GetHeight'
/usr/bin/ld: anbu.cpp:(.text+0xac0): undefined reference to `FreeImage_GetPitch'
/usr/bin/ld: anbu.cpp:(.text+0xb08): undefined reference to `FreeImage_ConvertToRawBits'
/usr/bin/ld: anbu.cpp:(.text+0xb18): undefined reference to `FreeImage_Unload'
/usr/bin/ld: anbu.cpp:(.text+0xb3c): undefined reference to `SDL_CreateTexture'
/usr/bin/ld: anbu.cpp:(.text+0xb6a): undefined reference to `SDL_UpdateTexture'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `loadOverlay(SDL_Rect&)':
anbu.cpp:(.text+0xcd8): undefined reference to `SDL_CreateTexture'
/usr/bin/ld: anbu.cpp:(.text+0xcf3): undefined reference to `SDL_SetTextureBlendMode'
/usr/bin/ld: anbu.cpp:(.text+0xd19): undefined reference to `SDL_UpdateTexture'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `init(unsigned char, unsigned char, unsigned char)':
anbu.cpp:(.text+0xd9c): undefined reference to `SDL_Init'
/usr/bin/ld: anbu.cpp:(.text+0xdfc): undefined reference to `SDL_CreateWindowAndRenderer'
/usr/bin/ld: anbu.cpp:(.text+0xe1d): undefined reference to `SDL_SetRenderDrawColor'
/usr/bin/ld: anbu.cpp:(.text+0xe2c): undefined reference to `SDL_RenderClear'
/usr/bin/ld: anbu.cpp:(.text+0xe3b): undefined reference to `SDL_RenderPresent'
/usr/bin/ld: anbu.cpp:(.text+0xe56): undefined reference to `SDL_SetHint'
/usr/bin/ld: anbu.cpp:(.text+0xe73): undefined reference to `SDL_RenderSetLogicalSize'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `startStreaming(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
anbu.cpp:(.text+0xf45): undefined reference to `SDL_CreateTexture'
/usr/bin/ld: anbu.cpp:(.text+0xfc2): undefined reference to `SDL_DestroyTexture'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `startCapturing(void*)':
anbu.cpp:(.text+0x103b): undefined reference to `SDL_JoystickEventState'
/usr/bin/ld: anbu.cpp:(.text+0x1056): undefined reference to `SDL_WaitEvent'
/usr/bin/ld: /tmp/cczPz4JN.o: in function `main':
anbu.cpp:(.text+0x1ac2): undefined reference to `SDL_ShowCursor'
/usr/bin/ld: anbu.cpp:(.text+0x1aeb): undefined reference to `pthread_create'
/usr/bin/ld: anbu.cpp:(.text+0x1b21): undefined reference to `SDL_Quit'
/usr/bin/ld: anbu.cpp:(.text+0x1b6a): undefined reference to `pthread_join'
/usr/bin/ld: anbu.cpp:(.text+0x1b78): undefined reference to `SDL_ShowCursor'
/usr/bin/ld: anbu.cpp:(.text+0x1b7d): undefined reference to `SDL_Quit'
collect2: error: ld returned 1 exit status
make: *** [Makefile:6: all] Error 1

I've solved it by moving the linker directives in the makefile to the end of the statement, i.e. such that

$ diff Makefile.old Makefile
6c6
<   @g++ -std=c++11 -lSDL2 -lpthread -lfreeimage -o sdl_interface anbu.cpp
---
>   @g++ -std=c++11 -o sdl_interface anbu.cpp -lSDL2 -lfreeimage -lpthread

But I don't remember if that affects the windows build any.

hex007 commented 4 years ago

Which system are you using, like OS and architecture, gcc version.

You can also open a PR. I will merge after testing.

fcard commented 4 years ago

I am using Ubuntu Mate, architecture is amd64 gcc version is 9.3.0. I will send a PR in a moment!