Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#30073 - [glib2] lacks .a file for static compilation

Attached to Project: Arch Linux
Opened by Hubert Kario (tomato) - Wednesday, 30 May 2012, 11:44 GMT
Last edited by Jan de Groot (JGC) - Thursday, 31 May 2012, 13:51 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To Jan de Groot (JGC)
Jan Alexander Steffens (heftig)
Architecture i686
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
glib2 package does contain only shared versions of libraries, so it's impossible to build statically linked executables against it.

Additional info:
Package version: 2.32.3-1

Steps to reproduce:
1. Use glib2 functions in C/C++ application
2. Link with -static

Error:
/usr/bin/ld: cannot find -lglib-2.0
This task depends upon

Closed by  Jan de Groot (JGC)
Thursday, 31 May 2012, 13:51 GMT
Reason for closing:  Won't implement
Comment by Jan de Groot (JGC) - Wednesday, 30 May 2012, 18:01 GMT
Static linking is bad. We try to package as few as possible static libraries, so I see no reason to make an exception for glib2.
Comment by Hubert Kario (tomato) - Wednesday, 30 May 2012, 18:37 GMT
If static linking was useless it would have been removed from gcc long time ago.

Libc has files for static linking
OpenSSL has files for static linking
mysql has files for static linking
libsdc++ has files for static linking
libz has files for static linking

glib2 is an exception, not the other way round
Comment by Laurent Carlier (lordheavy) - Wednesday, 30 May 2012, 18:53 GMT
And which package needs glib2's static libraries ?
Comment by Hubert Kario (tomato) - Wednesday, 30 May 2012, 19:04 GMT
My application I'm cross-compiling on Arch.

Am I missing something or is it something else, but don't statically linked applications require .a file only for linking? Then why they are installed if they are needed only for few system applications for compile time only? I just don't get the idea behind "some libraries on Arch can be statically linked, but in general they can't".
Comment by Laurent Carlier (lordheavy) - Wednesday, 30 May 2012, 19:16 GMT
If you really need them, you can always use abs to grab the PKGBUILD, then rebuild glib2 to keep static libraries
Comment by Hubert Kario (tomato) - Wednesday, 30 May 2012, 19:32 GMT
I know I can rebuild them myself, but it's inconvenient.

I would understand if they were completely absent, or available in -dev packages, but this inconsistency is puzzling. Especially if we're letting 18MB libvirtuoso-t.a file stay...
Comment by Hubert Kario (tomato) - Wednesday, 30 May 2012, 19:36 GMT
Just in case, if anyone wanted to statically link to glib, here's a PKGBUILD.
   PKGBUILD (1.6 KiB)
Comment by Jan de Groot (JGC) - Thursday, 31 May 2012, 10:04 GMT
You still didn't supply a valid reason for having static libraries. In case of glib2, the decision to not include static libraries by default is made upstream. glib2 is an ABI-stable module that remains backwards compatible with previous releases, so upstream doesn't see any need to provide static libraries for it.
Cross-compiling is not a valid argument for having a static library. You can cross-compile against shared libraries too.
Comment by Hubert Kario (tomato) - Thursday, 31 May 2012, 10:25 GMT
Yes, I can cross-compile against shared libraries. But this won't work if I need features introduced in recent release and I'm preparing package for RHEL4 or RHEL5, don't you think?
Comment by Jan de Groot (JGC) - Thursday, 31 May 2012, 13:51 GMT
Looking at the way Mozilla packages their stuff, they don't use features that aren't present in their target platform, and in case they need those features, they compile against an in-tree version of that library (cairo, libpng for example).

Loading...