#12 php fails to build: Unable to find required gettext library | /usr/pkg/lib/libbz2.so: error adding symbols: File in wrong format
Closed 10 months ago by sskras. Opened 10 months ago by sskras.

A continuation from the #9 issue.
php build fails in during the configure stage:

configure: WARNING: unrecognized options: --disable-nls
configure: loading cache config.cache
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
  ...

Configuring SAPI modules
  ...

Running system checks
  ...

General settings
  ...

Configuring extensions
  ...
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for GNU gettext support... yes, shared
checking for bindtextdomain in -lintl... no
checking for bindtextdomain in -lc... no
configure: error: Unable to find required gettext library
==> 2024/01/17 14:54:15 Build failed in `php', check `/home/sskras/midipix/nt64/debug/tmp/php_stderrout.log' for details.
==> 2024/01/17 14:54:15 [ 80%     ] [008/010] Finished `native_packages' build group.
==> 2024/01/17 14:54:15 16 finished, 346 skipped, and 1 failed package(s).
==> 2024/01/17 14:54:15 Build time: 0 hour(s), 47 minute(s), and 11 second(s).
==> 2024/01/17 14:54:15 Build script failure(s) in: php.

Found the failure in config.log:

  ...
configure:40847: checking for GNU gettext support
configure:40884: result: yes, shared
configure:40904: checking for bindtextdomain in -lintl
configure:40927: x86_64-nt64-midipix-gcc -std=gnu99 -o conftest -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -fvisibility=hidden -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/mi
dipix/nt64/debug/native -I/usr/pkg/include --sysroot=/home/sskras/midipix/nt64/debug/native -L/usr/pkg/lib -Wl,-rpath,/home/sskras/midipix/nt64/debug/bin/../native/lib -L/home/sskras/midipix/nt64/debug/bin/../n
ative/lib -Wl,-rpath,/home/sskras/midipix/nt64/debug/native/lib -L/home/sskras/midipix/nt64/debug/native/lib -L/usr/lib conftest.c -lintl  -lbz2 -lrt -lm  -lxml2 -lpcre2-8 -lxml2 >&5
/usr/pkg/lib/libbz2.so: error adding symbols: File in wrong format
collect2: ld returned 1 exit status
configure:40969: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "PHP"
| #define PACKAGE_TARNAME "php"
| #define PACKAGE_VERSION "8.1.20"
  ...
| #define HAVE_FTP 1
| #define COMPILE_DL_FTP 1
| #define HAVE_FTP_SSL 1
| /* end confdefs.h.  */
|
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| char bindtextdomain ();
| int
| main (void)
| {
| return bindtextdomain ();
|   ;
|   return 0;
| }
configure:40979: result: no
configure:40989: error: Unable to find required gettext library

It sounds familiar already, but the location is different this time:

/usr/pkg/lib/libbz2.so: error adding symbols: File in wrong format

Directory /usr/pkg also belongs to the pkgsrc but this time it's a system-wide install.
It's way older, so I had already forgot about its' existence.

Still no ideas why it interferes with ./configure four times:

sskras@server-5aef8ee:~/midipix/nt64/debug/tmp/php-native-x86_64-nt64-midipix$ grep -B3 'File in wrong format' obj/config.log
configure:35047: result: skipped, cross-compiling
configure:35360: checking for utimes
configure:35360: x86_64-nt64-midipix-gcc -std=gnu99 -o conftest -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -fvisibility=hidden -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -I/usr/pkg/include --sysroot=/home/sskras/midipix/nt64/debug/native -L/usr/pkg/lib -Wl,-rpath,/home/sskras/midipix/nt64/debug/bin/../native/lib -L/home/sskras/midipix/nt64/debug/bin/../native/lib -Wl,-rpath,/home/sskras/midipix/nt64/debug/native/lib -L/home/sskras/midipix/nt64/debug/native/lib conftest.c -lbz2 -lrt -lm  -lxml2 -lpcre2-8 -lxml2 >&5
/usr/pkg/lib/libbz2.so: error adding symbols: File in wrong format
--
configure:35366: checking for strndup
configure:35366: x86_64-nt64-midipix-gcc -std=gnu99 -o conftest -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -fvisibility=hidden -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -I/usr/pkg/include --sysroot=/home/sskras/midipix/nt64/debug/native -L/usr/pkg/lib -Wl,-rpath,/home/sskras/midipix/nt64/debug/bin/../native/lib -L/home/sskras/midipix/nt64/debug/bin/../native/lib -Wl,-rpath,/home/sskras/midipix/nt64/debug/native/lib -L/home/sskras/midipix/nt64/debug/native/lib conftest.c -lbz2 -lrt -lm  -lxml2 -lpcre2-8 -lxml2 >&5
conftest.c:261:6: warning: conflicting types for built-in function 'strndup' [enabled by default]
/usr/pkg/lib/libbz2.so: error adding symbols: File in wrong format
--
configure:40884: result: yes, shared
configure:40904: checking for bindtextdomain in -lintl
configure:40927: x86_64-nt64-midipix-gcc -std=gnu99 -o conftest -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -fvisibility=hidden -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -I/usr/pkg/include --sysroot=/home/sskras/midipix/nt64/debug/native -L/usr/pkg/lib -Wl,-rpath,/home/sskras/midipix/nt64/debug/bin/../native/lib -L/home/sskras/midipix/nt64/debug/bin/../native/lib -Wl,-rpath,/home/sskras/midipix/nt64/debug/native/lib -L/home/sskras/midipix/nt64/debug/native/lib -L/usr/lib conftest.c -lintl  -lbz2 -lrt -lm  -lxml2 -lpcre2-8 -lxml2 >&5
/usr/pkg/lib/libbz2.so: error adding symbols: File in wrong format
--
configure:40937: result: no
configure:40946: checking for bindtextdomain in -lc
configure:40969: x86_64-nt64-midipix-gcc -std=gnu99 -o conftest -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -fvisibility=hidden -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -I/usr/pkg/include --sysroot=/home/sskras/midipix/nt64/debug/native -L/usr/pkg/lib -Wl,-rpath,/home/sskras/midipix/nt64/debug/bin/../native/lib -L/home/sskras/midipix/nt64/debug/bin/../native/lib -Wl,-rpath,/home/sskras/midipix/nt64/debug/native/lib -L/home/sskras/midipix/nt64/debug/native/lib -L/usr/lib conftest.c -lc  -lbz2 -lrt -lm  -lxml2 -lpcre2-8 -lxml2 >&5
/usr/pkg/lib/libbz2.so: error adding symbols: File in wrong format

AFAIK this path is absent from any of my configuration.

This is first time ./configure mentions /usr/pkg-based paths:

configure:12025: x86_64-nt64-midipix-gcc -std=gnu99 -o conftest -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -fvisibility=hidden -D_REDIR_TIME64=0 -g2 -O0 --sysroot=/home/sskras/midipix/nt64/debug/native -I/usr/pkg/include --sysroot=/home/sskras/midipix/nt64/debug/native -L/usr/pkg/lib conftest.c  >&5
configure:12025: $? = 0
configure:12025: result: yes

Heck! It's hardcoded into the php-8.1.20/configure script!

12011 if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
12012    CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
12013    LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
12014 fi

No ideas on how to proceed further.

Probably requires tinkering with AutoConf.

E.g. this NetBSDfr/pkgin cross-compilation patch for seemingly related configure issue:
configure.ac: Avoid existence checks in system we're building for. #134

Ah, so this location comes from NetBSD:

sskras@server-5aef8ee:~/midipix/nt64/debug/tmp/php-native-x86_64-nt64-midipix$ grep -IrB2 /usr/pkg/include php-8.1.20
php-8.1.20/configure.ac-dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary and
php-8.1.20/configure.ac-dnl source packages. This should be harmless on other OSs.
php-8.1.20/configure.ac:if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
php-8.1.20/configure.ac:   CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
--
  ...

Metadata Update from @sskras:
- Issue status updated to: Closed (was: Open)

10 months ago

Login to comment on this ticket.

Metadata