libretro / scummvm

ScummVM main repository
https://www.scummvm.org
GNU General Public License v3.0
5 stars 6 forks source link

Unable to cross-compile #1

Closed ner00 closed 1 year ago

ner00 commented 1 year ago

I'm trying to build from this repo but I'm having trouble getting it to compile for Windows x64 under Linux x64. I'm running libretro's MXE environment from their docker image, as I've done for diablodiab's libretro-scummvm-backend.

Typically I would simply run this: platform=win TOOLSET="x86_64-w64-mingw32.static-" make

Unfortunately it doesn't seem to acknowledge the platform parameter, it always attempt to build for Linux anyway.

Any suggestions?

spleen1981 commented 1 year ago

Should be fixed in current master, you can try running same command as above.

ner00 commented 1 year ago

I tried it and now starts cross-compiling as expected but eventually fails with the following error:

Compiling fluid_sys.c...
Compiling fluid_tuning.c...
Compiling fluid_voice.c...
Compiling bitreader.c...
Compiling cpu.c...
Compiling crc.c...
Compiling fixed.c...
Compiling format.c...
Compiling lpc.c...
Compiling md5.c...
Compiling memory.c...
Compiling metadata_object.c...
make: *** No rule to make target 'libretro-deps/libFLAC/share/win_utf8_io/win_utf8_io.o', needed by 'libdeps.a'.  Stop.
make: *** Waiting for unfinished jobs....
Compiling stream_decoder.c...

The job stops right here.

ner00 commented 1 year ago

I pulled you latest commit https://github.com/spleen1981/scummvm-mainline-libretro/commit/4427c21bba9619cb55cc86f016d237800fc6328d and the build has progressed further, but then gave me this error:

cp: -r not specified; omitting directory '/scummvm-mainline-libretro/build/../dist/tmp'
Makefile.common:543: recipe for target 'scummvm.zip' failed
make: *** [scummvm.zip] Error 1
make: *** Waiting for unfinished jobs....

If I manually run bundle_datafiles.sh without arguments, I get this:

root@92910c4c7c03:/scummvm-mainline-libretro/build# ./bundle_datafiles.sh       
./bundle_datafiles.sh: line 73: [: =: unary operator expected
./bundle_datafiles.sh: line 74: [: =: unary operator expected
scummvm.zip created successfully

If I manually run bundle_datafiles.sh with bundle argument, I get this:

root@92910c4c7c03:/scummvm-mainline-libretro/build# ./bundle_datafiles.sh bundle
cp: -r not specified; omitting directory '/scummvm-mainline-libretro/build/../dist/tmp'

The latter doesn't create scummvm.zip and is incidentally the same error as the one thrown by the make process.

spleen1981 commented 1 year ago

can you check df75d46188ba67e84fdedc83ddaa1baf2881b8d2

ner00 commented 1 year ago

Alright, it build fine now, thanks!

I have a couple remarks and questions though, and I'll use this issue to mention them and not open any new issue unless necessary to expand on any of them:

  1. Is there a particular reason why the scummvm submodule is linked to commit https://github.com/scummvm/scummvm/commit/4bf45d922baaf68552c9936491d34361ffb467f2 instead of the current master repo? Is this a conscious decision regarding stability or for technical reasons maybe?
  2. The compiled binary is named scummvm_mainline_libretro, which requires to rename it to scummvm_libretro every time. Is this also a conscious decision to set it apart from the current/legacy libretro core?
  3. The core doesn't show its version or git commit when loaded in RetroArch, it simply has ScummVM mainline. Ideally it should be ScummVM mainline (2.6.1 4bf45d9)
  4. The Classic Theme bundled with scummvm.zip is redundant, the binary already includes this resource inside itself, so it should be removed from the bundle.

Thank you.

spleen1981 commented 1 year ago
  1. That commit corresponds to ScummVM 2.6.1 release. Intent is to have as default a libretro core stable and aligned to official ScummVM releases (also WIP engines are disabled as indicated in README.md). Submodule reference commit will be updated to next official release when the time comes. You can switch to branch "2.7.0-git" to play with upstream master, and set NO_WIP=0 to enable WIP engines.

  2. The library name is intentionally different, as it can still be distributed along with the old libreretro core (e.g. Lakka) and it would be obviously in conflict. Eventually the "_mainline" will be removed (if and when the old core will be dismitted...).

  3. That's strange, current code should print core tag (e.g. v2.6.1.1) if available, or hash-upstream version as a fallback (e.g. 92894c3-2.6.1). Going with the latter in my builds. Can you provide the output of git describe --tags and git rev-parse --short HEAD from the core local repo? You can split this bullet as a separate issue if you like.

  4. That's retrieved automatically from themes list indicated in their sources, better to avoid complicating the build scripts with manual exclusions and keep the additional 14kB zip file with us...

ner00 commented 1 year ago

Thanks for clarifying everything, it all makes sense.

As for libretro/scummvm-upstream#3, thanks for the suggestion, it helped me realize that I keep forgetting that the docker image runs with a different ownership, which is why this happens:

root@62e1a031c685:/scummvm-mainline-libretro# git describe --tags
fatal: unsafe repository ('/scummvm-mainline-libretro' is owned by someone else)
To add an exception for this directory, call:

    git config --global --add safe.directory /scummvm-mainline-libretro

Issuing that command to create an exception fixes it.