libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.4k stars 1.84k forks source link

Cant build Retroarch for 3DS #16427

Open staringstar opened 7 months ago

staringstar commented 7 months ago

Description

Having done all the steps outlined in the wiki for compiling Retroarch, it always errors at the last step for compiling it. Here is the error.

/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc -c -o ctr/gpu_old.o ctr/gpu_old.c -DUSE_CTRULIB_2 -mword-relocations -fomit-frame-pointer -ffast-math -Werror=implicit-function-declaration -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft -DARM11 -D_3DS -D__3DS__ -O0 -g -DLIBCTRU_NO_DEPRECATION -I. -Ideps -Ideps/7zip -Ideps/stb -Ideps/rcheevos/include -Ilibretro-common/include -Ilibretro-common/include/compat/zlib -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_DSP_FILTER -DHAVE_VIDEO_FILTER -DHAVE_FILTERS_BUILTIN -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_CONFIGFILE -DHAVE_RGUI -DHAVE_XMB -DHAVE_LIBRETRODB -DHAVE_CC_RESAMPLER -DHAVE_ZLIB -DHAVE_7ZIP -D_7ZIP_ST -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_NETWORKING -DHAVE_IFINFO -DHAVE_CHEEVOS -DRC_DISABLE_LUA -DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_CORES -DHAVE_UPDATE_CORE_INFO -DHAVE_PATCH -DHAVE_RWAV -DHAVE_SCREENSHOTS -DHAVE_REWIND -DHAVE_THREADS -DHAVE_GFX_WIDGETS -DHAVE_OVERLAY -DHAVE_CORE_INFO_CACHE -DHAVE_CHEATS -std=gnu2x -ffast-math -I/opt/devkitpro/libctru/include
In file included from ctr/gpu_old.c:14:
ctr/gpu_old.h: In function 'GPU_Init':
ctr/gpu_old.h:19:34: error: expected declaration specifiers before 'DEPRECATED'
   19 | void GPU_Init(Handle *gsphandle) DEPRECATED;
      |                                  ^~~~~~~~~~
ctr/gpu_old.h:28:57: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
   28 | void GPU_Reset(u32* gxbuf, u32* gpuBuf, u32 gpuBufSize) DEPRECATED;
      |                                                         ^~~~~~~~~~
ctr/gpu_old.h:38:85: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
   38 | void GPU_SetFloatUniform(GPU_SHADER_TYPE type, u32 startreg, u32* data, u32 numreg) DEPRECAT
ED;
      |                                                                                     ^~~~~~~~
~~
ctr/gpu_old.h:50:86: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
   50 | void GPU_SetViewport(u32* depthBuffer, u32* colorBuffer, u32 x, u32 y, u32 w, u32 h) DEPRECA
TED;
      |                                                                                      ^~~~~~~
~~~
ctr/gpu_old.h:61:89: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
   61 | void GPU_SetScissorTest(GPU_SCISSORMODE mode, u32 left, u32 bottom, u32 right, u32 top) DEPR
ECATED;
      |                                                                                         ^~~~
~~~~~~
ctr/gpu_old.h:69:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
   69 | void GPU_DepthMap(float zScale, float zOffset) DEPRECATED;
      |                                                ^~~~~~~~~~
ctr/gpu_old.h:78:67: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
   78 | void GPU_SetAlphaTest(bool enable, GPU_TESTFUNC function, u8 ref) DEPRECATED;
      |                                                                   ^~~~~~~~~~
ctr/gpu_old.h:88:96: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
   88 | void GPU_SetDepthTestAndWriteMask(bool enable, GPU_TESTFUNC function, GPU_WRITEMASK writemas
k) DEPRECATED;
      |
   ^~~~~~~~~~
ctr/gpu_old.h:99:99: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
   99 | void GPU_SetStencilTest(bool enable, GPU_TESTFUNC function, u8 ref, u8 input_mask, u8 write_
mask) DEPRECATED;
      |
      ^~~~~~~~~~
ctr/gpu_old.h:108:85: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  108 | void GPU_SetStencilOp(GPU_STENCILOP sfail, GPU_STENCILOP dfail, GPU_STENCILOP pass) DEPRECAT
ED;
      |                                                                                     ^~~~~~~~
~~
ctr/gpu_old.h:115:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  115 | void GPU_SetFaceCulling(GPU_CULLMODE mode) DEPRECATED;
      |                                            ^~~~~~~~~~
ctr/gpu_old.h:125:65: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  125 | void GPU_SetCombinerBufferWrite(u8 rgb_config, u8 alpha_config) DEPRECATED;
      |                                                                 ^~~~~~~~~~
ctr/gpu_old.h:140:61: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  140 |         GPU_BLENDFACTOR alphaSrc, GPU_BLENDFACTOR alphaDst) DEPRECATED;
      |                                                             ^~~~~~~~~~
ctr/gpu_old.h:148:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  148 | void GPU_SetColorLogicOp(GPU_LOGICOP op) DEPRECATED;
      |                                          ^~~~~~~~~~
ctr/gpu_old.h:158:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  158 | void GPU_SetBlendingColor(u8 r, u8 g, u8 b, u8 a) DEPRECATED;
      |                                                   ^~~~~~~~~~
ctr/gpu_old.h:173:223: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  173 | void GPU_SetAttributeBuffers(u8 totalAttributes, u32* baseAddress, u64 attributeFormats, u16
 attributeMask, u64 attributePermutation, u8 numBuffers, u32 bufferOffsets[], u64 bufferPermutations
[], u8 bufferNumAttributes[]) DEPRECATED;
      |

                              ^~~~~~~~~~
ctr/gpu_old.h:180:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  180 | void GPU_SetTextureEnable(GPU_TEXUNIT units) DEPRECATED;
      |                                              ^~~~~~~~~~
ctr/gpu_old.h:192:108: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  192 | void GPU_SetTexture(GPU_TEXUNIT unit, u32* data, u16 width, u16 height, u32 param, GPU_TEXCO
LOR colorType) DEPRECATED;
      |
               ^~~~~~~~~~
ctr/gpu_old.h:200:66: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  200 | void GPU_SetTextureBorderColor(GPU_TEXUNIT unit,u32 borderColor) DEPRECATED;
      |                                                                  ^~~~~~~~~~
ctr/gpu_old.h:214:174: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  214 | void GPU_SetTexEnv(u8 id, u16 rgbSources, u16 alphaSources, u16 rgbOperands, u16 alphaOperan
ds, GPU_COMBINEFUNC rgbCombine, GPU_COMBINEFUNC alphaCombine, u32 constantColor) DEPRECATED;
      |
                                                                                 ^~~~~~~~~~
ctr/gpu_old.h:223:69: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  223 | void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count) DEPRECATED;
      |                                                                     ^~~~~~~~~~
ctr/gpu_old.h:232:74: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  232 | void GPU_DrawElements(GPU_Primitive_t primitive, u32* indexArray, u32 n) DEPRECATED;
      |                                                                          ^~~~~~~~~~
ctr/gpu_old.h:238:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  238 | void GPU_FinishDrawing() DEPRECATED;
      |                          ^~~~~~~~~~
ctr/gpu_old.h:240:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'DEPRECATED'
  240 | void GPU_Finalize(void) DEPRECATED;
      |                         ^~~~~~~~~~
