The version of libtool fails to properly compile the binaries because when passing "-static" in CFLAGS and LDFLAGS, it never reaches the compiler and linker toolchain. This results in a dynamically linked binary instead of a statically linked one. You can execute the following script to reproduce the issue which I have observed in both the latest release 10.42 and the current Git HEAD:
Editing to add a note: I copied the flags from an old PCRE 8 build. If I remove the obsolete options, CFLAGS, LDFLAGS and rely only on "--enable-static", I still get a dynamically linked executable as explained in this comment.
#!/bin/sh
set -x -e -u -f
test -e pcre2 || git clone https://github.com/PCRE2Project/pcre2.git
prefix="$PWD/prefix"
mkdir -p "$prefix"
cd pcre2
./autogen.sh
./configure -C \
CC="c99" \
CFLAGS="-static" \
LDFLAGS="-static" \
--disable-cpp \
--disable-shared \
--enable-jit \
--enable-static \
--enable-unicode-properties \
--enable-utf \
--prefix="$prefix" \
;
make install
ldd "$prefix/bin/pcre2grep"
Interestingly, I can successfully use --static instead of -static, a work-around I found on Stack Overflow. I noticed the issue while trying to build PCRE2 with musl, but I can also reproduce the issue using glibc.
This is what the output produces on my Debian 12 amd64 system:
pcre2$ ./x.sh
+ test -e pcre2
+ git clone https://github.com/PCRE2Project/pcre2.git
Cloning into 'pcre2'...
remote: Enumerating objects: 15200, done.
remote: Counting objects: 100% (908/908), done.
remote: Compressing objects: 100% (319/319), done.
remote: Total 15200 (delta 662), reused 753 (delta 587), pack-reused 14292
Receiving objects: 100% (15200/15200), 12.06 MiB | 22.45 MiB/s, done.
Resolving deltas: 100% (12821/12821), done.
+ prefix=/home/ericpruitt/projects/pcre2/prefix
+ mkdir -p /home/ericpruitt/projects/pcre2/prefix
+ cd pcre2
+ ./autogen.sh
Looking for a version of libtoolize (which can have different names)...
Did not find glibtoolize
Did not find libtoolize15
Did not find libtoolize14
Found libtoolize
+ libtoolize -c -f
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
+ rm -rf autom4te.cache Makefile.in aclocal.m4
+ aclocal --force -I m4
+ autoconf -f -W all,no-obsolete
+ autoheader -f -W all
+ automake -a -c -f -W all,no-portability
configure.ac:61: installing './ar-lib'
configure.ac:45: installing './compile'
configure.ac:67: installing './config.guess'
configure.ac:67: installing './config.sub'
configure.ac:28: installing './install-sh'
configure.ac:28: installing './missing'
Makefile.am: installing './INSTALL'
Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
+ rm -rf autom4te.cache
+ exit 0
+ ./configure -C CC=c99 CFLAGS=-static LDFLAGS=-static --disable-cpp --disable-shared --enable-jit --enable-static --enable-unicode-properties --enable-utf --prefix=/home/ericpruitt/projects/pcre2/prefix
configure: WARNING: unrecognized options: --disable-cpp, --enable-unicode-properties, --enable-utf
configure: creating cache config.cache
checking for a BSD-compatible install... /home/ericpruitt/.local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /home/ericpruitt/.local/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... c99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether c99 accepts -g... yes
checking for c99 option to enable C11 features... unsupported
checking for c99 option to enable C99 features... none needed
checking whether c99 understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of c99... gcc3
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for ar... ar
checking the archiver (ar) interface... ar
checking for int64_t... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /home/ericpruitt/.local/bin/sed
checking for grep that handles long lines and -e... /home/ericpruitt/.local/bin/grep
checking for egrep... /home/ericpruitt/.local/bin/grep -E
checking for fgrep... /home/ericpruitt/.local/bin/grep -F
checking for ld used by c99... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from c99 object... ok
checking for sysroot... no
checking for a working dd... /home/ericpruitt/.local/bin/dd
checking how to truncate binary pipes... /home/ericpruitt/.local/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if c99 supports -fno-rtti -fno-exceptions... no
checking for c99 option to produce PIC... -fPIC -DPIC
checking if c99 PIC flag -fPIC -DPIC works... yes
checking if c99 static flag -static works... yes
checking if c99 supports -c -o file.o... yes
checking if c99 supports -c -o file.o... (cached) yes
checking whether the c99 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether ln -s works... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether the -Werror option is usable... yes
checking for simple visibility declarations... yes
checking for __builtin_mul_overflow()... yes
checking for __attribute__((uninitialized))... yes
checking for limits.h... yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for dirent.h... yes
checking for windows.h... no
checking for sys/wait.h... yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for bcopy... yes
checking for memfd_create... yes
checking for memmove... yes
checking for mkostemp... yes
checking for secure_getenv... yes
checking for strerror... yes
checking for realpath... yes
checking for zlib.h... yes
checking for gzopen in -lz... yes
checking for bzlib.h... no
checking for libbz2... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking whether Intel CET is enabled... no
configure: updating cache config.cache
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libpcre2-8.pc
config.status: creating libpcre2-16.pc
config.status: creating libpcre2-32.pc
config.status: creating libpcre2-posix.pc
config.status: creating pcre2-config
config.status: creating src/pcre2.h
config.status: creating src/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing script-chmod commands
config.status: executing delete-old-chartables commands
configure: WARNING: unrecognized options: --disable-cpp, --enable-unicode-properties, --enable-utf
pcre2-10.43-DEV configuration summary:
Install prefix ..................... : /home/ericpruitt/projects/pcre2/prefix
C preprocessor ..................... :
C compiler ......................... : c99
Linker ............................. : /usr/bin/ld -m elf_x86_64
C preprocessor flags ............... :
C compiler flags ................... : -static -fvisibility=hidden
Linker flags ....................... : -static
Extra libraries .................... :
Build 8-bit pcre2 library .......... : yes
Build 16-bit pcre2 library ......... : no
Build 32-bit pcre2 library ......... : no
Include debugging code ............. : no
Enable JIT compiling support ....... : yes
Use SELinux allocator in JIT ....... : no
Enable Unicode support ............. : yes
Newline char/sequence .............. : lf
\R matches only ANYCRLF ............ : no
\C is disabled ..................... : no
EBCDIC coding ...................... : no
EBCDIC code for NL ................. : n/a
Rebuild char tables ................ : no
Internal link size ................. : 2
Maximum variable lookbehind ........ : 255
Nested parentheses limit ........... : 250
Heap limit ......................... : 20000000 kibibytes
Match limit ........................ : 10000000
Match depth limit .................. : MATCH_LIMIT
Build shared libs .................. : no
Build static libs .................. : yes
Use JIT in pcre2grep ............... : yes
Enable callouts in pcre2grep ....... : yes
Enable fork in pcre2grep callouts .. : yes
Initial buffer size for pcre2grep .. : 20480
Maximum buffer size for pcre2grep .. : 1048576
Link pcre2grep with libz ........... : no
Link pcre2grep with libbz2 ......... : no
Link pcre2test with libedit ........ : no
Link pcre2test with libreadline .... : no
Valgrind support ................... : no
Code coverage ...................... : no
Fuzzer support ..................... : no
Use %zu and %td .................... : auto
+ make install
rm -f src/pcre2_chartables.c
ln -s /home/ericpruitt/projects/pcre2/pcre2/src/pcre2_chartables.c.dist /home/ericpruitt/projects/pcre2/pcre2/src/pcre2_chartables.c
make install-am
make[1]: Entering directory '/home/ericpruitt/projects/pcre2/pcre2'
CC src/pcre2grep-pcre2grep.o
CC src/libpcre2_8_la-pcre2_auto_possess.lo
CC src/libpcre2_8_la-pcre2_chkdint.lo
CC src/libpcre2_8_la-pcre2_compile.lo
CC src/libpcre2_8_la-pcre2_config.lo
CC src/libpcre2_8_la-pcre2_context.lo
CC src/libpcre2_8_la-pcre2_convert.lo
CC src/libpcre2_8_la-pcre2_dfa_match.lo
CC src/libpcre2_8_la-pcre2_error.lo
CC src/libpcre2_8_la-pcre2_extuni.lo
CC src/libpcre2_8_la-pcre2_find_bracket.lo
CC src/libpcre2_8_la-pcre2_jit_compile.lo
CC src/libpcre2_8_la-pcre2_maketables.lo
CC src/libpcre2_8_la-pcre2_match.lo
CC src/libpcre2_8_la-pcre2_match_data.lo
CC src/libpcre2_8_la-pcre2_newline.lo
CC src/libpcre2_8_la-pcre2_ord2utf.lo
CC src/libpcre2_8_la-pcre2_pattern_info.lo
CC src/libpcre2_8_la-pcre2_script_run.lo
CC src/libpcre2_8_la-pcre2_serialize.lo
CC src/libpcre2_8_la-pcre2_string_utils.lo
CC src/libpcre2_8_la-pcre2_study.lo
CC src/libpcre2_8_la-pcre2_substitute.lo
CC src/libpcre2_8_la-pcre2_substring.lo
CC src/libpcre2_8_la-pcre2_tables.lo
CC src/libpcre2_8_la-pcre2_ucd.lo
CC src/libpcre2_8_la-pcre2_xclass.lo
CC src/libpcre2_8_la-pcre2_chartables.lo
CC src/libpcre2_8_la-pcre2_valid_utf.lo
CC src/pcre2test-pcre2test.o
CC src/libpcre2_posix_la-pcre2posix.lo
CC src/pcre2posix_test-pcre2posix_test.o
CC src/pcre2_jit_test-pcre2_jit_test.o
CCLD libpcre2-8.la
CCLD libpcre2-posix.la
CCLD pcre2grep
CCLD pcre2_jit_test
CCLD pcre2posix_test
CCLD pcre2test
make[2]: Entering directory '/home/ericpruitt/projects/pcre2/pcre2'
/home/ericpruitt/.local/bin/mkdir -p '/home/ericpruitt/projects/pcre2/prefix/bin'
/home/ericpruitt/.local/bin/mkdir -p '/home/ericpruitt/projects/pcre2/prefix/share/doc/pcre2'
/home/ericpruitt/.local/bin/ginstall -c pcre2-config '/home/ericpruitt/projects/pcre2/prefix/bin'
/home/ericpruitt/.local/bin/ginstall -c -m 644 AUTHORS COPYING ChangeLog LICENCE NEWS README doc/pcre2.txt doc/pcre2-config.txt doc/pcre2grep.txt doc/pcre2test.txt '/home/ericpruitt/projects/pcre2/prefix/share/doc/pcre2'
/home/ericpruitt/.local/bin/mkdir -p '/home/ericpruitt/projects/pcre2/prefix/share/doc/pcre2/html'
/home/ericpruitt/.local/bin/mkdir -p '/home/ericpruitt/projects/pcre2/prefix/include'
/home/ericpruitt/.local/bin/ginstall -c -m 644 src/pcre2posix.h '/home/ericpruitt/projects/pcre2/prefix/include'
/home/ericpruitt/.local/bin/ginstall -c -m 644 doc/html/NON-AUTOTOOLS-BUILD.txt doc/html/README.txt doc/html/index.html doc/html/pcre2-config.html doc/html/pcre2.html doc/html/pcre2_callout_enumerate.html doc/html/pcre2_code_copy.html doc/
html/pcre2_code_copy_with_tables.html doc/html/pcre2_code_free.html doc/html/pcre2_compile.html doc/html/pcre2_compile_context_copy.html doc/html/pcre2_compile_context_create.html doc/html/pcre2_compile_context_free.html doc/html/pcre2_conf
ig.html doc/html/pcre2_convert_context_copy.html doc/html/pcre2_convert_context_create.html doc/html/pcre2_convert_context_free.html doc/html/pcre2_converted_pattern_free.html doc/html/pcre2_dfa_match.html doc/html/pcre2_general_context_cop
y.html doc/html/pcre2_general_context_create.html doc/html/pcre2_general_context_free.html doc/html/pcre2_get_error_message.html doc/html/pcre2_get_mark.html doc/html/pcre2_get_match_data_heapframes_size.html doc/html/pcre2_get_match_data_s
ize.html doc/html/pcre2_get_ovector_count.html doc/html/pcre2_get_ovector_pointer.html doc/html/pcre2_get_startchar.html doc/html/pcre2_jit_compile.html doc/html/pcre2_jit_free_unused_memory.html doc/html/pcre2_jit_match.html doc/html/pcre2
_jit_stack_assign.html doc/html/pcre2_jit_stack_create.html doc/html/pcre2_jit_stack_free.html doc/html/pcre2_maketables.html doc/html/pcre2_maketables_free.html doc/html/pcre2_match.html doc/html/pcre2_match_context_copy.html doc/html/pcre
2_match_context_create.html '/home/ericpruitt/projects/pcre2/prefix/share/doc/pcre2/html'
/home/ericpruitt/.local/bin/mkdir -p '/home/ericpruitt/projects/pcre2/prefix/include'
/home/ericpruitt/.local/bin/mkdir -p '/home/ericpruitt/projects/pcre2/prefix/share/man/man1'
/home/ericpruitt/.local/bin/mkdir -p '/home/ericpruitt/projects/pcre2/prefix/lib/pkgconfig'
/home/ericpruitt/.local/bin/mkdir -p '/home/ericpruitt/projects/pcre2/prefix/share/man/man3'
/home/ericpruitt/.local/bin/ginstall -c -m 644 src/pcre2.h '/home/ericpruitt/projects/pcre2/prefix/include'
/home/ericpruitt/.local/bin/ginstall -c -m 644 doc/html/pcre2_match_context_free.html doc/html/pcre2_match_data_create.html doc/html/pcre2_match_data_create_from_pattern.html doc/html/pcre2_match_data_free.html doc/html/pcre2_pattern_conve
rt.html doc/html/pcre2_pattern_info.html doc/html/pcre2_serialize_decode.html doc/html/pcre2_serialize_encode.html doc/html/pcre2_serialize_free.html doc/html/pcre2_serialize_get_number_of_codes.html doc/html/pcre2_set_bsr.html doc/html/pcr
e2_set_callout.html doc/html/pcre2_set_character_tables.html doc/html/pcre2_set_compile_extra_options.html doc/html/pcre2_set_compile_recursion_guard.html doc/html/pcre2_set_depth_limit.html doc/html/pcre2_set_glob_escape.html doc/html/pcre
2_set_glob_separator.html doc/html/pcre2_set_heap_limit.html doc/html/pcre2_set_match_limit.html doc/html/pcre2_set_max_pattern_length.html doc/html/pcre2_set_max_varlookbehind.html doc/html/pcre2_set_offset_limit.html doc/html/pcre2_set_ne
wline.html doc/html/pcre2_set_parens_nest_limit.html doc/html/pcre2_set_recursion_limit.html doc/html/pcre2_set_recursion_memory_management.html doc/html/pcre2_set_substitute_callout.html doc/html/pcre2_substitute.html doc/html/pcre2_substr
ing_copy_byname.html doc/html/pcre2_substring_copy_bynumber.html doc/html/pcre2_substring_free.html doc/html/pcre2_substring_get_byname.html doc/html/pcre2_substring_get_bynumber.html doc/html/pcre2_substring_length_byname.html doc/html/pcr
e2_substring_length_bynumber.html doc/html/pcre2_substring_list_free.html doc/html/pcre2_substring_list_get.html doc/html/pcre2_substring_nametable_scan.html doc/html/pcre2_substring_number_from_name.html '/home/ericpruitt/projects/pcre2/pr
efix/share/doc/pcre2/html'
/home/ericpruitt/.local/bin/ginstall -c -m 644 libpcre2-8.pc libpcre2-posix.pc '/home/ericpruitt/projects/pcre2/prefix/lib/pkgconfig'
/home/ericpruitt/.local/bin/ginstall -c -m 644 doc/pcre2-config.1 doc/pcre2grep.1 doc/pcre2test.1 '/home/ericpruitt/projects/pcre2/prefix/share/man/man1'
/home/ericpruitt/.local/bin/mkdir -p '/home/ericpruitt/projects/pcre2/prefix/lib'
/home/ericpruitt/.local/bin/ginstall -c -m 644 doc/html/pcre2api.html doc/html/pcre2build.html doc/html/pcre2callout.html doc/html/pcre2compat.html doc/html/pcre2convert.html doc/html/pcre2demo.html doc/html/pcre2grep.html doc/html/pcre2ji
t.html doc/html/pcre2limits.html doc/html/pcre2matching.html doc/html/pcre2partial.html doc/html/pcre2pattern.html doc/html/pcre2perform.html doc/html/pcre2posix.html doc/html/pcre2sample.html doc/html/pcre2serialize.html doc/html/pcre2synt
ax.html doc/html/pcre2test.html doc/html/pcre2unicode.html '/home/ericpruitt/projects/pcre2/prefix/share/doc/pcre2/html'
/bin/bash ./libtool --mode=install /home/ericpruitt/.local/bin/ginstall -c libpcre2-8.la libpcre2-posix.la '/home/ericpruitt/projects/pcre2/prefix/lib'
/home/ericpruitt/.local/bin/ginstall -c -m 644 doc/pcre2.3 doc/pcre2_callout_enumerate.3 doc/pcre2_code_copy.3 doc/pcre2_code_copy_with_tables.3 doc/pcre2_code_free.3 doc/pcre2_compile.3 doc/pcre2_compile_context_copy.3 doc/pcre2_compile_c
ontext_create.3 doc/pcre2_compile_context_free.3 doc/pcre2_config.3 doc/pcre2_convert_context_copy.3 doc/pcre2_convert_context_create.3 doc/pcre2_convert_context_free.3 doc/pcre2_converted_pattern_free.3 doc/pcre2_dfa_match.3 doc/pcre2_gene
ral_context_copy.3 doc/pcre2_general_context_create.3 doc/pcre2_general_context_free.3 doc/pcre2_get_error_message.3 doc/pcre2_get_mark.3 doc/pcre2_get_match_data_heapframes_size.3 doc/pcre2_get_match_data_size.3 doc/pcre2_get_ovector_count
.3 doc/pcre2_get_ovector_pointer.3 doc/pcre2_get_startchar.3 doc/pcre2_jit_compile.3 doc/pcre2_jit_free_unused_memory.3 doc/pcre2_jit_match.3 doc/pcre2_jit_stack_assign.3 doc/pcre2_jit_stack_create.3 doc/pcre2_jit_stack_free.3 doc/pcre2_mak
etables.3 doc/pcre2_maketables_free.3 doc/pcre2_match.3 doc/pcre2_match_context_copy.3 doc/pcre2_match_context_create.3 doc/pcre2_match_context_free.3 doc/pcre2_match_data_create.3 doc/pcre2_match_data_create_from_pattern.3 doc/pcre2_match_
data_free.3 '/home/ericpruitt/projects/pcre2/prefix/share/man/man3'
/home/ericpruitt/.local/bin/ginstall -c -m 644 doc/pcre2_pattern_convert.3 doc/pcre2_pattern_info.3 doc/pcre2_serialize_decode.3 doc/pcre2_serialize_encode.3 doc/pcre2_serialize_free.3 doc/pcre2_serialize_get_number_of_codes.3 doc/pcre2_se
t_bsr.3 doc/pcre2_set_callout.3 doc/pcre2_set_character_tables.3 doc/pcre2_set_compile_extra_options.3 doc/pcre2_set_compile_recursion_guard.3 doc/pcre2_set_depth_limit.3 doc/pcre2_set_glob_escape.3 doc/pcre2_set_glob_separator.3 doc/pcre2_
set_heap_limit.3 doc/pcre2_set_match_limit.3 doc/pcre2_set_max_pattern_length.3 doc/pcre2_set_max_varlookbehind.3 doc/pcre2_set_offset_limit.3 doc/pcre2_set_newline.3 doc/pcre2_set_parens_nest_limit.3 doc/pcre2_set_recursion_limit.3 doc/pcr
e2_set_recursion_memory_management.3 doc/pcre2_set_substitute_callout.3 doc/pcre2_substitute.3 doc/pcre2_substring_copy_byname.3 doc/pcre2_substring_copy_bynumber.3 doc/pcre2_substring_free.3 doc/pcre2_substring_get_byname.3 doc/pcre2_subst
ring_get_bynumber.3 doc/pcre2_substring_length_byname.3 doc/pcre2_substring_length_bynumber.3 doc/pcre2_substring_list_free.3 doc/pcre2_substring_list_get.3 doc/pcre2_substring_nametable_scan.3 doc/pcre2_substring_number_from_name.3 doc/pcr
e2api.3 doc/pcre2build.3 doc/pcre2callout.3 doc/pcre2compat.3 '/home/ericpruitt/projects/pcre2/prefix/share/man/man3'
/home/ericpruitt/.local/bin/ginstall -c -m 644 doc/pcre2convert.3 doc/pcre2demo.3 doc/pcre2jit.3 doc/pcre2limits.3 doc/pcre2matching.3 doc/pcre2partial.3 doc/pcre2pattern.3 doc/pcre2perform.3 doc/pcre2posix.3 doc/pcre2sample.3 doc/pcre2ser
ialize.3 doc/pcre2syntax.3 doc/pcre2unicode.3 '/home/ericpruitt/projects/pcre2/prefix/share/man/man3'
libtool: install: /home/ericpruitt/.local/bin/ginstall -c .libs/libpcre2-8.lai /home/ericpruitt/projects/pcre2/prefix/lib/libpcre2-8.la
libtool: install: /home/ericpruitt/.local/bin/ginstall -c .libs/libpcre2-posix.lai /home/ericpruitt/projects/pcre2/prefix/lib/libpcre2-posix.la
libtool: install: /home/ericpruitt/.local/bin/ginstall -c .libs/libpcre2-8.a /home/ericpruitt/projects/pcre2/prefix/lib/libpcre2-8.a
libtool: install: chmod 644 /home/ericpruitt/projects/pcre2/prefix/lib/libpcre2-8.a
libtool: install: ranlib /home/ericpruitt/projects/pcre2/prefix/lib/libpcre2-8.a
libtool: install: /home/ericpruitt/.local/bin/ginstall -c .libs/libpcre2-posix.a /home/ericpruitt/projects/pcre2/prefix/lib/libpcre2-posix.a
libtool: install: chmod 644 /home/ericpruitt/projects/pcre2/prefix/lib/libpcre2-posix.a
libtool: install: ranlib /home/ericpruitt/projects/pcre2/prefix/lib/libpcre2-posix.a
libtool: finish: PATH="/home/ericpruitt/emus/desktop-environment/scripts:/home/ericpruitt/bin:/home/ericpruitt/emus/scripts:/home/ericpruitt/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/cuda-11.1/bin:/usr/l
ocal/cuda-11.1/targets/x86_64-linux/include:/sbin" ldconfig -n /home/ericpruitt/projects/pcre2/prefix/lib
----------------------------------------------------------------------
Libraries have been installed in:
/home/ericpruitt/projects/pcre2/prefix/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/home/ericpruitt/.local/bin/mkdir -p '/home/ericpruitt/projects/pcre2/prefix/bin'
/bin/bash ./libtool --mode=install /home/ericpruitt/.local/bin/ginstall -c pcre2grep pcre2test '/home/ericpruitt/projects/pcre2/prefix/bin'
libtool: install: /home/ericpruitt/.local/bin/ginstall -c pcre2grep /home/ericpruitt/projects/pcre2/prefix/bin/pcre2grep
libtool: install: /home/ericpruitt/.local/bin/ginstall -c pcre2test /home/ericpruitt/projects/pcre2/prefix/bin/pcre2test
make[2]: Leaving directory '/home/ericpruitt/projects/pcre2/pcre2'
make[1]: Leaving directory '/home/ericpruitt/projects/pcre2/pcre2'
+ ldd /home/ericpruitt/projects/pcre2/prefix/bin/pcre2grep
linux-vdso.so.1 (0x00007ffddbdc0000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f924d8d2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f924db8e000)
Notice that ldd(1) shows it's dynamically linked when it should be statically linked. When using glibc, the binary still runs since I have glibc installed globally as the default libc on my system, but for musl, it produces a completely broken binary since the executable references a loader path that doesn't exist:
$ pcre2-10.42/pcre2grep --help
bash: pcre2-10.42/pcre2grep: No such file or directory
(127)
$ xxd pcre2-10.42/pcre2grep
...
00000220: 5004 0000 0000 0000 5004 0000 0000 0000 P.......P.......
00000230: 0100 0000 0000 0000 2f6c 6962 2f6c 642d ......../lib/ld-
00000240: 6d75 736c 2d78 3836 5f36 342e 736f 2e31 musl-x86_64.so.1
00000250: 0000 0000 0000 0000 0300 0000 0400 0000 ................
00000260: 0000 0000 0300 0000 0100 0000 0000 0000 ................
...
The version of libtool fails to properly compile the binaries because when passing "-static" in CFLAGS and LDFLAGS, it never reaches the compiler and linker toolchain. This results in a dynamically linked binary instead of a statically linked one. You can execute the following script to reproduce the issue which I have observed in both the latest release 10.42 and the current Git HEAD:
Editing to add a note: I copied the flags from an old PCRE 8 build. If I remove the obsolete options, CFLAGS, LDFLAGS and rely only on "--enable-static", I still get a dynamically linked executable as explained in this comment.
Interestingly, I can successfully use
--staticinstead of-static, a work-around I found on Stack Overflow. I noticed the issue while trying to build PCRE2 with musl, but I can also reproduce the issue using glibc.This is what the output produces on my Debian 12 amd64 system:
Notice that ldd(1) shows it's dynamically linked when it should be statically linked. When using glibc, the binary still runs since I have glibc installed globally as the default libc on my system, but for musl, it produces a completely broken binary since the executable references a loader path that doesn't exist: