Skip to content

ld: error: undefined hidden symbol: Perl_do_ncmp #2

Description

@eserte

Fails to link with perl 5.38 and later:

cc  -shared  -L/usr/local/lib -fstack-protector-strong  XS.o  -o blib/arch/auto/Algorithm/Heapify/XS/XS.so        
ld: error: undefined hidden symbol: Perl_do_ncmp
>>> referenced by XS.c
>>>               XS.o:(sift_up)
>>> referenced by XS.c
>>>               XS.o:(sift_down)
>>> referenced by XS.c
>>>               XS.o:(sift_down)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Activity

  1. book commented on Oct 9, 2025

    @book
    Contributor

    I came here confirm the issue with a similar error log:

    gcc -c  -I. -DSILENT_NO_TAINT_SUPPORT -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O3   -DVERSION=\"0.04\" -DXS_VERSION=\"0.04\" -fPIC "-I/usr/local/booking-perl/5.42/lib/CORE"   XS.c
    rm -f blib/arch/auto/Algorithm/Heapify/XS/XS.so
    LD_RUN_PATH="/usr/lib/pakket/5.42/libraries/active/lib:/usr/lib/pakket/5.42/libraries/active/lib64" gcc  -shared -g1 -O3 -L/usr/local/lib -fstack-protector-strong  XS.o  -o blib/arch/auto/Algorithm/Heapify/XS/XS.so  \
    /opt/rh/gcc-toolset-12/root/usr/libexec/gcc/x86_64-redhat-linux/12/ld: XS.o: in function `sift_up':
    XS.c:(.text+0x1f1): undefined reference to `Perl_do_ncmp'
    /opt/rh/gcc-toolset-12/root/usr/libexec/gcc/x86_64-redhat-linux/12/ld: XS.o: in function `sift_down':
    XS.c:(.text+0x7f9): undefined reference to `Perl_do_ncmp'
    /opt/rh/gcc-toolset-12/root/usr/libexec/gcc/x86_64-redhat-linux/12/ld: XS.c:(.text+0x811): undefined reference to `Perl_do_ncmp'
    /opt/rh/gcc-toolset-12/root/usr/libexec/gcc/x86_64-redhat-linux/12/ld: blib/arch/auto/Algorithm/Heapify/XS/XS.so: hidden symbol `Perl_do_ncmp' isn't defined
    /opt/rh/gcc-toolset-12/root/usr/libexec/gcc/x86_64-redhat-linux/12/ld: final link failed: bad value
    collect2: error: ld returned 1 exit status
    make: *** [Makefile:481: blib/arch/auto/Algorithm/Heapify/XS/XS.so] Error 1
    
  2. ericherman commented on Nov 12, 2025

    @ericherman

    If we look at line 1072 of proto.h at perl5 commit 0351a629e71de127cbfd1b142e9eaa6069deabf5

    As we can see was updated in the diff but GitHub's deep linking doesn't seem to support the diff-view.

  3. demerphq commented on Jun 29, 2026

    @demerphq
    Owner

    Sorry this is fixed now in v 5.0

  4. demerphq commented on Jun 29, 2026

    @demerphq
    Owner

    FWIW, this really should not have been removed from core, I fixed this by copying the one from core, which doesn't make sense. Its actually a bit trick to make an efficient function for this, see Perl_do_ncmp()'s code.

  5. book commented on Jun 29, 2026

    @book
    Contributor

    FWIW, this really should not have been removed from core, I fixed this by copying the one from core, which doesn't make sense. Its actually a bit trick to make an efficient function for this, see Perl_do_ncmp()'s code.

    @demerphq, thanks for the release! I've just build it on our systems!

    For the general discussion about hidden functions, maybe you'll want to chime in the discussion on Perl/perl5#23918, especially these comments by @Leont (Perl/perl5#23918 (comment)) and @tonycoz (Perl/perl5#23918 (comment)).

  6. tonycoz commented on Jun 29, 2026

    @tonycoz

    5.43.8 adds sv_numcmp(), sv_numlt(), sv_numgt() etc that handle overloading correctly (more correctly than the 0.03 or 0.06 implementation here) - ticket to come

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions