[Bug 292349] lang/perl5.40: perl cc/cpp symbol set incomplete, _h2ph_pre.ph suffers

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 10 Jan 2026 20:25:15 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292349

            Bug ID: 292349
           Summary: lang/perl5.40: perl cc/cpp symbol set incomplete,
                    _h2ph_pre.ph suffers
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: mat@FreeBSD.org
          Reporter: p-fbsd-bugs@ziemba.us
             Flags: maintainer-feedback?(mat@FreeBSD.org)
          Assignee: mat@FreeBSD.org

Environment
===========
Pretty close to stock 14.2-STABLE FreeBSD.

% uname -v
FreeBSD 14.2-STABLE working/ziemba/14s-250403-hairball-n270958-3b5ff3cb216a
GPZ-14s-250403

I build my ports locally using poudriere; jail is also the same version of
FreeBSD.

% perl -v
This is perl 5, version 40, subversion 1 (v5.40.1) built for
amd64-freebsd-thread-multi

I also had the same problem with perl5.36 on this same version of FreeBSD.

What I'm trying to do
---------------------
I'd like to:
    #!/usr/bin/perl -w
    require 'sys/ioctl.ph';

But this fails with:
    Use of uninitialized value in numeric eq (==) at
/usr/local/lib/perl5/site_perl/mach/5.40/sys/_types.ph line 8.
    Use of uninitialized value in numeric eq (==) at
/usr/local/lib/perl5/site_perl/mach/5.40/sys/_types.ph line 10.
    unsupported long size at
/usr/local/lib/perl5/site_perl/mach/5.40/sys/_types.ph line 12.
    Compilation failed in require at
/usr/local/lib/perl5/site_perl/mach/5.40/sys/filio.ph line 7.
    Compilation failed in require at
/usr/local/lib/perl5/site_perl/mach/5.40/sys/ioctl.ph line 11.
    Compilation failed in require at ./testph line 2.

Analysis
--------
Part of /usr/local/lib/perl5/site_perl/mach/5.40/sys/_types.ph:

     1  require '_h2ph_pre.ph';
     ...
     8      if((defined(&__SIZEOF_LONG__) ? &__SIZEOF_LONG__ : undef) == 8) {
     9      }
    10   elsif((defined(&__SIZEOF_LONG__) ? &__SIZEOF_LONG__ : undef) == 4) {

Line 8 reduces to "if (undef == 8) {" because __SIZEOF_LONG__ isn't defined.

But 

    % cc -dM -E - < /dev/null | grep __SIZEOF_LONG__
    #define __SIZEOF_LONG__ 8
    % cc -dM -E - < /dev/null | wc -l
         394

and "cc -dM -E - < /dev/null" generates a lot of symbols that are not
represented in _h2ph_pre.ph. Here is the entire _h2ph_pre.ph (blank lines
removed):

    # This file was created by h2ph version 5
    no warnings qw(portable);
    sub _LP64() { 1 }
    sub __BYTE_ORDER__() { 1234 }
    sub __ELF__() { 1 }
    sub __FreeBSD__() { 14 }
    sub __GCC_HAVE_DWARF2_CFI_ASM() { 1 }
    sub __GNUC_MINOR__() { 2 }
    sub __GNUC__() { 4 }
    sub __LITTLE_ENDIAN__() { 1 }
    sub __LP64__() { 1 }
    sub __STDC__() { 1 }
    sub __amd64() { 1 }
    sub __amd64__() { 1 }
    sub __clang__() { 1 }
    sub __unix() { 1 }
    sub __unix__() { 1 }
    sub __x86_64() { 1 }
    sub __x86_64__() { 1 }
    sub unix() { 1 }
    1;

I think h2ph is generated from values in perl's %Config. I looked at the
relevant keys:

    #!/usr/bin/perl
    use Config;
    for my $K ('ccsymbols', 'cppsymbols', 'cppccsymbols') {
        print "$K: ", $Config{$K}, "\n";
    }

Output:

    ccsymbols: __GCC_HAVE_DWARF2_CFI_ASM=1
    cppsymbols: _LP64=1 __BYTE_ORDER__=1234 __ELF__=1 __FreeBSD__=14
__GNUC_MINOR__=2 __GNUC__=4 __LITTLE_ENDIAN__=1 __LP64__=1 __STDC__=1 __amd64=1
__amd64__=1 __clang__=1 __unix=1 __unix__=1 __x86_64=1 __x86_64__=1 unix=1
    cppccsymbols:

I'm not sure where to go next. It looks as if the perl5 build process didn't
capture the entire set of symbols.

-- 
You are receiving this mail because:
You are the assignee for the bug.