Skip to content

libretro: add melonDS DS core#521417

Closed
ferguscollins wants to merge 2 commits into
NixOS:masterfrom
ferguscollins:master
Closed

libretro: add melonDS DS core#521417
ferguscollins wants to merge 2 commits into
NixOS:masterfrom
ferguscollins:master

Conversation

@ferguscollins

@ferguscollins ferguscollins commented May 18, 2026

Copy link
Copy Markdown

The melonDS DS core supersedes melonDS which is now deprecated, see below libretro docs for information on the new core:

https://github.com/libretro/docs/blob/master/docs/library/melonds_ds.md

Things done

  • Built on platform:
    • x86_64-linux - failed build locally due to below git error
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage. - failed build locally due to below git error
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking. - n/a
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module. - n/a
    • Module update: when the change is significant. - n/a
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Maintainers

@aanderse @thiagokokada

Help needed

I am having trouble building with the command provided in the README. I am unsure what is incorrect in my implementation to cause the build to try and clone the incorrect URL, any help would be appreciated.

$ nix-build -A libretro.melonds-ds

.
.
.

Last 25 log lines:
       > Cloning into 'melonds-src'...
       > fatal: unable to access 'https://github.com/JesseTG/melonDS/': Could not resolve host: github.com
       > Cloning into 'melonds-src'...
       > fatal: unable to access 'https://github.com/JesseTG/melonDS/': Could not resolve host: github.com
       > Had to git clone more than once: 3 times.
       > CMake Error at melonds-subbuild/melonds-populate-prefix/tmp/melonds-populate-gitclone.cmake:50 (message):
       >   Failed to clone repository: 'https://github.com/JesseTG/melonDS'

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 12.first-time contribution This PR is the author's first one; please be gentle! labels May 18, 2026
@ferguscollins ferguscollins force-pushed the master branch 2 times, most recently from efd69e7 to 7432766 Compare May 18, 2026 02:04
this core supersedes melonds which is now deprecated

see below libretro docs for information on the new core:

https://github.com/libretro/docs/blob/master/docs/library/melonds_ds.md
@ferguscollins

Copy link
Copy Markdown
Author

@aanderse @thiagokokada I will likely not be available for debug until EU evening time, but will try to reply as soon as possible if you give feedback.

@ferguscollins

Copy link
Copy Markdown
Author

Had a quick look at lunch and the part of the build related to the functions used in this repo seem to be working correctly, and this is entirely down to the build being with --option sandbox true which denies internet access inside the cmake, preventing fetch. Do either of you have an example core I can look at to see how to get around this?

There is a PR in the melonds-ds repo itself to change the clone to a http get request but this would not resolve this issue: JesseTG/melonds-ds#238

@thiagokokada

Copy link
Copy Markdown
Contributor

Had a quick look at lunch and the part of the build related to the functions used in this repo seem to be working correctly, and this is entirely down to the build being with --option sandbox true which denies internet access inside the cmake, preventing fetch. Do either of you have an example core I can look at to see how to get around this?

Relaxing the sandbox is not the way to do it. If the build system is downloading artefacts during build I suggest you to do pre-download them before-hand.

BTW, there is already a PR to add melonds-ds: #475067.

@ferguscollins

Copy link
Copy Markdown
Author

Relaxing the sandbox is not the way to do it. If the build system is downloading artefacts during build I suggest you to do pre-download them before-hand.

Yes, agreed. I gave predownloading a quick go last night but was running into a cascade of build errors afterwards which I didn't write up here before I went to bed.

BTW, there is already a PR to add melonds-ds: #475067.

Thanks, in that case I'll close this.

I'll push the changes I was making here when I get home for posterity's sake.

@ferguscollins

Copy link
Copy Markdown
Author

Commenting the status I was seeing before I closed this. No need to continue here if the other PR is ready.


Currently there seem to be three predominant issues:

  1. zlib is trying to rename its own files causing the following error:
