Skip to content

Conversation

@iory
Copy link
Contributor

@iory iory commented Jan 5, 2026

Summary

Fix segmentation fault on newer macOS versions (Darwin 25.x / macOS 26).

Problem

On newer macOS, dlsym(0, "history") returns libedit's history function instead of EusLisp's ___history function. This causes a segmentation fault when loading modules during the build process (e.g., when compiling with eusgl).

The issue occurs because:

  1. When OpenGL libraries are loaded, libedit gets loaded as a dependency
  2. dlopen(0, RTLD_LAZY|RTLD_GLOBAL) with -flat_namespace makes all loaded library symbols visible
  3. dlsym finds libedit's history before EusLisp's ___history

Solution

Reverse the symbol lookup order to first try the ___ prefixed symbol name, then fall back to the raw name. This avoids conflicts with system library symbols.

Testing

Tested on macOS with Darwin 25.2.0 - eusgl and irteusgl build and run successfully after this fix.

On newer macOS versions (Darwin 25.x), dlsym(0, "history") returns
libedit's history function instead of EusLisp's ___history function,
causing a segmentation fault when loading modules.

This change reverses the symbol lookup order to first try the ___
prefixed symbol name, avoiding conflicts with system library symbols.
@iory
Copy link
Contributor Author

iory commented Jan 5, 2026

Wainting for #539

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