mGBA Forums
3DS build environment - Printable Version

+- mGBA Forums (https://forums.mgba.io)
+-- Forum: mGBA (https://forums.mgba.io/forumdisplay.php?fid=1)
+--- Forum: General (https://forums.mgba.io/forumdisplay.php?fid=3)
+--- Thread: 3DS build environment (/showthread.php?tid=348)



3DS build environment - thammi - 12-08-2015

Hello,
I found this project searching for homebrew software on the 3DS. My last handheld before the 3DS was a GBA and I was happy to get a chance to play those games again. Thanks for your work! Some games are having performance issues on the N3DS right now and I would like to look into possible performance enhancements. I have experience in embedded development but am new to emulators.

Unfortunately I was not able to build mGBA for the 3DS. Are the build scripts for 3DS included in the repository or do you use a custom setup which is not included? Could you please help me setup the build system? I have devkitARM and libctru installed and was able to build other homebrew applications.

Thanks in advance and thanks again for your work on this project!

Greetings
Thammi

edit: just noticed that I was working on the release tarball and not the git master ... making some progress now.


RE: 3DS build environment - thammi - 12-08-2015

Hi,
I was able to figure it out. For anyone else who tries to compile for 3ds here the steps I used:

Code:
export DEVKITPRO=... DEVKITARM=...
git clone https://github.com/mgba-emu/mgba.git
mkdir mgba/build
cd mgba/build
cmake -DCMAKE_TOOLCHAIN_FILE=../src/platform/3ds/CMakeToolchain.txt ..
make

You obviously have to have devkitpro/devkitarm and libctru installed. I additionally had to download and build picasso and bannertool. To help cmake find the executables I linked them into the bin directory of devkitarm. There were problems building the .cia, but I just commented out its block in src/platform/3ds/CMakeLists.txt as I don't need it.

Hope this helps someone.


RE: 3DS build environment - Robin - 02-06-2016

(12-08-2015, 08:01 PM)thammi Wrote: Hi,
I was able to figure it out. For anyone else who tries to compile for 3ds here the steps I used:


Code:
export DEVKITPRO=... DEVKITARM=...
git clone https://github.com/mgba-emu/mgba.git
mkdir mgba/build
cd mgba/build
cmake -DCMAKE_TOOLCHAIN_FILE=../src/platform/3ds/CMakeToolchain.txt ..
make

You obviously have to have devkitpro/devkitarm and libctru installed. I additionally had to download and build picasso and bannertool. To help cmake find the executables I linked them into the bin directory of devkitarm. There were problems building the .cia, but I just commented out its block in src/platform/3ds/CMakeLists.txt as I don't need it.

Hope this helps someone.

Hi thammi,

I followed your steps, but I got this error:

$ cmake -DCMAKE_TOOLCHAIN_FILE=../src/platform/3ds/CMakeToolchain.txt ..

-- Building for: NMake Makefiles

-- The C compiler identification is unknown

CMake Error at CMakeLists.txt:2 (project):

  The CMAKE_C_COMPILER:



    .../bin/arm-none-eabi-gcc.exe



  is not a full path and was not found in the PATH.



  To use the NMake generator with Visual C++, cmake must be run from a shell

  that can use the compiler cl from the command line.  This environment is

  unable to invoke the cl compiler.  To fix this problem, run cmake from the

  Visual Studio Command Prompt (vcvarsall.bat).



  Tell CMake where to find the compiler by setting either the environment

  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to

  the compiler, or to the compiler name if it is in the PATH.





-- Configuring incomplete, errors occurred!

See also "C:/devkitPro/3DS/mgba/build/CMakeFiles/CMakeOutput.log".

See also "C:/devkitPro/3DS/mgba/build/CMakeFiles/CMakeError.log".

I tried to set CMAKE_C_COMPILER to arm-none-eabi-gcc.exe but it didn't work. Did you happen to have this error too? And how did you fix it? Many thanks for help.


RE: 3DS build environment - endrift - 02-06-2016

Please delete the build directory, remake it, and try again, adding -G "Unix Makefiles" to the arguments to cmake.


RE: 3DS build environment - Robin - 02-07-2016

(02-06-2016, 11:54 PM)endrift Wrote: Please delete the build directory, remake it, and try again, adding -G "Unix Makefiles" to the arguments to cmake.

Many thanks. That worked Smile
However I got an error at creating the .smdh file.

Code:
Scanning dependencies of target mgba.3dsx

[ 98%] Generating mgba.smdh
make[2]: *** [3ds/mgba.smdh] Error 57
make[1]: *** [3ds/CMakeFiles/mgba.3dsx.dir/all] Error 2
make: *** [all] Error 2

I thought smdhtool.exe was missing, but it's there in devkitARM/bin. As a workaround I commented out smdh creation in the cmakelists.txt since I can use the .smdh file from the official download package. Still I need to get this sorted out for .cia file creation.