Skip to contentSkip to conversation

2.22-rc1 build fails if configured with --disable-static

DISCUSSION Petr Uzel 4 participants 5 messages Jul 27, 2012 – Aug 2, 2012 Util-Linux package

lore
Share & tools
lore

Petr Uzel

author
#0 lore raw

Hi list,

I just encountered that 2.22-rc1 build fails if

./configure --disable-static
make

The error I'm getting is:
==================
...
/bin/sh ./libtool --tag=CC --mode=link gcc -std=gnu99 -DTEST_PROGRAM -I./libblkid/src -I./libblkid/src -I./libuuid/src -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -D_GNU_SOURCE libuuid.la -static -o test_blkid_cache libblkid/src/test_blkid_cache-cache.o libblkid.la
libtool: link: gcc -std=gnu99 -DTEST_PROGRAM -I./libblkid/src -I./libblkid/src -I./libuuid/src -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -D_GNU_SOURCE -o test_blkid_cache libblkid/src/test_blkid_cache-cache.o ./.libs/libuuid.so ./.libs/libblkid.so /home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/.libs/libuuid.so -Wl,-rpath -Wl,/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/.libs -Wl,-rpath -Wl,/usr/lib64 libblkid/src/test_blkid_cache-cache.o: In function `blkid_get_cache_filename':
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:113: undefined reference to `safe_getenv'
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:115: undefined reference to `blkid_strdup'
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:117: undefined reference to `blkid_strdup'
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:119: undefined reference to `blkid_read_config'
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:125: undefined reference to `blkid_free_config'
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:121: undefined reference to `blkid_strdup'
libblkid/src/test_blkid_cache-cache.o: In function `blkid_get_cache':
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:162: undefined reference to `blkid_read_cache'
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:158: undefined reference to `blkid_strdup'
libblkid/src/test_blkid_cache-cache.o: In function `blkid_put_cache':
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:178: undefined reference to `blkid_flush_cache'
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:188: undefined reference to `blkid_free_dev'
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:203: undefined reference to `blkid_free_tag'
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:205: undefined reference to `blkid_free_tag'
libblkid/src/test_blkid_cache-cache.o: In function `blkid_gc_cache':
/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1/libblkid/src/cache.c:233: undefined reference to `blkid_free_dev'
collect2: error: ld returned 1 exit status
make[2]: *** [test_blkid_cache] Error 1
make[2]: Leaving directory `/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/abuild/rpmbuild/BUILD/util-linux-2.22-rc1'
make: *** [all] Error 2
==================

Anyone else getting this?

Petr

Signature · 2 lines
Petr Uzel
IRC: ptr_uzl @ freenode
#1 lore raw
Quoted 6 lines · Petr Uzel

I just encountered that 2.22-rc1 build fails if

./configure --disable-static
make

The error I'm getting is:

[snip]

Quoted 1 line

Anyone else getting this?

Yes, this seems to happen on all systems. I am not sure if my proposed fix is what is wanted. Maybe there is a way to make tests to compile, but I do not how with the current set up; meaning tests mixed with lib code.

The following changes since commit 506eb04c3ddfda6257cfb332454fe7ce273a3230:

docs: add note about partx output change (2012-07-27 10:17:10 +0200)

are available in the git repository at:

git://github.com/kerolasa/lelux-utiliteetit.git disable-static

for you to fetch changes up to 2d0c4a51d7963286f785953eb292ba1d125f6b9f:

Quoted 1 line

From 2d0c4a51d7963286f785953eb292ba1d125f6b9f Mon Sep 17 00:00:00 2001

From: Sami Kerola <[email protected]>
Date: Mon, 30 Jul 2012 09:03:08 +0200
Subject: [PATCH] build-sys: do not build library tests when --disable-static
is in use
Organization: TomTom International B.V.

Code for tests is in same directory with library code, which means LDFLAGS=-static is needed to separate objects. That also means when configure has option --disable-static building of the tests fail.

Alternatively code for tests could be moved to tests/helpers/ directory, which may happen in future.

References: http://www.spinics.net/lists/util-linux-ng/msg06648.html

---
 configure.ac               |    6 ++++++
 libblkid/src/Makemodule.am |    4 ++++
 libmount/src/Makemodule.am |    2 ++
 3 files changed, 12 insertions(+)
