shonumi / gbe-plus

DMG/GBC/GBA emulator and experimental NDS emulator.
GNU General Public License v2.0
527 stars 79 forks source link

Can't compile in linux #105

Open DuendeInexistente opened 5 years ago

DuendeInexistente commented 5 years ago

Trying to compile it with cmake on linux gives me an error. Using make 4.1 and cmake 3.14.3

[...]
[ 29%] Built target common
Scanning dependencies of target gba
[ 30%] Building CXX object gba/CMakeFiles/gba.dir/apu.o
[ 31%] Building CXX object gba/CMakeFiles/gba.dir/arm7.o
[ 32%] Building CXX object gba/CMakeFiles/gba.dir/arm_instr.o
[ 33%] Building CXX object gba/CMakeFiles/gba.dir/core.o
[ 34%] Building CXX object gba/CMakeFiles/gba.dir/dma.o
[ 35%] Building CXX object gba/CMakeFiles/gba.dir/gamepad.o
[ 36%] Building CXX object gba/CMakeFiles/gba.dir/lcd.o
[ 38%] Building CXX object gba/CMakeFiles/gba.dir/mmu.o
[ 39%] Building CXX object gba/CMakeFiles/gba.dir/opengl.o
[ 40%] Building CXX object gba/CMakeFiles/gba.dir/swi.o
/home/cammera/Software/Softwarebuilds/gbe-plus/src/gba/swi.cpp:49:1: error: narrowing conversion of ‘65134’ from ‘int’ to ‘s16 {aka short int}’ inside { } [-Wnarrowing]
 };
 ^
/home/cammera/Software/Softwarebuilds/gbe-plus/src/gba/swi.cpp:49:1: error: narrowing conversion of ‘64733’ from ‘int’ to ‘s16 {aka short int}’ inside { } [-Wnarrowing]

(^ Repeats several dozen times)

gba/CMakeFiles/gba.dir/build.make:179: recipe for target 'gba/CMakeFiles/gba.dir/swi.o' failed
make[2]: *** [gba/CMakeFiles/gba.dir/swi.o] Error 1
CMakeFiles/Makefile2:186: recipe for target 'gba/CMakeFiles/gba.dir/all' failed
make[1]: *** [gba/CMakeFiles/gba.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
shonumi commented 5 years ago

This issue comes from g++. The compiler is complaining about the narrowing done in the GBA HLE SWI code. It was a known problem, hence this line in the main CMakeLists.txt was appended with -Wno-narrowing If you've edited this file, make sure you add that parameter.

I haven't been able to reproduce the narrowing conversion errors on my end. Tested it across 3 machines running different versions of g++ (ranging from 4.2.x or something to 9.1.0). Just installed Slackware Current today and no problems there, so I'm not sure what's happening here. If you haven't edited the CMakeLists.txt, perhaps -Wno-narrowing is getting suppressed somehow.

Mte90 commented 4 years ago

On debian sid:

CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find SDL2 (missing: SDL2_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  CMakeTests/FindSDL2.cmake:179 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:16 (find_package)

That took to this ticket https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=951087 seems that this macro has some problems but is not clear to me how to fix it. Others switch to other solution for sdl2 https://github.com/JACoders/OpenJK/pull/1033

Also as default refer to Qt 4 that now is not supported anymore in many distro.

merwok commented 4 years ago

I have compiled GBE+ on Debian some time ago, but now I can’t because Qt4 is not available anymore. The README says that the Qt dependency is optional, but there is no indication on how to tell cmake to ignore the GUI part.

negativeExponent commented 4 years ago

you can turn off QT, as well as ust QT5 for those that do not have QT4 now

https://github.com/shonumi/gbe-plus/blob/4756f548b3f87236fbb64e2aaab1f2febb19fcce/CMakeLists.txt#L69-L71