Subject: | Fix tests when ccflags contains -m32 |
t/custom-function.t fails in the the failtest "wrong result" because the
created bazbam library is not created with -m32, when ccflags
includes -m32 on a 64bit system.
See the attached fix 0001-fix-tests-when-ccflags-contains-m32.patch
also at https://github.com/rurban/p5-Devel-CheckLib/commit/57ccbf6728e605800f91e78e55c3a668b6a45a4d
$ DEVEL_CHECKLIB_DEBUG=1 pb t/custom-function.t
1..5
not ok 1 - failed to build: wrong result
# Failed test 'failed to build: wrong result'
# at t/custom-function.t line 75.
#
# incpath => 't/inc',
# libpath => '/tmp/WKfUQgDhHP',
# lib => 'bazbam',
# header => 'headerfile.h',
# # libversion returns wrong result
# function => 'foo();if(libversion() < 5) return 0; else return 1;'
#
# Can't link/include C library 'bazbam', aborting.
#
# STDOUT:
# STDERR: # /usr/bin/cc -m32 -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -m32 -g3 -fstack-protector -lnsl -ldl -lm -lcrypt -lutil -lc assertlibfYT7OaDq.c -It/inc -o assertlibo4dfJEL0
# # /usr/bin/cc -m32 -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -m32 -g3 -fstack-protector -lnsl -ldl -lm -lcrypt -lutil -lc assertlibmtUBtbxZ.c -o assertlibcOkWXqgA -It/inc -L/tmp/WKfUQgDhHP -lbazbam
# /usr/bin/ld: warning: skipping incompatible /tmp/WKfUQgDhHP/libbazbam.a while searching for bazbam
# /usr/bin/ld: error: cannot find -lbazbam
# assertlibmtUBtbxZ.c:2: error: undefined reference to 'foo'
# assertlibmtUBtbxZ.c:2: error: undefined reference to 'libversion'
# collect2: error: ld returned 1 exit status
#
ok 2 - failed to build: Can't link/include
ok 3 - function returns right value
ok 4 - function exists
ok 5 - function exists and other function returns right value
# Looks like you failed 1 test of 5.
--
Reini Urban
Subject: | 0001-fix-tests-when-ccflags-contains-m32.patch |
From 57ccbf6728e605800f91e78e55c3a668b6a45a4d Mon Sep 17 00:00:00 2001
From: Reini Urban <rurban@cpanel.net>
Date: Tue, 2 Apr 2013 13:38:01 -0500
Subject: [PATCH] fix tests when ccflags contains -m32
---
t/lib/Helper.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/lib/Helper.pm b/t/lib/Helper.pm
index 82482bc..f298c71 100644
--- a/t/lib/Helper.pm
+++ b/t/lib/Helper.pm
@@ -61,8 +61,9 @@ sub _gcc_lib {
my $cc = find_compiler() or return;
my $ar = find_binary('ar') or return;
my $ranlib = find_binary('ranlib') or return;
+ my $ccflags = $Config{ccflags};
- _quiet_system("$cc -c ${libname}.c") and return;
+ _quiet_system("$cc $ccflags -c ${libname}.c") and return;
_quiet_system("$ar rc lib${libname}.a ${libname}.o") and return;
_quiet_system("$ranlib lib${libname}.a") and return;
return -f "lib${libname}.a"
--
1.7.10.4