Zero2029: How to build and compile RetroArch (Xcode 7)

Hello everyone! Many of you have been asking for help to learn how to build and compile RetroArch for iOS on you non-jailbroken iPhone. I have to say that RetroArch for iOS is working great in its current state but not perfected yet. Anyhow, here is the guide which I modified from Rapsac’s post… essentially it is the very same explanation I would have given but with modifications: give Rapsac credit too for demonstrating before.

To start you’ll need:

[ol] [li]A Mac with Xcode 7 (download from the Mac App store)[/li][li]An iOS device running iOS 9 or later[/li][li]An Apple ID[/li][/ol]

First, you’ll need the source code:

[ol] [li]Open Xcode 7[/li][li]Go to the Source control menu > Check out[/li][li]Enter: https://github.com/libretro/RetroArch.git and download the directory files to your desktop, documents or wherever you choose.[/li][li]Select the “master” branch.[/li][li]You can also use Terminal to download the RetroArch directory. Just open Terminal and type “cd desktop” then type “git clone https://github.com/libretro/RetroArch.git” of course without these “ symbols. RetroArch folder should download to your Desktop.[/li][/ol]

Next we need to make an iPhone developer certificate to ‘codesign’ the app and its cores. This can be done with just an Apple ID and not a paid developer account thanks to Xcode 7 and iOS 9:

[ol] [li]In Xcode 7 go to Xcode>Preferences and then click on the accounts tab.[/li][li]Sign in with your Apple ID and click on ‘view details’[/li][li]Click on the create button next to iOS development.[/li][li]Alternatively to the Above this can be done through keychain access>certificate assistant>create a certificate>iOS development.[/li][/ol]

Then we need to build the base Retroarch App:

[ol] [li]In Xcode go to Window>Projects and select the Retroarch (or Retroarch_ios) project. This will be here if you correctly downloaded the source code through Source control menu > Check out. *Alternatively go to your downloaded RetroArch folder then open the RetroArch_iOS.xcodeproj file inside RetroArch/pkg/Apple/RetroArch_iOS.xcodeproj.[/li][li]You should see the project open up… let it load.[/li][li]Connect you iOS device by USB[/li][li]Select your device as the target in the top leftish corner next to the play and stop buttons.[/li][li]Select RetroArch (not RetroArch iOS6) for the TARGET on the left. Then under the general tab in the centre of the window, under Identity give your bundle identifier a unique name e.g. com.<anything>.RetroArch, you could use com.new4ios.RetroArch as long as that its never been used for an App before.[/li][li]Also under Identity, select your iOS development licence under Team, if you don’t see your licence here, select add an account and follow the prompts. After selecting your Team it will prompt you with another message: ‘No matching provisioning profiles found’. Click on ‘Fix Issue’ and you’re set.[/li][li]Under the general tab in the centre of the window, under ‘Deployment Info’ select iOS 9 as the Deployment target[/li][li]You might se a yellow Triangle symbol indicating to “Update to recommended settings.” Go ahead and update to recommended settings.[/li][li]Not to sure if this step is necessary but Select “Product” at the top then select “Scheme” then “Edit Scheme.” A window should pop up. Change everything in all sections (Build,Run,Test,Profile,Analyze, and Archive) from “Debug” to “Release.” Close the window afterwards.[/li][li] This step is necessary otherwise you will get nothing but errors and you won’t be able to build/compile RetroArch correctly. Go to your downloaded RetroArch folder and open it. Look for the “media” folder and open it. Create these folders: assets, autoconfig, cores, libretrodb (inside libretrodb folder create: cut,cursors and rdb folders), overlays and shaders_glsl. You don’t have to put the necessary files in them but go ahead and do so if you prefer.[/li][li]Now if you’re ready for PRIME time let us build and compile RetroArch. Make sure to select your device as the target in the top leftish corner next to the play and stop buttons. Now click on the Play button to build and run the current scheme… let it finish. It will give you a few errors along the way but don’t worry RetroArch will be installed on our phone. If the iOS simulator opens just close it.[/li][li]Congratulatons!!! RetroArch should be installed if you followed instructions and did everything correctly. However, we’re not done yet. We need to codesign the cores. Keep reading below to learn how to coding the cores.[/li][/ol]

DO THIS STEP ONLY IF YOU WANT AN ARCHIVED VERSION WHICH YOU CAN TURN INTO AN IPA Go to Product>Archive to build the App, this may fail due to licensing, if this happens you should see a window popup with a ‘fix issue’ button. Click this button to fix the issue and It should compile successfully. An archives window will popup when you successfully build the app. In case you close the window that pops up go to ‘Window’ and then ‘Organizer’. There you should see you archived version of RetroArch. You can right click and then click on ‘Show in Finder’. Then right click the archive again and choose ‘Show Package Contents’. In there you will see its contents.

