Skip to content

Makefile: let platform=unix build without OpenGL - #215

Open
sunlollyking wants to merge 1 commit into
libretro:masterfrom
sunlollyking:allow-building-without-opengl
Open

Makefile: let platform=unix build without OpenGL#215
sunlollyking wants to merge 1 commit into
libretro:masterfrom
sunlollyking:allow-building-without-opengl

Conversation

@sunlollyking

@sunlollyking sunlollyking commented Aug 7, 2026

Copy link
Copy Markdown

platform=unix links -lGL and sets HAVE_OPENGL=1 unconditionally on x86 and
x86_64:

ifneq ($(filter $(ARCH),x86 x86_64),)
  LIBS += -lGL
  HAVE_OPENGL=1
endif

So the core cannot be built at all for a system that provides only OpenGL ES —
the link fails with cannot find -lGL.

There is no GLES fallback to reach for instead. Makefile.common gates the
renderer on HAVE_OPENGL and compiles glsym_gl.c, and the HAVE_OPENGLES3
that the platform table sets for the ARM boards (rpi4_64, odroidc4 and
friends) is never read by the build or by any source — those targets link
-lGLESv2 but build the software renderer regardless. glsym_es3.c ships in
the vendored libretro-common but is never added to SOURCES_C.

This adds DISABLE_OPENGL so such systems can build the software renderer,
which is what they would end up running in any case:

make platform=unix DISABLE_OPENGL=1

Why a new variable and not HAVE_OPENGL=0

That was my first attempt and it is wrong. HAVE_OPENGL := 0 is set at the top
of the Makefile, so it is already 0 when the platform block is evaluated — a
guard of ifneq ($(HAVE_OPENGL), 0) never passes, and OpenGL ends up disabled
for everyone. A separate opt-out variable avoids the ordering entirely.

Verified

With ARCH=x86_64, comparing make platform=unix -n before and after:

-lGL linked GPU_OpenGL objects
upstream today yes 2
this change, default yes 2
this change, DISABLE_OPENGL=1 no 0

Also built and installed end to end against a GLES-only sysroot.

Found packaging melonDS for LibreELEC, whose default x86_64 image is GLES-only.

The unix platform links -lGL and sets HAVE_OPENGL=1 unconditionally on x86 and
x86_64, so the core cannot be built for a system that provides only OpenGL ES.
There is no GLES fallback to reach for either: Makefile.common gates the
renderer on HAVE_OPENGL and compiles glsym_gl.c, and the HAVE_OPENGLES3 the
platform table sets for the ARM boards is never read by anything.

Add DISABLE_OPENGL so those systems can build the software renderer, which is
what they would end up using in any case:

  make platform=unix DISABLE_OPENGL=1

A separate variable rather than HAVE_OPENGL=0, because HAVE_OPENGL is
initialised to 0 at the top of this file and so is already 0 when the platform
block is evaluated. Default behaviour is unchanged.
@sunlollyking
sunlollyking force-pushed the allow-building-without-opengl branch from 90fedee to fab8107 Compare August 7, 2026 14:14
sunlollyking added a commit to sunlollyking/LibreELEC.tv that referenced this pull request Aug 10, 2026
melonDS is a Nintendo DS emulator. Its libretro core is desktop-GL only -- the
renderer is gated on HAVE_OPENGL and compiles glsym_gl.c, and the HAVE_OPENGLES3
its platform table sets is never read -- so it takes OpenGL where the project
provides it and the software renderer everywhere else. DS runs well on the
latter, which is what the ARM targets would have been getting in any case.

The patch adding DISABLE_OPENGL is submitted upstream as
libretro/melonDS#215
kel-mo added a commit to kel-mo/tv.kodi.Kodi that referenced this pull request Aug 16, 2026
Port the new libretro cores from LibreELEC PRs #11656 (melonDS,
Yaba Sanshiro) and #11668 (Dolphin).

melonDS builds the software renderer only: its OpenGL renderer is
desktop-GL only and useless under a GLES Kodi. Carries the pending
upstream patch (libretro/melonDS#215) adding DISABLE_OPENGL, and links
with -Wl,-z,noexecstack so Kodi can dlopen a core whose assembly lacks
GNU-stack notes. Yaba Sanshiro builds its GLES path via FORCE_GLES=1;
its core is pinned to the yabasanshiro branch head of libretro/yabause.

Dolphin builds with USE_SYSTEM_LIBS=ON instead of its vendored
Externals. The freedesktop 25.08 runtime provides most of them (fmt,
glslang, xxhash, zlib, zstd, lz4, lzo2, bzip2, xz, curl, libusb);
enet, libspng, minizip-ng, mbedtls 2.28 (dolphin requires the 2.28
branch), SFML 3.0.x (3.1 grew a hard libssh2 dependency the runtime
lacks; checker constrained below it) and hidapi are added as dependency
modules. The only vendored code left is dolphin's own in-tree glue plus
six pinned header/wrapper submodules (imgui, implot, tinygltf, watcher,
cpp-ipc, cpp-optparse) that have no system equivalent. Core commits
match each kodi-game addon's depends pin.

Dolphin's Sys support data (its own redistributable free DSP ROM and
font replacements, per-game settings) is installed from the core source
into the addon's install path resources, giving a working core with no
user setup: Kodi hands that directory to the core when the profile
resources dir is empty, and dolphin's writes go to the libretro save
dir. Vulkan and X11 are off; RetroPlayer is GL/GLES only.

Verified at runtime on x86_64: dolphin boots GameCube titles and, with
the RetroPlayer hardware rendering PR stack, is fully playable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant