libretro / libretro/parallel-n64

Question: Emscripten build and libretro-common

Open
#551 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
407
Forks
151
Avg merge
11h 53m
Merged PRs (30d)
11

Description

Hey all,

I was hoping to update @matthewbauer's work on building libretro cores for use directly in a Javascript host (https://github.com/matthewbauer/retrojs), and decided to start by building the latest parallel-n64 since I have not had success running a game with Matthew's fork of it and it's more than 3 years old now. However I'm unable to do the final link of parallel-n64.

+ emcc parallel_n64_libretro_emscripten.bc -o /root/retrojs/core/parallel-n64/core.js -O3 -Oz -s EMULATED_FUNCTION_POINTERS=2 -s TOTAL_MEMORY=134217728 -s EXPORTED_FUNCTIONS=@/root/retrojs/exports.json -s EXPORTED_RUNTIME_METHODS=@/root/retrojs/runtime_exports.json -s SHELL_FILE='/root/retrojs/shell.js' -s FORCE_FILESYSTEM=1
shared:WARNING: loading from archive rglgen.o, which has duplicate entries (files with identical base names). this is dangerous as only the last will be taken into account, and you may see surprising undefined symbols later. you should rename source files to avoid this problem (or avoid .a archives, and just link bitcode together to form libraries for later linking)
shared:WARNING:    duplicate: empty_dynarec.o
error: undefined symbol: convert_float_to_s16
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: convert_float_to_s16_init_simd
error: undefined symbol: convert_s16_to_float
error: undefined symbol: convert_s16_to_float_init_simd
error: undefined symbol: gl_check_capability
error: undefined symbol: retro_resampler_realloc
Error: Aborting compilation due to previous errors
shared:ERROR: '/root/emsdk/node/8.9.1_64bit/bin/node /root/emsdk/emscripten/1.38.20/src/compiler.js /tmp/tmp3Am_9V.txt /root/emsdk/emscripten/1.38.20/src/library_pthread_stub.js' failed (1)

These are all functions defined in libretro-common, and I see that the sources are included in the parallel-n64 repository but it looks like they don't get built, just used for the headers.

However, libretro-common itself does not have a top-level Makefile. Is the intention here that the frontend would provide these symbols by incorporating libretro-common into it's own build, and then the cores would use the host's implementation? Or am I missing something else?

I think in order to proceed I'll have to set up a build process for libretro-common to output a .bc target so I can use Emscripten's library linking process (http://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html#using-libraries), but this looks like a fair amount of work so I wanted to check if I'm on the right track.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the emcc command for parallel_n64_libretro_emscripten.bc and the libretro-common sources included in the parallel-n64 repository. Check how the listed undefined symbols are expected to be built and linked; completion means establishing a documented build/link path that produces the required bitcode and lets the final Emscripten link succeed.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, javascript
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.