mkxp-z / mkxp-z

Open-source cross-platform player for (some) RPG Maker XP / VX / VX Ace games. A very heavily modified fork of mkxp. RGSS on steroids with a stupid name.
https://github.com/mkxp-z/mkxp-z/wiki
GNU General Public License v2.0
140 stars 39 forks source link

Static linking of ruby is broken #185

Open Speak2Erase opened 1 month ago

Speak2Erase commented 1 month ago

Ruby's pkg-config file sets its libraries to the shared library:

LIBPATH=@LIBPATH@
LIBRUBY_A=lib${RUBY_SO_NAME}-static.a
LIBRUBY_SO=lib${RUBY_SO_NAME}.${SOEXT}.${RUBY_PROGRAM_VERSION}
LIBRUBY=${LIBRUBY_SO}
LIBRUBYARG_SHARED=-Wl,-rpath,${libdir} -L${libdir} -l${RUBY_SO_NAME}
LIBRUBYARG_STATIC=-Wl,-rpath,${libdir} -L${libdir} -l${RUBY_SO_NAME}-static ${MAINLIBS}

Libs: ${DLDFLAGS} ${LIBRUBYARG_SHARED} ${LIBS}

In my testing this seems to always be the case, even when you tell ruby not to build a shared library.

Without a small patch to ruby-3.1.pc replacing LIBRUBYARG_SHARED with LIBRUBYARG_STATIC, meson will be unable to find the ruby static library. Manually using mri_library seems to be broken too and either causes meson to fail to find libruby-static.a, or not link ruby at all