Closed Marin-MK closed 2 years ago
General question is why do you link ruby statically and not dynamically like the rest?
This way you either need to build ruby without dlopen
capability, or add -ldl
to the linker.
I'm completely in the dark without a guide, and the guide author says he had trouble with doing it dynamically. Since I don't even know how that works, I'm just following the guide I linked.
Could you either tell me where I should add -ldl
to the linker, or how to build Ruby dynamically (and how to then include it mkxp or whatever)? Thanks for you help.
For a quick fix, you can add it like you added the static ruby library (just add another line with -ldl
in CMakeLists.txt
after it).
Also, can you upload your CMakeCache.txt
? Just drag/drop it into the editor field here, it will be uploaded.
I'm now getting a different error:
/usr/bin/ld: /usr/local/lib/libruby-static.a(thread.o): undefined reference to symbol 'pthread_setname_np@@GLIBC_2.12'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/mkxp.dir/build.make:1766: recipe for target 'mkxp.bin.x86_64' failed
make[2]: *** [mkxp.bin.x86_64] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/mkxp.dir/all' failed
make[1]: *** [CMakeFiles/mkxp.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
New CMakeCache: CMakeCache.txt
Bottom of my CMakeLists.txt:
target_link_libraries(${PROJECT_NAME}
${SIGCXX_LIBRARIES}
${SDL2_LIBRARIES}
${SDL2_IMAGE_LIBRARIES}
${SDL2_TTF_LIBRARIES}
${SDL_SOUND_LIBRARIES}
${PHYSFS_LIBRARIES}
${PIXMAN_LIBRARIES}
${Boost_LIBRARIES}
${MRI_LIBRARIES}
${VORBISFILE_LIBRARIES}
${FLUID_LIBRARIES}
${OPENAL_LIBRARY}
${ZLIB_LIBRARY}
${PLATFORM_LIBRARIES}
/usr/local/lib/libruby-static.a
-ldl
)
PostBuildMacBundle(${PROJECT_NAME} "" "${PLATFORM_COPY_LIBS}")
Looks like the MRI pkg-config file needs to be updated with -ldl and -lpthread?
2019年3月3日(日) 21:34 Marin notifications@github.com:
I'm now getting a different error:
/usr/bin/ld: /usr/local/lib/libruby-static.a(thread.o): undefined reference to symbol 'pthread_setname_np@@GLIBC_2.12' //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status CMakeFiles/mkxp.dir/build.make:1766: recipe for target 'mkxp.bin.x86_64' failed make[2]: [mkxp.bin.x86_64] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/mkxp.dir/all' failed make[1]: [CMakeFiles/mkxp.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Ancurio/mkxp/issues/218#issuecomment-469061348, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHpPkJxS9QfTxFQ4NcpSjN7_H4zhI9tks5vTDHdgaJpZM4bbMV4 .
Well this does only matter, because of manually adding the static library. The pkg-config file has them included.
Added -lpthread
underneath -ldl
and it raises yet another error.
/usr/bin/ld: /usr/local/lib/libruby-static.a(thread.o): undefined reference to symbol 'timer_settime@@GLIBC_2.3.3'
//lib/x86_64-linux-gnu/librt.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/mkxp.dir/build.make:1766: recipe for target 'mkxp.bin.x86_64' failed
make[2]: *** [mkxp.bin.x86_64] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/mkxp.dir/all' failed
make[1]: *** [CMakeFiles/mkxp.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I clearly don't know what I'm doing anymore, so could someone explain how to dynamically link Ruby instead of statically? And then any differences with compiling mkxp with ruby statically and dynamically. That'd be very much appreciated.
@Marin-MK The manpages tell me timer_settime
requires -lrt
. You could alternatively try using the dependency kit as described in the Readme, if you're just trying to hack on mkxp.
I basicly tried the same thing as @Marin-MK but i only could get it to work with Ruby v2.2.x - v2.5.x (i tried v2.1.x, v2.2.x, v2.3.x, v2.4.x, v2.5.x and v2.6.x) But even then, i still encountered a strange problem, as you can see here --> https://github.com/Ancurio/mkxp/issues/217 If i finally get it to work, i plan on making something like a docker container, which should make compiling much easier.
@Marin-MK The manpages tell me
timer_settime
requires-lrt
. You could alternatively try using the dependency kit as described in the Readme, if you're just trying to hack on mkxp.
My main goal is to slightly alter mkxp's source code. For that I wanted to use the hack at first, but I couldn't get it to work either. That's why I tried compiling it from source.
Having added -lrt
, -lgmp
, and -lcrypt
, it's now fully compiled and it looks like it works perfectly!
Only thing is that it keeps asking me how to run the file as you can see.
I did check the "Allow to execute this file" checkbox in Permissions, and I also tried via the command line with sudo chmod +x ./mkxpa.x86_64
. Any idea how I can get rid of that?
Any idea how I can get rid of that?
No clue; seems like it's related to the executable bit. You can check with ls -l
if it's properly set.
My main goal is to slightly alter mkxp's source code.
That's precisely why I made the depkit for..
Using ls -l
returns:
-rwxr-xr-x 1 marin marin 22788256 9 20:39 mkxp.x86_64
The prebuilt mkxp.amd64 and mkxp.x86 both have -rwxrwx---
.
Notable is also that the file type is "Unknown" as opposed to "Program", and that it doesn't have a thumbnail in the file explorer.
I realize it's been forever, but thanks to @Marin-MK for tracking this down and debugging it. I've updated the guide with your notes.
I've been following a guide that was posted here (https://docs.google.com/document/d/1xBHq2qccczn1ZcG4uc3DDGHhK0YxfmxI9TNRqjBLzFw/edit) and everything's fine until I try to compile mkxp. I've followed the guide exactly with 2 exceptions: at the start,
libpng12-dev
I had to change tolibpng-dev
, and the more relevant change, I got Ruby 2.6 instead of the Ruby 2.2 used in the guide. It could of course be that it's changed so much between 4 minor versions that the guide is no longer applicable, but if it isn't I'd love to know how to fix that.I built Ruby statically as the guide also did, and I changed MRIVERSION to 2.6 and added
/usr/local/lib/libruby-static.a
under${PLATFORM_LIBRARIES}
in mkxp's CMakeLists.txt. Here's the log when trying to build it.