-- Renaming
--     /nix/store/lw5yk36dsq4jas3h9jf74b0x2zh4c0k5-source/zconf.h
-- to 'zconf.h.included' because this file is included with zlib
-- but CMake generates it automatically in the build directory.
CMake Error at /nix/store/lw5yk36dsq4jas3h9jf74b0x2zh4c0k5-source/CMakeLists.txt:76 (file):
  file RENAME failed to rename

    /nix/store/lw5yk36dsq4jas3h9jf74b0x2zh4c0k5-source/zconf.h

  to

    /nix/store/lw5yk36dsq4jas3h9jf74b0x2zh4c0k5-source/zconf.h.included

  because: Permission denied
  1. example and example64 are built but the fetch is not defined in advance, so I don't know where I can provide it a cache. I don't even know what they are.
CMake Error at /nix/store/zipr7a2ii2diinl3vs1xw43bi53062cr-source/cmake/FetchDependencies.cmake:82 (set_target_properties):
  set_target_properties Can not find target to add properties to: example
Call Stack (most recent call first):
  /nix/store/zipr7a2ii2diinl3vs1xw43bi53062cr-source/CMakeLists.txt:88 (include)


CMake Error at /nix/store/zipr7a2ii2diinl3vs1xw43bi53062cr-source/cmake/FetchDependencies.cmake:84 (set_target_properties):
  set_target_properties Can not find target to add properties to: example64
Call Stack (most recent call first):
/nix/store/zipr7a2ii2diinl3vs1xw43bi53062cr-source/CMakeLists.txt:88 (include)
  1. One of several of the fetches are possibly failing silently causing core to not be built. I suspect that the hyphenated dependencies are the issue as I cannot get them to reference the local cache, resulting in the following behaviour:

a. The fetches claim that they will fetch from the remote instead of using the local cache, but do not fail for being in sandbox mode before the other failures occur.

-- Using melonDS: /nix/store/zipr7a2ii2diinl3vs1xw43bi53062cr-source (local)
-- Using libretro-common: https://github.com/JesseTG/libretro-common (ref 8e2b884)
-- Using embed-binaries: https://github.com/andoalon/embed-binaries (ref 078b62b)
-- Using glm: /nix/store/s6q0bfq9yankx21qg5rxg7p1a3hkjnws-source (local)
-- Using libslirp: /nix/store/cpygv15l85rmqw15w2gw4x3jc0chvvcd-source (local)
-- Using pntr: /nix/store/xxps17kax719khcq3267lgbhqq9gsdlr-source (local)
-- Using fmt: /nix/store/nr82wflgrdisjc66djlsvbs5vsjdzb5q-source (local)
-- Using yamc: /nix/store/gjwrj7dr3my8dj89hrf3ccc97w3ikccy-source (local)
-- Using span-lite: https://github.com/martinmoene/span-lite (ref 00afc28)
-- Using date: /nix/store/l3zdmr181j1jv0xn37rp0whdag287h3p-source (local)
-- Using zlib: /nix/store/lw5yk36dsq4jas3h9jf74b0x2zh4c0k5-source (local)

b. core is then not present further on

CMake Error at /nix/store/zipr7a2ii2diinl3vs1xw43bi53062cr-source/cmake/ConfigureFeatures.cmake:252 (target_compile_definitions):
  Cannot specify compile definitions for target "core" which is not built by
  this project.
Call Stack (most recent call first):
  /nix/store/zipr7a2ii2diinl3vs1xw43bi53062cr-source/cmake/ConfigureDependencies.cmake:36 (add_common_definitions)
  /nix/store/zipr7a2ii2diinl3vs1xw43bi53062cr-source/CMakeLists.txt:90 (include)

c. embed-binaries is thrown under the bus first

-- melonDS DS version string: '1.2.0'
CMake Error at /nix/store/zipr7a2ii2diinl3vs1xw43bi53062cr-source/src/libretro/CMakeLists.txt:4 (include):
  include could not find requested file:

    embed-binaries


CMake Error at /nix/store/zipr7a2ii2diinl3vs1xw43bi53062cr-source/src/libretro/CMakeLists.txt:134 (embed_binaries):
  Unknown CMake command "embed_binaries".

I suspect that these three issues are actually separate and will not fix each other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants