Opened 4 months ago

Closed 4 months ago

#69073 closed defect (fixed)

pcre2 fails to build for i386 with gcc-13: no such instruction: `lzcnt %eax, %eax'

Reported by: barracuda156 Owned by: larryv (Lawrence Velázquez)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: i386, snowleopard Cc:
Port: pcre2

Description

libtool: compile:  /opt/local/bin/gcc-mp-13 -DHAVE_CONFIG_H -I. -I./src -I./src -I/opt/local/include -DPCRE2_CODE_UNIT_WIDTH=8 -fvisibility=hidden -D_THREAD_SAFE -pipe -Os -arch i386 -MT src/libpcre2_8_la-pcre2_maketables.lo -MD -MP -MF src/.deps/libpcre2_8_la-pcre2_maketables.Tpo -c src/pcre2_maketables.c  -fno-common -DPIC -o src/.libs/libpcre2_8_la-pcre2_maketables.o
libtool: compile:  /opt/local/bin/gcc-mp-13 -DHAVE_CONFIG_H -I. -I./src -I./src -I/opt/local/include -DPCRE2_CODE_UNIT_WIDTH=8 -fvisibility=hidden -D_THREAD_SAFE -pipe -Os -arch i386 -MT src/libpcre2_8_la-pcre2_maketables.lo -MD -MP -MF src/.deps/libpcre2_8_la-pcre2_maketables.Tpo -c src/pcre2_maketables.c -o src/libpcre2_8_la-pcre2_maketables.o >/dev/null 2>&1
mv -f src/.deps/libpcre2_8_la-pcre2_maketables.Tpo src/.deps/libpcre2_8_la-pcre2_maketables.Plo
/bin/sh ./libtool  --tag=CC   --mode=compile /opt/local/bin/gcc-mp-13 -DHAVE_CONFIG_H -I. -I./src  "-I./src" -I/opt/local/include -DPCRE2_CODE_UNIT_WIDTH=8 -fvisibility=hidden     -D_THREAD_SAFE  -pipe -Os -arch i386 -MT src/libpcre2_8_la-pcre2_match.lo -MD -MP -MF src/.deps/libpcre2_8_la-pcre2_match.Tpo -c -o src/libpcre2_8_la-pcre2_match.lo `test -f 'src/pcre2_match.c' || echo './'`src/pcre2_match.c
libtool: compile:  /opt/local/bin/gcc-mp-13 -DHAVE_CONFIG_H -I. -I./src -I./src -I/opt/local/include -DPCRE2_CODE_UNIT_WIDTH=8 -fvisibility=hidden -D_THREAD_SAFE -pipe -Os -arch i386 -MT src/libpcre2_8_la-pcre2_match.lo -MD -MP -MF src/.deps/libpcre2_8_la-pcre2_match.Tpo -c src/pcre2_match.c  -fno-common -DPIC -o src/.libs/libpcre2_8_la-pcre2_match.o
src/sljit/sljitNativeX86_common.c:362:no such instruction: `lzcnt %eax, %eax'
src/sljit/sljitNativeX86_common.c:379:no such instruction: `tzcnt %eax, %eax'
make[1]: *** [src/libpcre2_8_la-pcre2_jit_compile.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
libtool: compile:  /opt/local/bin/gcc-mp-13 -DHAVE_CONFIG_H -I. -I./src -I./src -I/opt/local/include -DPCRE2_CODE_UNIT_WIDTH=8 -fvisibility=hidden -D_THREAD_SAFE -pipe -Os -arch i386 -MT src/libpcre2_8_la-pcre2_match.lo -MD -MP -MF src/.deps/libpcre2_8_la-pcre2_match.Tpo -c src/pcre2_match.c -o src/libpcre2_8_la-pcre2_match.o >/dev/null 2>&1
mv -f src/.deps/libpcre2_8_la-pcre2_match.Tpo src/.deps/libpcre2_8_la-pcre2_match.Plo
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_pcre/pcre2/work/pcre2-10.42'
make: *** [all] Error 2

Change History (3)

comment:1 Changed 4 months ago by kencu (Ken)

The assembler doesn't understand the noted instruction.

The assembler used by gcc when building on older Intel systems is something that requires a bit of understanding. By default, the original "gas" assembler is used. This is very very old now, however, and is missing support for a lot of commonly used instructions.

Josh modified MacPorts' cctools some years ago now to have the assembler spin off to any new clang version that might be installed instead (clang can function as just the assembler, and it has support for more modern assembly instructions).

Exactly which clang will be used is where things get murky, but it is basically going to be the newest clang you have installed. The details of how it is selected are in the cctools portfile and patches.

In practice, if you have clang-9.0 and clang-11 installed, which you commonly do have on these systems, gcc will use one of those as the assembler and usually that is sufficient.

Because this issue didn't come up all that often, it was decided not to force gcc to always have a clang installed. However, as time goes by, it is coming up more, so perhaps that will need to be forced eventually.

If you already do have some fairly recent clang installed, and you are still seeing this assembler error, then there might be something else going on that needs tweaking.

comment:2 Changed 4 months ago by jmroot (Joshua Root)

Owner: set to larryv
Status: newassigned

comment:3 Changed 4 months ago by barracuda156

Resolution: fixed
Status: assignedclosed

In b200eb19052f10c9af58ae5634472eeaf16854ce/macports-ports (master):

pcre2: allow build on x86 with libstdc++

Closes: #67477
Closes: #69073

Note: See TracTickets for help on using tickets.