How is glibc used?

Dan Nicholson nicholson at endlessm.com
Wed Aug 24 18:21:14 UTC 2016


On Wed, Aug 24, 2016 at 10:33 AM, Michael Felt <aixtools at gmail.com> wrote:
> I mention this because make check is reporting nearly all failures, while
> pkg-config-0-29.1 does seem to work?
>
> Q. Why concerned about glibc?
> A. Because I am not using gcc as a compiler, and glibc demands "constructor"
> support, which my compiler does not have.
>
> Q. Why not build pkg-config with gcc, and not worry about it?
> A. As you know, the values stored for a project depend on the compiler used.
> And GCC compiler flags are not universal.
> In other words, if I work with GCC I need a different pkg-config (at least,
> the one I compiled with gcc never worked
> with my standard compiler)
>
> Q. How did you build pkg-config?
> A. Compiler is xlc, platform is AIX 5.3 TL7. Modification to internal glibc:
> change #error macro in ../src/pkg-config-0.29.1/glib/glib/glib-init.c
> to:
>   +283  #else
>   +284  # warning Your platform/compiler is missing constructor support
>   +285  #endif
> so that make continues.
> My expectation was one or more undefined symbols, but none occurred.

It seems that you really need the constructor support to do some
initialization of glib. Is there a build of glib on AIX? What do they
do there? Can you just link pkg-config to that glib? That's what's
done on Linux.

To test, you can just run "./pkg-config --list-all" in your build
directory. This should exercise enough of pkg-config and glib to
trigger the error, I think. You can then consider running that under
gdb to try to figure out where things are going wrong.

FWIW, it looks like the place you'd want to define the xlc constructor
support (if it can be emulated in some way) is
https://git.gnome.org/browse/glib/tree/glib/gconstructor.h.

Looking around, http://www.perzl.org/aix/index.php?n=Main.Glib2 seems
to have a patch you could try in the SRPM. That said, there are a lot
of notes on there about needing to build it using GCC on that page.
Maybe you can just use that glib?

*** ./glib/gconstructor.h.ORIG  Fri Nov  9 08:51:23 2012
--- ./glib/gconstructor.h       Fri Nov  9 08:50:37 2012
***************
*** 62,68 ****
    static int _func ## _constructor(void) { atexit (_func); return 0; } \
    __declspec(allocate(".CRT$XCU")) static int (* _array ##
_func)(void) = _func ## _constructor;

! #elif defined(__SUNPRO_C)

  /* This is not tested, but i believe it should work, based on:
   * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
--- 62,68 ----
    static int _func ## _constructor(void) { atexit (_func); return 0; } \
    __declspec(allocate(".CRT$XCU")) static int (* _array ##
_func)(void) = _func ## _constructor;

! #elif defined(__SUNPRO_C) || defined(__VACPP_MULTI__)

  /* This is not tested, but i believe it should work, based on:
   * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c


--
Dan


More information about the pkg-config mailing list