ctr/gpu_old.c:17:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   17 | {
      | ^
ctr/gpu_old.c:24:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   24 | {
      | ^
ctr/gpu_old.c:30:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   30 | {
      | ^
ctr/gpu_old.c:46:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   46 | {
      | ^
ctr/gpu_old.c:91:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   91 | {
      | ^
ctr/gpu_old.c:101:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  101 | {
      | ^
ctr/gpu_old.c:108:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  108 | {
      | ^
ctr/gpu_old.c:114:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  114 | {
      | ^
ctr/gpu_old.c:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  120 | {
      | ^
ctr/gpu_old.c:125:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  125 | {
      | ^
ctr/gpu_old.c:132:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  132 | {
      | ^
ctr/gpu_old.c:138:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  138 | {
      | ^
ctr/gpu_old.c:144:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  144 | {
      | ^
ctr/gpu_old.c:149:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  149 | {
      | ^
ctr/gpu_old.c:155:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  155 | {
      | ^
ctr/gpu_old.c:182:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  182 | {
      | ^
ctr/gpu_old.c:199:1: error: parameter 'GPU_FORMATSIZE' is initialized
  199 | const u8 GPU_FORMATSIZE[4]={1,1,2,4};
      | ^~~~~
ctr/gpu_old.c:199:28: error: variable-sized object may not be initialized except with an empty initi
alizer
  199 | const u8 GPU_FORMATSIZE[4]={1,1,2,4};
      |                            ^
ctr/gpu_old.c:199:29: warning: initialization of 'const u8 *' {aka 'const unsigned char *'} from 'in
t' makes pointer from integer without a cast [-Wint-conversion]
  199 | const u8 GPU_FORMATSIZE[4]={1,1,2,4};
      |                             ^
ctr/gpu_old.c:199:29: note: (near initialization for 'GPU_FORMATSIZE')
ctr/gpu_old.c:199:31: warning: excess elements in scalar initializer
  199 | const u8 GPU_FORMATSIZE[4]={1,1,2,4};
      |                               ^
ctr/gpu_old.c:199:31: note: (near initialization for 'GPU_FORMATSIZE')
ctr/gpu_old.c:199:33: warning: excess elements in scalar initializer
  199 | const u8 GPU_FORMATSIZE[4]={1,1,2,4};
      |                                 ^
ctr/gpu_old.c:199:33: note: (near initialization for 'GPU_FORMATSIZE')
ctr/gpu_old.c:199:35: warning: excess elements in scalar initializer
  199 | const u8 GPU_FORMATSIZE[4]={1,1,2,4};
      |                                   ^
ctr/gpu_old.c:199:35: note: (near initialization for 'GPU_FORMATSIZE')
ctr/gpu_old.c:211:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  211 | {
      | ^
ctr/gpu_old.c:249:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  249 | {
      | ^
ctr/gpu_old.c:254:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  254 | {
      | ^
ctr/gpu_old.c:259:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  259 | {
      | ^
ctr/gpu_old.c:263:1: error: parameter 'GPU_TEVID' is initialized
  263 | const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8};
      | ^~~~~
ctr/gpu_old.c:263:22: error: variable-sized object may not be initialized except with an empty initi
alizer
  263 | const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8};
      |                      ^
ctr/gpu_old.c:263:23: warning: initialization of 'const u8 *' {aka 'const unsigned char *'} from 'in
t' makes pointer from integer without a cast [-Wint-conversion]
  263 | const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8};
      |                       ^~~~
ctr/gpu_old.c:263:23: note: (near initialization for 'GPU_TEVID')
ctr/gpu_old.c:263:28: warning: excess elements in scalar initializer
  263 | const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8};
      |                            ^~~~
ctr/gpu_old.c:263:28: note: (near initialization for 'GPU_TEVID')
ctr/gpu_old.c:263:33: warning: excess elements in scalar initializer
  263 | const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8};
      |                                 ^~~~
ctr/gpu_old.c:263:33: note: (near initialization for 'GPU_TEVID')
ctr/gpu_old.c:263:38: warning: excess elements in scalar initializer
  263 | const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8};
      |                                      ^~~~
ctr/gpu_old.c:263:38: note: (near initialization for 'GPU_TEVID')
ctr/gpu_old.c:263:43: warning: excess elements in scalar initializer
  263 | const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8};
      |                                           ^~~~
ctr/gpu_old.c:263:43: note: (near initialization for 'GPU_TEVID')
ctr/gpu_old.c:263:48: warning: excess elements in scalar initializer
  263 | const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8};
      |                                                ^~~~
ctr/gpu_old.c:263:48: note: (near initialization for 'GPU_TEVID')
ctr/gpu_old.c:266:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  266 | {
      | ^
ctr/gpu_old.c:281:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  281 | {
      | ^
ctr/gpu_old.c:303:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  303 | {
      | ^
ctr/gpu_old.c:327:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  327 | {
      | ^
ctr/gpu_old.c:334:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  334 | {
      | ^
ctr/gpu_old.h:19:6: error: old-style parameter declarations in prototyped function definition
   19 | void GPU_Init(Handle *gsphandle) DEPRECATED;
      |      ^~~~~~~~
ctr/gpu_old.c:347: error: expected '{' at end of input
make: *** [Makefile.ctr:294: ctr/gpu_old.o] Error 1

It must be noted that this is on Windows 10 using MSYS2.

Expected behavior

The app to compile successfully.

Actual behavior

It fails to compile with the afromentioned errors.

Version/Commit

You can find this information under Information/System Information

Environment information

GeorgeK07 commented 3 months ago

I second this, have the exact same issue, also using Windows 10 (22H2 19045.4651 if it matters) with MSYS2 GCC in the MSYS environment. I also tried with WSL2 Ubuntu, and a Debian Docker built from this libretro-build-devkitpro repo https://gitlab.incom.co/libretro-infrastructure/libretro-build-devkitpro, though I am unsure if this is still used.

All required packages to my knowledge are up to date in each environment (MSYS, WSL Ubuntu, Debian Docker), which might be reason why it doesn't compile, might need older versions of packages. In addition, all RetroArch sources are up to date at commit 571ae9f. I compared all the logs for each environment and the WSL2 Ubuntu and Debian Docker were identical, and the MSYS2 log was also identical except for line breaks. I compared both of our logs and everything matched except for the flag for optimisation -O0 -g being -O3, -std=gnu2x being -std=gnu99, and a warning being interpreted as an error in my build log.

This may be unnecessary information but the libretro core that was being statically compiled into the RetroArch 3DS executable was libretro-fbneo but only compiled with the NeoGeo driver included, following the steps here https://github.com/libretro/FBNeo/issues/1075. In addition, I tried again with the libretro-2048 core, and nothing changed. However, I don't know if the build even got far enough to include the core for it to matter.

Attached are the logs for each environment. Debian_Docker_RetroArch_3DS_Log.txt MSYS_RetroArch_3DS_Log.txt WSL2_Ubuntu_RetroArch_3DS_Log.txt

GeorgeK07 commented 3 months ago

I managed to build RetroArch using an Ubuntu Docker from https://git.libretro.com/libretro-infrastructure/libretro-build-devkitpro, specifically using the 'Dockerfile.ctr-legacy' Dockerfile, built a Docker, then followed all the steps in the Wiki and was able to compile RetroArch. I compiled it with the libretro-2048 core for testing purposes, though I assume other cores will work fine. I tested the retroarch_3ds.3dsx and retroarch_3ds.cia files built with it on my Old 3DS XL, and both worked.

Here's line-by-line each command I used: (Make sure you have Git and Docker or Docker Desktop installed and running) (I used PowerShell on Windows though it shouldn't be much different on other Operating Systems) git clone https://git.libretro.com/libretro-infrastructure/libretro-build-devkitpro.git docker build libretro-build-devkitpro -f libretro-build-devkitpro\Dockerfile.ctr-legacy docker image ls (this allows you to see what the Image ID of the Docker image is) docker tag INSERT-IMAGE-ID INSERT-WANTED-IMAGE-NAME (to change the Docker image name to something more memorable) docker run -it INSERT-WANTED-IMAGE-NAME /bin/bash (creates and runs container using Docker image for the first time and puts you at a bash shell)

From here you can simply follow the steps on the Wiki and build any Libretro cores and RetroArch. The home directory for the Docker container is the directory /developer (this is not in the /home directory). In addition, since this is an older version of the toolchain with ctrulib 1.1.0, you do not need to type USE_CTRULIB_2=1 when using make.

Once RetroArch has been built with any cores, said cia and 3dsx files can be moved out of the container and onto your actual computer using these commands: (The container must still be running) (Can also use Docker Desktop and go to the 'Files' tab in the container) docker ps (this allows you to see what the container's Container ID or Name is, as long as it is still running) docker container rename INSERT-CONTAINER-ID-OR-NAME INSERT-NEW-CONTAINER-NAME (to change the container name to something more memorable) docker cp INSERT-NEW-CONTAINER-NAME:/path/to/file/on/docker/image "X:\path\to\target\folder\on\actual\computer"

Exiting the container's shell from a first-time run will stop it. To access your container again (which contains all the files you have made and downloaded) after it has been exited, run these commands: docker start INSERT-NEW-CONTAINER-NAME docker exec -it INSERT-NEW-CONTAINER-NAME /bin/bash

To stop the container when run like this, run this command: docker stop INSERT-NEW-CONTAINER-NAME

I hope this helps you and anyone else who is struggling with compiling RetroArch for 3DS.