Compiling libopkg statically?

16 views
Skip to first unread message

Fred

unread,
Apr 13, 2011, 4:11:28 AM4/13/11
to opkg-devel
Hello

Since no other application will use libopkg, and that compiling it
statically should result in a smaller executable, I was wondering if
it were possible to compile it statically into opkg-cl?

Thank you.

Jo-Philipp Wich

unread,
Apr 13, 2011, 4:43:10 AM4/13/11
to opkg-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

> Since no other application will use libopkg, and that compiling it
> statically should result in a smaller executable, I was wondering if
> it were possible to compile it statically into opkg-cl?

Yes it is possible. We do it since quite some time on OpenWrt.
See the attached patch.

~ Jow
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2lYh4ACgkQdputYINPTPPFuQCfTeXXFje5wstZ4mMVuw8YE+CW
MAYAoIPjhm2YcpsDPTgvN5euPuU1UY/p
=idvg
-----END PGP SIGNATURE-----

007-force_static.patch

Fred

unread,
Apr 13, 2011, 8:18:15 AM4/13/11
to opkg-devel
Thanks for the patch. I'm not used to using patches, and get an error:


cd /usr/src/opkg-read-only

patch < 007-force_static.patch

patching file Makefile.am
Hunk #1 FAILED at 38.
1 out of 1 hunk FAILED -- saving rejects to file Makefile.am.rej
patching file Makefile.am
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file Makefile.am.rej
patching file Makefile.am
Hunk #1 FAILED at 4.
Hunk #2 FAILED at 16.
2 out of 2 hunks FAILED -- saving rejects to file Makefile.am.rej
patching file Makefile.am
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file Makefile.am.rej

Fred

unread,
Apr 13, 2011, 8:25:50 AM4/13/11
to opkg-devel
Found it: patch -p1 < 007-force_static.patch

If a patch is necessary, does it mean that most users of opkg never
felt the need to compile it statically and get a single binary?

Fred

unread,
Apr 13, 2011, 10:06:35 AM4/13/11
to opkg-devel
More googling shows that simply adding this when running "configure"
is enough to tell the compiler to include the library statically and
generate a stand-alone binary

./configure ... LDFLAGS=-static
Reply all
Reply to author
Forward
0 new messages