ice1000 / jimgui

:sparkling_heart: Pure Java binding for dear-imgui
Apache License 2.0
185 stars 13 forks source link

Ubuntu 16.04 support? #59

Closed newk5 closed 3 years ago

newk5 commented 3 years ago

I've tried jimgui on windows 10 64bit and everything worked perfectly, today I tried on Ubuntu 16.04 64bit but I can't run it. I get the error:

java.lang.UnsupportedOperationException: java.lang.UnsatisfiedLinkError: /tmp/jimgui1605317730496/libjimgui.so: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /tmp/jimgui1605317730496/libjimgui.so)

I think it's because on ubuntu 16.04 glibc version 2.23 is used. Does this mean jimgui only supports >=Ubuntu18?

ice1000 commented 3 years ago

Yes, but I didn't ask for this. Do you know an ideal solution to this linking problem? I want to maximize the compatibility tbh, but I'm bad at it.

newk5 commented 3 years ago

Hmm I dont know, maybe libjimgui.so has to be compiled on Ubuntu 16.04 or maybe some other OS which has a lower glibc version. Which OS did you use to compile libjimgui.so ?

ice1000 commented 3 years ago

Windows :)

ice1000 commented 3 years ago

I mean, the Ubuntu subsystem. I'm a poor undergrad student with one PC only, sorry :( The reason why I stopped releasing jimgui lately is that my friend who own a MACos device found a GF and he didn't reply my message now. Well, things happen.

newk5 commented 3 years ago

Ah, perhaps the windows ubuntu subsystem is based on ubuntu 18 which has glibc 2.27. This project is pretty amazing, I hope you dont give up on it, compared to the other imgui java ports this one uses the least amount of memory. I've tried the other projects with the imgui demo and I got 120mb memory usage. With your project I get 30mb memory usage, it's very impressive. Even without MAC support I think the project can progress. If there's MAC users that need it they can compile it themselves if there are build intructions.

I dont have a MAC so I can't help with that but I have a laptop running ubuntu 16. I can try to compile there if you can provide instructions.

newk5 commented 3 years ago

I followed the instructions your specified here: https://github.com/ice1000/jimgui#build But when I run gradlew assemble I get an error:

Task :core:downloadImpl FAILED Download https://raw.githubusercontent.com/ocornut/imgui/master/examples/imgui_impl_glfw.h

FAILURE: Build failed with an exception.

It seems that link doesnt exist anymore

Maybe this is the link you need? https://raw.githubusercontent.com/ocornut/imgui/master/backends/imgui_impl_glfw.h

newk5 commented 3 years ago

After replacing the link, and running assemble again, I get the error:

Task :core:make Scanning dependencies of target jimgui [ 5%] Building CXX object CMakeFiles/jimgui.dir/imgui/imgui.cpp.o [ 10%] Building CXX object CMakeFiles/jimgui.dir/imgui/imgui_widgets.cpp.o [ 15%] Building CXX object CMakeFiles/jimgui.dir/imgui/imgui_draw.cpp.o [ 20%] Building CXX object CMakeFiles/jimgui.dir/imgui/imgui_demo.cpp.o [ 25%] Building CXX object CMakeFiles/jimgui.dir/impl/imgui_impl_glfw.cpp.o [ 30%] Building CXX object CMakeFiles/jimgui.dir/impl/imgui_impl_opengl3.cpp.o [ 35%] Building C object CMakeFiles/jimgui.dir/impl/gl3w.c.o [ 40%] Building CXX object CMakeFiles/jimgui.dir/glfw_impl.cpp.o [ 45%] Building CXX object CMakeFiles/jimgui.dir/generated_imgui.cpp.o [ 50%] Building CXX object CMakeFiles/jimgui.dir/generated_imgui_io.cpp.o /home/newk/jimgui/jimgui/core/jni/generated_imgui_io.cpp: In function ‘void Java_org_ice1000_jimgui_JImGuiIOGen_setConfigWindowsMemoryCompactTimer(JNIEnv, jclass, jfloat)’: /home/newk/jimgui/jimgui/core/jni/generated_imgui_io.cpp:202:156: error: ‘struct ImGuiIO’ has no member named ‘ConfigWindowsMemoryCompactTimer’ JNIEXPORT auto JNICALL Java_org_ice1000_jimgui_JImGuiIOGen_setConfigWindowsMemoryCompactTimer(JNIEnv , jclass , jfloat newValue) -> void { ImGui::GetIO().ConfigWindowsMemoryCompactTimer = newValue; } ^ /home/newk/jimgui/jimgui/core/jni/generated_imgui_io.cpp: In function ‘jfloat Java_org_ice1000_jimgui_JImGuiIOGen_getConfigWindowsMemoryCompactTimer(JNIEnv, jclass)’: /home/newk/jimgui/jimgui/core/jni/generated_imgui_io.cpp:203:169: error: ‘struct ImGuiIO’ has no member named ‘ConfigWindowsMemoryCompactTimer’ JNIEXPORT auto JNICALL Java_org_ice1000_jimgui_JImGuiIOGen_getConfigWindowsMemoryCompactTimer(JNIEnv , jclass ) -> jfloat { return static_cast (ImGui::GetIO().ConfigWindowsMemoryCompactTimer); } ^ CMakeFiles/jimgui.dir/build.make:198: recipe for target 'CMakeFiles/jimgui.dir/generated_imgui_io.cpp.o' failed make[2]: [CMakeFiles/jimgui.dir/generated_imgui_io.cpp.o] Error 1 CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/jimgui.dir/all' failed make[1]: [CMakeFiles/jimgui.dir/all] Error 2 Makefile:102: recipe for target 'all' failed make: *** [all] Error 2

Task :core:make FAILED

I've read the imgui changelog here: https://github.com/ocornut/imgui/blob/71cc636696bd17c81514da49707e909958c14632/docs/CHANGELOG.txt#L53

And it seems there's been many breaking changes from from 1.71 to 1.80, some base file functions were changed:

ConfigWindowsMemoryCompactTimer was changed to ConfigMemoryCompactTimer TabMinWidthForUnselectedCloseButton was changed to TabMinWidthForCloseButton

I changed it on GenIOTask.kt and GenStyleTask.kt and now I was able to compile it.

After compiling, I tried it and now it runs on Ubuntu 16.04, it's using imgui 1.80 too 😃 If anyone needs it here's the final jar: core-v0.9.zip

@ice1000 I went through the changelong from 1.71 to 1.80 and made PR's for all the breaking changes except this one: https://github.com/ocornut/imgui/blob/71cc636696bd17c81514da49707e909958c14632/docs/CHANGELOG.txt#L300 Because I dont know how that would look on the kotlin source. But yea that is the only one missing for jimgui to be 100% compatible with version 1.80.

ice1000 commented 3 years ago

I do not yet have time to do it, will look into it after my heavy homework week :)

newk5 commented 3 years ago

Thanks! In the meantime I will try to setup a MacOS VM so I can help you compile it for Mac 👍

ice1000 commented 3 years ago

Do you have time to maintain an opensource library like jimgui? I think I'm too busy to maintain it alone 😣 .

newk5 commented 3 years ago

Unfortunately I dont have enough knowledge about JNI, c++, kotlin and imgui to contribute code. I'm a JavaEE dev, I only recently found out about imgui, and I've never used kotlin before.

I can contribute by compiling and submitting PR's for simple things that change in imgui api like renaming functions.

ice1000 commented 3 years ago

That's enough, it's just a matter of "do you have time to reply to comments and blablabla", and I'll take care of programming in Kotlin and maybe teach you programming in Kotlin.

ice1000 commented 3 years ago

@newk5 check https://github.com/ice1000/jimgui/invitations

newk5 commented 3 years ago

After clicking accept, it showed an error saying "invalid", did it work? Btw have you considered creating a jimgui chatroom on https://gitter.im/ ? It would be easier to talk there.

ice1000 commented 3 years ago

I dunno why it's invalid :(

Did you mean https://gitter.im/imgui-java/community? It's on README ;)

newk5 commented 3 years ago

Oh, sorry, I didnt notice.

I dont know if the link worked, send another invite 😄

ice1000 commented 3 years ago

If anyone needs it here's the final jar: core-v0.9.zip

Wow, you got windows dlls and MACos dylibs there too. That means you also have valid Windows dev env, right?

ice1000 commented 3 years ago

Closed as v0.10 is being released.

newk5 commented 3 years ago

If anyone needs it here's the final jar: core-v0.9.zip

Wow, you got windows dlls and MACos dylibs there too. That means you also have valid Windows dev env, right?

Nah I just added the new .so file inside the existing 0.9 .jar. I dont have a valid windows dev env right now, only Mac and Linux. That .jar only contains the new linux .so file. The dylib and dll inside that jar are from the existing 0.9 version. I have posted the mac dylib on gitter. I have the linux binary and Mac binary compiled for the latest version but I dont have the windows .dll

ice1000 commented 3 years ago

Ah, perhaps the windows ubuntu subsystem is based on ubuntu 18 which has glibc 2.27.

Yes, as a user I always wanna use the newer versions, so I installed the latest available back to the time I get my windows machine

ice1000 commented 3 years ago

If anyone needs it here's the final jar: core-v0.9.zip

Wow, you got windows dlls and MACos dylibs there too. That means you also have valid Windows dev env, right?

Nah I just added the new .so file inside the existing 0.9 .jar. I dont have a valid windows dev env right now, only Mac and Linux. That .jar only contains the new linux .so file. The dylib and dll inside that jar are from the existing 0.9 version. I have posted the mac dylib on gitter. I have the linux binary and Mac binary compiled for the latest version but I dont have the windows .dll

Then I used the correct files. I noticed the size difference of the dll and dylib in your .jar so I only picked the .so there.