The App has now been signed by compiling with your Apple ID developer licence, now we need to get and codesign the cores:

[ol] [li]Download the latest iOS 9 cores from: http://buildbot.libretro.com/nightly/apple/ios9/[/li][li]Once downloaded, the cores will need to be codesigned. I feel this is easiest done in terminal, if you’re not familiar with terminal here is a basic guide:[/li][/ol]

[ul] [li]Open Terminal on your mac, Terminal should open up to your User folder on startup by default.[/li][li]You can see the folders in your current directory by typing the command ‘ls’ (without the quotation marks of course).[/li][li]You can change to a different directory by typing 'cd <name of directory> for example ‘cd Documents’ or ‘cd desktop’[/li][li]Navigate to the folder with the downloaded cores, again, you can see if you’re in the right place by typing ‘ls’. If you see the list of cores, you’re in the right place. Download the cores to your desktop to make it easier.[/li][li]Once here type the command: codesign -fs “iPhone Developer: <name or email> <(assorted numbers and letters here)>” <core name here>.dylib[/li][li]To find your developer details oper keychain access, and look for the iPhone Developer certificate under the ‘login’ tab[/li][li]An example might be: codesign -fs “iPhone Developer: [email protected] (X3D4A7892)” pcsx_rearmed_interpreter_libretro_ios.dylib[/li][li]If you’ve done this correctly Terminal should tell you that it is 'replacing existing signature’ but not necessarily.[/li][li]Your core is now codesigned! You can download iFunBox from the web and drag it into the cores folder on your phone.[/li][/ul]

Now you can run the app:

[ol] [li]On your iPhone go to settings>general>profiles and select your developer certificate[/li][li]Trust your provisioning profile[/li][li]Open the app[/li][li]Go to the ‘online updater’[/li][li]Update everything EXCEPT THE CORES, updating core info is fine.[/li][li]You’re good to go![/li][/ol]

Roms:

[ol] [li]Add roms using iFunBox. Go to RetroArch and create a folder or folders for your roms. Example: n64 roms or psx roms. Then drag the roms inside their corresponding folder.[/li][li]For the n64 roms to work you need to change the CPU Core from dynamic_recompiler to cahed_interpreter. If you can’t change it within the RetroArch app then manually do it. Open ifunbox and open RetroArch. Navigate to the ‘configs’ folder and open it. In there you should see a file ‘retroarch-core-options.cfg’. Drag it to your desktop and open it. I use windows notepad to edit it. Now edit these lines and change to: mupen64-cpucore = “cached_interpreter” and thats it. Now drag this new edited file back to the ‘configs’ folder and delete the old one.[/li][li]The n64 core should load up and run roms without a problem now.[/li][/ol]

Bios:

[ol] [li]PSX bios should be copied to the System folder with iFunBox[/li][/ol]

1 Like

everything went smooth except tons of yellow warnings in xcode 7 which I guess is normal…

just one question,

when I try to move the codesigned cores I cannot find any “cores” folder in iexplorer or ifunbox, should I have root access (jailbreak) to move the cores to the right place?

edit: oh and btw, the app crashes after the build everytime I open it, will it be fixed after I move the cores?

The app shouldn’t be crashing if everything was done correctly. However, what Iphone do you have and iOS version? I’m just trying to figure out why it’s crashing. I’ve build and compiled RetroArch many times without a problem. I highly believe that it has nothing to do with the cores. Please try it again and let me know how it goes.

Latest OSX El Capitan and latest Xcode 7, iOS 9.1 running on iPhone 6s.

Tried building again and same result…

Hello,

I seem to be getting a crash as well, it never gets past the splash screen with the LibRetro logo. I’ve copied and pasted the output from the debugger below although I’m not sure if it helps. I tried turning debugging back on by switching everything back from release to debug but it still doesn’t give a specific line where the error is occurring.

libsystem_kernel.dylib`__pthread_kill: 0x37913c7c <+0>: mov r12, #328 0x37913c80 <+4>: svc #0x80 -> 0x37913c84 <+8>: blo 0x37913c9c ; <+32> 0x37913c88 <+12>: ldr r12, [pc, #0x4] ; <+24> 0x37913c8c <+16>: ldr r12, [pc, r12] 0x37913c90 <+20>: b 0x37913c98 ; <+28> 0x37913c94 <+24>: .long 0x01ff2390 ; unknown opcode 0x37913c98 <+28>: bx r12 0x37913c9c <+32>: bx lr

I’m using Xcode 7.1 on El Capitan and my phone is an iPhone 6 Plus running iOS 9.1.

Let me know if you need any other info about the setting I’m using.

Cheers!

[QUOTE=BulkSlash;30002]Hello,

I seem to be getting a crash as well, it never gets past the splash screen with the LibRetro logo. I’ve copied and pasted the output from the debugger below although I’m not sure if it helps. I tried turning debugging back on by switching everything back from release to debug but it still doesn’t give a specific line where the error is occurring.

libsystem_kernel.dylib`__pthread_kill: 0x37913c7c <+0>: mov r12, #328 0x37913c80 <+4>: svc #0x80 -> 0x37913c84 <+8>: blo 0x37913c9c ; <+32> 0x37913c88 <+12>: ldr r12, [pc, #0x4] ; <+24> 0x37913c8c <+16>: ldr r12, [pc, r12] 0x37913c90 <+20>: b 0x37913c98 ; <+28> 0x37913c94 <+24>: .long 0x01ff2390 ; unknown opcode 0x37913c98 <+28>: bx r12 0x37913c9c <+32>: bx lr