configure.ac +2 -0
index e32a1c1..d129bac 100644
@@ -856,6 +856,12 @@ if test "x$build_fallocate" = xyes; then
 fi
 
 
+if test "$enable_shared" = no; then
+  AC_MSG_WARN([Disabling shared libraries is incompatible with

building library tests.])
+fi
+AM_CONDITIONAL(BUILD_LIBRARY_TESTS, test "x$enable_shared" = xyes) +
+
AC_ARG_ENABLE([unshare],
AS_HELP_STRING([--disable-unshare], [do not build unshare]), [], enable_unshare=check

libblkid/src/Makemodule.am +4 -0
index af1764c..7a1fe6c 100644
@@ -131,6 +131,8 @@ EXTRA_DIST += \
 	libblkid/src/blkid.sym \
 	libblkid/src/blkid.h.in
 
+if !BUILD_LIBRARY_TESTS
+
 noinst_PROGRAMS += \
 	test_blkid_cache \
 	test_blkid_config \
@@ -210,6 +212,8 @@ test_blkid_verify_CFLAGS = $(blkid_tests_cflags)
 test_blkid_verify_LDFLAGS = $(blkid_tests_ldflags)
 test_blkid_verify_LDADD = $(blkid_tests_ldadd)
 
+endif	# BUILD_LIBRARY_TESTS
+
 # move lib from $(usrlib_execdir) to $(libdir) if needed
 install-exec-hook-libblkid:
 	if test "$(usrlib_execdir)" != "$(libdir)"; then \
libmount/src/Makemodule.am +2 -0
index 211834e..a82f7a4 100644
@@ -50,6 +50,7 @@ EXTRA_DIST += \
 	libmount/src/libmount.sym \
 	libmount/src/libmount.h.in
 
+if !BUILD_LIBRARY_TESTS
 noinst_PROGRAMS += \
 	test_mount_cache \
 	test_mount_context \
@@ -114,6 +115,7 @@ test_mount_version_CFLAGS = $(libmount_tests_cflags)
 test_mount_version_LDFLAGS = $(libmount_tests_ldflags)
 test_mount_version_LDADD = $(libmount_tests_ldadd)
 
+endif	# BUILD_LIBRARY_TESTS
 
 # move lib from $(usrlib_execdir) to $(libdir) if needed
 install-exec-hook-libmount:
Signature · 7 lines
1.7.9.5



-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/
#2 lore raw
Quoted 7 lines · On Monday 30 July 2012 03:21:27 Sami Kerola wrote:
Quoted 6 lines · Petr Uzel

I just encountered that 2.22-rc1 build fails if

./configure --disable-static
make

The error I'm getting is:

Quoted 8 lines

[snip]

Quoted 1 line

Anyone else getting this?

Yes, this seems to happen on all systems. I am not sure if my proposed fix is what is wanted. Maybe there is a way to make tests to compile, but I do not how with the current set up; meaning tests mixed with lib code.

these tests shouldn't be built in the first place by make all

libblkid/src/Makemodule.am EXTRA_DIST += \ · line 138

Quoted 8 lines
libblkid/src/Makemodule.am +2 -0
 
+if !BUILD_LIBRARY_TESTS
+
 noinst_PROGRAMS += \
 	test_blkid_cache \
 	test_blkid_config \

these should be in check_PROGRAMS
-mike

maintainer
#3 lore raw
Quoted 5 lines · Mike Frysinger

libblkid/src/Makemodule.am EXTRA_DIST += \ · line 138

Quoted 3 lines

noinst_PROGRAMS += \

libblkid/src/Makemodule.am +0 -0
 	test_blkid_cache \
 	test_blkid_config \

these should be in check_PROGRAMS

Ah, nice idea. Fixed. Thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer
#4 lore raw
In reply to Petr Uzel
Quoted 6 lines · Petr Uzel

I just encountered that 2.22-rc1 build fails if

./configure --disable-static
make

The error I'm getting is:

Fixed

- "make check" is required to build tests

- ./configure setups BUILD_LIBMOUNT_TESTS and BUILD_LIBBLKID_TESTS and the libtool variable $enable_static is required (so --disable-static disables the tests too).

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com