nwrkbiz / android-xserver

Maintaining the original project to make it work again with new Android versions.
MIT License
167 stars 18 forks source link

Where is source code of libwm.so? #38

Closed foryoung2018 closed 6 months ago

ZhymabekRoman commented 6 months ago

Probably this: https://github.com/wmutils/libwm

foryoung2018 commented 6 months ago

@ZhymabekRoman libwm.so need link to "-lxcb -lxcb-randr" which cant install on Android platform, do you copy libxcb.so libxcb-randr to your native project?

config.mk LDFLAGS = -lxcb -lxcb-randr

ZhymabekRoman commented 6 months ago

I think, I was wrong, see #25

foryoung2018 commented 6 months ago

@ZhymabekRoman Thanks, it means source code from below link, do you know how compile it ? https://flwm.sourceforge.net/

foryoung2018 commented 6 months ago

Maybe this https://github.com/nwrkbiz/static-build?

ZhymabekRoman commented 6 months ago

Yeah, there is: https://gitlab.com/nwrkbiz/static-build/-/blob/master/unused_packages/009_flwm/Makefile?ref_type=heads

ZhymabekRoman commented 6 months ago

FLWM build script from F-Droid: https://gitlab.com/fdroid/fdroiddata/-/merge_requests/8053/diffs

Caution: not tested, probably doesn't work

foryoung2018 commented 6 months ago

I build and run x86 success,I want to compilt it into android-xserver as a native lib,most are arm64,I‘m trying to do it. But stilly, I confuse about why it can run on Android without ndk build, these dependencies are already install in Android?

CONFIGURE=$(DEFAULT_CFG) LIBS="-static -lXcursor -lXinerama -lXft  -lXrender -lXfixes -lXext -lX11 -lxcb -lXau -lXdmcp"
ZhymabekRoman commented 6 months ago

But stilly, I confuse about why it can run on Android without ndk build,

You can compile just with normal gcc, and run it in Android environment (with some limitations), as was done by previous:

objdump -s --section .comment libwm.so

libwm.so:     file format elf64-little

Contents of section .comment:
 0000 4743433a 2028474e 55292039 2e322e30  GCC: (GNU) 9.2.0
 0010 00                                   .

these dependencies are already install in Android?

You need these decencies in build environment to build static file.

ZhymabekRoman commented 6 months ago

And also prepare for too long build process...

Probably creating Github CI workflow will be good idea.

foryoung2018 commented 6 months ago

I think I failed to build a Android libwm.so, maybe CI workflow will success, I need study to try. But finaly I need build a native library in Android project. It seems not easy :(

                                                            Process: au.com.darkside.xdemo, PID: 64691
                                                            java.lang.RuntimeException: java.io.IOException: Cannot run program "/data/app/~~3lLAwzlNziTA3dXAgfw_ng==/au.com.darkside.xdemo-nRV17hEJNlN7Lamo_HAPgA==/lib/arm64/libwn.so" (in directory "/data/user/0/au.com.darkside.xdemo"): error=2, No such file or directory
                                                                at au.com.darkside.xdemo.XServerActivity.onOptionsItemSelected(XServerActivity.java:359)
                                                                at android.app.Activity.onMenuItemSelected(Activity.java:4320)
foryoung2018 commented 6 months ago

My arm64 flwm and xserver libwm.so. It cased by GCC ?

flwm: 文件格式 elf64-littleaarch64 Contents of section .comment: 0000 4743433a 20285562 756e7475 20392e33 GCC: (Ubuntu 9.3 0010 2e302d31 306b796c 696e3229 20392e33 .0-10kylin2) 9.3 0020 2e3000 .0.

libwm.so: file format elf64-little

Contents of section .comment: 0000 4743433a 2028474e 55292039 2e322e30 GCC: (GNU) 9.2.0 0010 00

ZhymabekRoman commented 6 months ago

See your adb logcat - /lib/arm64/libwn.so - there is N char after w, not M - libwm.so

foryoung2018 commented 6 months ago

I named my so is libwn.so, it's build from https://gitlab.com/nwrkbiz/static-build/-/blob/master/unused_packages/009_flwm/Makefile?ref_type=heads

nwrkbiz commented 6 months ago

@foryoung2018

It is not a shared object, it is an elf executable renamed to *.so, to trick the Android packager so that it can be included into the apk.

As Android uses the Linux kernel you can perfectly fine execute elf executables. That is why I use the musl toolchain to statically link the program as an elf executable.

https://gitlab.com/nwrkbiz/static-build/ Builds everything for you, compiler, all dependencies (-lXcursor -lXinerama -lXft -lXrender -lXfixes -lXext -lX11 -lxcb -lXau -lXdmcp), flwm, and links everything into one executable.

Also read this: https://gitlab.com/nwrkbiz/static-build/-/tree/master?ref_type=heads#android-compatibility