Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop depenancy on glib2 possible? #266

Open
ptpt52 opened this issue Jul 22, 2022 · 15 comments
Open

drop depenancy on glib2 possible? #266

ptpt52 opened this issue Jul 22, 2022 · 15 comments

Comments

@ptpt52
Copy link

ptpt52 commented Jul 22, 2022

@namjaejeon
for now ksmbd-tools run depends on glib2
could it possible to provide an option to drop glib2?

glib2 is about 1MB size and hard to install into small flash openwrt.

@namjaejeon
Copy link
Member

namjaejeon commented Jul 25, 2022

Ah, 1MB of glib2 is stripped binary size ? ksmbd-tools is fully tied with glib2 so that's not easy.

@ptpt52
Copy link
Author

ptpt52 commented Jul 25, 2022

@namjaejeon
looking into the ksmbd-tools code, what it use of glib2 is about somewhat basic data-type/struct or list operations
I think this could be replace by basic c type and basic c list operations

943K is size of glib2, and it is gzip compressed size

@ptpt52
Copy link
Author

ptpt52 commented Jul 25, 2022

943K is the size on openwrt
glib2 could be 1.3M on debian: see https://packages.debian.org/buster/libglib2.0-0

@ptpt52
Copy link
Author

ptpt52 commented Oct 2, 2022

@namjaejeon any update on this ?
Please drop glib2 depenancy on glib2, it is a large lib for openwrt.

@namjaejeon
Copy link
Member

@ptpt52 It is impossible for now. glib is already used tightly by ksmbd-tools.

@namjaejeon
Copy link
Member

@ptpt52 And ksmbd-tools built-in glib has been used in openWRT for a long time. Why is this suddenly a problem?

@ptpt52
Copy link
Author

ptpt52 commented Oct 3, 2022

install -m0600 ./files/ksmbd.config /mnt/Data/Sources/openwrt/x-wrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/ksmbd-tools-3.4.5/ipkg-arm_cortex-a7_neon-vfpv4/ksmbd-server/etc/config/ksmbd
install -m0644 ./files/smb.conf.template /mnt/Data/Sources/openwrt/x-wrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/ksmbd-tools-3.4.5/ipkg-arm_cortex-a7_neon-vfpv4/ksmbd-server/etc/ksmbd/
install -m0755 ./files/ksmbd.init /mnt/Data/Sources/openwrt/x-wrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/ksmbd-tools-3.4.5/ipkg-arm_cortex-a7_neon-vfpv4/ksmbd-server/etc/init.d/ksmbd
# copy examples until we have a wiki page
install -m0644 ./files/ksmbd.config.example /mnt/Data/Sources/openwrt/x-wrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/ksmbd-tools-3.4.5/ipkg-arm_cortex-a7_neon-vfpv4/ksmbd-server/etc/ksmbd/
find /mnt/Data/Sources/openwrt/x-wrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/ksmbd-tools-3.4.5/ipkg-arm_cortex-a7_neon-vfpv4/ksmbd-server -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf
Package ksmbd-server is missing dependencies for the following libraries:
libglib-2.0.so.0
Makefile:140: recipe for target '/mnt/Data/Sources/openwrt/x-wrt/bin/packages/arm_cortex-a7_neon-vfpv4/packages/ksmbd-server_3.4.5-20221003_arm_cortex-a7_neon-vfpv4.ipk' failed
make[2]: *** [/mnt/Data/Sources/openwrt/x-wrt/bin/packages/arm_cortex-a7_neon-vfpv4/packages/ksmbd-server_3.4.5-20221003_arm_cortex-a7_neon-vfpv4.ipk] Error 1
make[2]: Leaving directory '/mnt/Data/Sources/openwrt/openwrt-feeds/packages/net/ksmbd-tools'
time: package/feeds/packages/ksmbd-tools/compile#4.47#0.64#5.06
    ERROR: package/feeds/packages/ksmbd-tools failed to build.
package/Makefile:114: recipe for target 'package/feeds/packages/ksmbd-tools/compile' failed
make[1]: *** [package/feeds/packages/ksmbd-tools/compile] Error 1
make[1]: Leaving directory '/mnt/Data/Sources/openwrt/x-wrt'
/mnt/Data/Sources/openwrt/x-wrt/include/toplevel.mk:229: recipe for target 'package/feeds/packages/ksmbd-tools/compile' failed
make: *** [package/feeds/packages/ksmbd-tools/compile] Error 2

@ptpt52
Copy link
Author

ptpt52 commented Oct 3, 2022

@namjaejeon
the openwrt version now is 3.4.5
if update to git HEAD, it build failed, need libglib-2.0.so.0
but I think the glib2 is a huge file for openwrt, it is about 1MB size.

for version 3.4.5 glib2 is not needed.

@ptpt52
Copy link
Author

ptpt52 commented Oct 3, 2022

the glib2_2.74.0-2_arm_cortex-a7_neon-vfpv4.ipk package is 1.1M size. this is really large for small flash device of openwrt.

According to my observation, you only use a few C API functions in glib2, but these functions can be replaced by standard C lib, especially some data structures and functions
We don't have to import a huge redundant glib2 library in order to call an unneeded glib2

@namjaejeon
Copy link
Member

for version 3.4.5 glib2 is not needed.

I can not understand this. ksmbd-tools 3.4.5 need glib2.0. @neheb Is it true that openWRT has this issue ?

@neheb
Copy link

neheb commented Oct 3, 2022

glib2 is linked statically with LTO. Size is 55KB: https://downloads.openwrt.org/snapshots/packages/mips_24kc/packages/

Why are you linking to the shared library?

@ptpt52
Copy link
Author

ptpt52 commented Oct 3, 2022

glib2 is linked statically with LTO. Size is 55KB: https://downloads.openwrt.org/snapshots/packages/mips_24kc/packages/

Why are you linking to the shared library?

but how to patch it to link statically?

@neheb
Copy link

neheb commented Oct 3, 2022

oh I see what you're doing. updating to HEAD and getting rid of that patch. it has a silent addition to link glib2 statically.

@ptpt52
Copy link
Author

ptpt52 commented Oct 3, 2022

ok, let me try it out.

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

No branches or pull requests

3 participants