Fail to build libpkgconf with MinGW #141

Closed
opened 2017-09-19 21:59:18 +00:00 by karen-arutyunov · 2 comments
karen-arutyunov commented 2017-09-19 21:59:18 +00:00 (Migrated from github.com)

When configure (with configure script) and then compile pkgconf (with make) in MinGW shell in MSYS2 environment then the compiler complains to all pkgconf_* functions as follows:

libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./libpkgconf -Wall -Wextra -Wformat=2 -std=gnu99 -DPKG_DEFAULT_PATH="/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig" -DSYSTEM_INCLUDEDIR="/mingw64/include" -DSYSTEM_LIBDIR="/mingw64/lib" -g -O2 -MT libpkgconf/audit.lo -MD -MP -MF libpkgconf/.deps/audit.Tpo -c libpkgconf/audit.c -DDLL_EXPORT -DPIC -o libpkgconf/.libs/audit.o
libpkgconf/audit.c:44:1: warning: 'pkgconf_audit_set_log' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
pkgconf_audit_set_log(pkgconf_client_t *client, FILE *auditf)
^~~~~~~~~~~~~~~~~~~~~
...

And finally library linking fails like this:

libtool: link: gcc -shared .libs/libpkgconf-2.dll.def libpkgconf/.libs/audit.o libpkgconf/.libs/cache.o libpkgconf/.libs/client.o libpkgconf/.libs/pkg.o libpkgconf/.libs/bsdstubs.o libpkgconf/.libs/fragment.o libpkgconf/.libs/argvsplit.o libpkgconf/.libs/fileio.o libpkgconf/.libs/tuple.o libpkgconf/.libs/dependency.o libpkgconf/.libs/queue.o libpkgconf/.libs/path.o -g -O2 -o .libs/libpkgconf-2.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libpkgconf.dll.a
libpkgconf/.libs/audit.o: In function pkgconf_audit_log_dependency': C:\projects\build-out\pkgconf/libpkgconf/audit.c:94: undefined reference to __imp_pkgconf_pkg_get_comparator'
libpkgconf/.libs/cache.o: In function pkgconf_cache_lookup': C:\projects\build-out\pkgconf/libpkgconf/cache.c:57: undefined reference to __imp_pkgconf_trace'
C:\projects\build-out\pkgconf/libpkgconf/cache.c:58: undefined reference to __imp_pkgconf_pkg_ref' C:\projects\build-out\pkgconf/libpkgconf/cache.c:62: undefined reference to __imp_pkgconf_trace'
libpkgconf/.libs/cache.o: In function pkgconf_cache_add': C:\projects\build-out\pkgconf/libpkgconf/cache.c:84: undefined reference to __imp_pkgconf_pkg_ref'
C:\projects\build-out\pkgconf/libpkgconf/cache.c:87: undefined reference to `__imp_pkgconf_trace'
...

Note that configure script was generated with autogen.sh in MinGW shell. The script succeeded while have printed some info which may be good to see:

$ ./autogen.sh
info running aclocal
info running autoheader
info running autoconf
info running libtoolize (--install)
libtoolize: putting auxiliary files in '.'.
libtoolize: linking file './config.guess'
libtoolize: linking file './config.sub'
libtoolize: linking file './install-sh'
libtoolize: linking file './ltmain.sh'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
info running automake (--add-missing)
configure.ac:18: installing './compile'
configure.ac:20: installing './missing'
Makefile.am: installing './depcomp'

When configure (with configure script) and then compile pkgconf (with make) in MinGW shell in MSYS2 environment then the compiler complains to all pkgconf_* functions as follows: libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./libpkgconf -Wall -Wextra -Wformat=2 -std=gnu99 -DPKG_DEFAULT_PATH=\"/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig\" -DSYSTEM_INCLUDEDIR=\"/mingw64/include\" -DSYSTEM_LIBDIR=\"/mingw64/lib\" -g -O2 -MT libpkgconf/audit.lo -MD -MP -MF libpkgconf/.deps/audit.Tpo -c libpkgconf/audit.c -DDLL_EXPORT -DPIC -o libpkgconf/.libs/audit.o libpkgconf/audit.c:44:1: warning: 'pkgconf_audit_set_log' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] pkgconf_audit_set_log(pkgconf_client_t *client, FILE *auditf) ^~~~~~~~~~~~~~~~~~~~~ ... And finally library linking fails like this: libtool: link: gcc -shared .libs/libpkgconf-2.dll.def libpkgconf/.libs/audit.o libpkgconf/.libs/cache.o libpkgconf/.libs/client.o libpkgconf/.libs/pkg.o libpkgconf/.libs/bsdstubs.o libpkgconf/.libs/fragment.o libpkgconf/.libs/argvsplit.o libpkgconf/.libs/fileio.o libpkgconf/.libs/tuple.o libpkgconf/.libs/dependency.o libpkgconf/.libs/queue.o libpkgconf/.libs/path.o -g -O2 -o .libs/libpkgconf-2.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libpkgconf.dll.a libpkgconf/.libs/audit.o: In function `pkgconf_audit_log_dependency': C:\projects\build-out\pkgconf/libpkgconf/audit.c:94: undefined reference to `__imp_pkgconf_pkg_get_comparator' libpkgconf/.libs/cache.o: In function `pkgconf_cache_lookup': C:\projects\build-out\pkgconf/libpkgconf/cache.c:57: undefined reference to `__imp_pkgconf_trace' C:\projects\build-out\pkgconf/libpkgconf/cache.c:58: undefined reference to `__imp_pkgconf_pkg_ref' C:\projects\build-out\pkgconf/libpkgconf/cache.c:62: undefined reference to `__imp_pkgconf_trace' libpkgconf/.libs/cache.o: In function `pkgconf_cache_add': C:\projects\build-out\pkgconf/libpkgconf/cache.c:84: undefined reference to `__imp_pkgconf_pkg_ref' C:\projects\build-out\pkgconf/libpkgconf/cache.c:87: undefined reference to `__imp_pkgconf_trace' ... Note that configure script was generated with autogen.sh in MinGW shell. The script succeeded while have printed some info which may be good to see: $ ./autogen.sh *info* running aclocal *info* running autoheader *info* running autoconf *info* running libtoolize (--install) libtoolize: putting auxiliary files in '.'. libtoolize: linking file './config.guess' libtoolize: linking file './config.sub' libtoolize: linking file './install-sh' libtoolize: linking file './ltmain.sh' libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac, libtoolize: and rerunning libtoolize and aclocal. libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am. *info* running automake (--add-missing) configure.ac:18: installing './compile' configure.ac:20: installing './missing' Makefile.am: installing './depcomp'

I suspect this a problem with PKGCONF_API stuff.

I suspect this a problem with PKGCONF_API stuff.
karen-arutyunov commented 2017-09-20 09:45:56 +00:00 (Migrated from github.com)

Yes, if to hack the configure-generated libtool script replacing "-DDLL_EXPORT" with "-DLIBPKGCONF_EXPORT" then the issue go away. Probably it is possible to customize this in configure.ac.

Yes, if to hack the configure-generated libtool script replacing "-DDLL_EXPORT" with "-DLIBPKGCONF_EXPORT" then the issue go away. Probably it is possible to customize this in configure.ac.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ariadne/pkgconf#141
There is no content yet.