I’m using Xcode 7.1 on El Capitan and my phone is an iPhone 6 Plus running iOS 9.1.

Let me know if you need any other info about the setting I’m using.

Cheers![/QUOTE] just apply this patch: diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index e0903f7…3b4561f 100644 — a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -368,7 +368,7 @@ static config_file_t *config_file_new_internal( return NULL;

if (!path || !*path)
  •  return conf;
    
  •  goto error;
    

    if (path_is_directory(path)) goto error; And you will pass the inital bug into the UI. After that there’re much more bugs, not sure whether I can figure all.

Thanks for the tip, I can get into the app now. I see what you mean about more errors after that! :slight_smile:

Another patch: diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 841cb7e…3d2523f 100644 — a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1068,6 +1068,7 @@ static int action_ok_download_generic(const char *path, #ifdef HAVE_NETWORKING char s[PATH_MAX_LENGTH]; char s2[PATH_MAX_LENGTH];

  • char s3[PATH_MAX_LENGTH]; settings_t *settings = config_get_ptr();

    fill_pathname_join(s, settings->network.buildbot_assets_url, @@ -1101,7 +1102,7 @@ static int action_ok_download_generic(const char *path, else strlcpy(s, settings->network.buildbot_url, sizeof(s));

  • fill_pathname_join(s, s, path, sizeof(s));
  • fill_pathname_join(s3, s, path, sizeof(s));

    strlcpy(core_updater_path, path, sizeof(core_updater_path));

@@ -1112,7 +1113,7 @@ static int action_ok_download_generic(const char *path,

menu_display_msg_queue_push(s2, 1, 90, true);
  • rarch_main_data_msg_queue_push(DATA_TYPE_HTTP, s,
  • rarch_main_data_msg_queue_push(DATA_TYPE_HTTP, s3, type_msg, 0, 1, true); #endif return 0;

after this the online updater could work.

Hey guys thanks for the info but why any of you help @twinaphex whit pull request in github? I think is the best way to fix ios9 RA build

[QUOTE=brujo5;30074]Hey guys thanks for the info but why any of you help @twinaphex whit pull request in github? I think is the best way to fix ios9 RA build

Zero2029, i have retroarch running on iOS 9.1, but i can’t load a core. i have signed and all that stuff, but it doesn’t load. Any idea how can i fix it?

[QUOTE=palxex;30068]just apply this patch: diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index e0903f7…3b4561f 100644 — a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -368,7 +368,7 @@ static config_file_t *config_file_new_internal( return NULL;

if (!path || !*path)
  •  return conf;
    
  •  goto error;
    

    if (path_is_directory(path)) goto error; And you will pass the inital bug into the UI. After that there’re much more bugs, not sure whether I can figure all.[/QUOTE]

Where i paste that patch?

To incognit:

Did you codesign the cores correctly with your developer certs using the command line? Let’s just say that your iOS 9 cores (dylibs) are on your desktop. Using terminal, type: ‘cd desktop’. Type without this symbol ’ of course. Then just type this command line to codesign the cores, example: codesign -fs “iPhone Developer: [email protected] (X3D4A7892)” pcsx_rearmed_interpreter_libretro_ios.dylib

To find your developer details open keychain access, and look for the iPhone Developer certificate under the ‘login’ tab. If you type this command twice Terminal should tell you that it is “replacing existing signature”. That’s a way of knowing that you did it correctly.

[QUOTE=Zero2029;30203]To incognit:

Did you codesign the cores correctly with your developer certs using the command line?[/QUOTE]

Yes! Also said replacing existing sign, something like that.

That’s really odd… If you signed them correctly it SHOULD WORK. How did you install RetroArch? Did you use Xcode 7 or what other method?

Used xcode 7.0.1 and deleted a code line, so retroarch stop crashing.

hmmm. I wonder now what the problem is…

Let me show you, what i deleted.

What line?

**input_remapping_load_file(settings->input.remapping_path);

And what made you erase a seemingly random line of code