weixin_39652646
weixin_39652646
2020-12-08 20:23

Can't compile in linux

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

`└─➤ make                               
[...]
[ 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/gbe-plus

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39569747 weixin_39569747 4月前

    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.

    点赞 评论 复制链接分享
  • weixin_39980903 weixin_39980903 4月前

    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

    点赞 评论 复制链接分享
  • weixin_39834149 weixin_39834149 4月前

    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.

    点赞 评论 复制链接分享
  • weixin_39884144 weixin_39884144 4月前

    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.

    点赞 评论 复制链接分享