tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

editors/emacs29 and gcc14-libjit default option breakage



Hi again,

I'm stumbling over a strange option for editors/emacs29 it fails during
configure on my Linux system with my gcc-13.2 toolchain. It gives such an error:

ld: cannot find crtbeginS.o: No such file or directory
ld: cannot find -lgcc: No such file or directory
ld: cannot find -lgcc_s: No such file or directory
libgccjit.so: error: error invoking gcc driver

This is on executing the successfully built conftest program that does
some gccjit stuff. It seems happily linked

$ ldd conftest
        linux-vdso.so.1 (0x00007ffc4b6e7000)
        libgccjit.so.0 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/gcc14/lib/libgccjit.so.0 (0x000014edcf7db000)
        libsqlite3.so.0 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libsqlite3.so.0 (0x000014edcf653000)
        libX11.so.6 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libX11.so.6 (0x000014edcf500000)
        libcairo.so.2 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libcairo.so.2 (0x000014edcf3af000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x000014edcf1c7000)
        libstdc++.so.6 => /sw/compiler/gcc-13.2.0/lib64/libstdc++.so.6 (0x000014edcef61000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x000014edcee81000)
        libgcc_s.so.1 => /sw/compiler/gcc-13.2.0/lib64/libgcc_s.so.1 (0x000014edcee5b000)
        /lib64/ld-linux-x86-64.so.2 (0x000014edd20d4000)
        libz.so.1 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libz.so.1 (0x000014edcee3f000)
        libxcb.so.1 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libxcb.so.1 (0x000014edcee11000)
        libXau.so.6 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libXau.so.6 (0x000014edcee0c000)
        libXdmcp.so.6 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libXdmcp.so.6 (0x000014edcee04000)
        libpng16.so.16 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libpng16.so.16 (0x000014edcedc1000)
        libfontconfig.so.1 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libfontconfig.so.1 (0x000014edced73000)
        libfreetype.so.6 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libfreetype.so.6 (0x000014edceca3000)
        libXext.so.6 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libXext.so.6 (0x000014edcec8b000)
        libXrender.so.1 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libXrender.so.1 (0x000014edcec7d000)
        libxcb-render.so.0 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libxcb-render.so.0 (0x000014edcec6e000)
        libxcb-shm.so.0 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libxcb-shm.so.0 (0x000014edcec69000)
        libpixman-1.so.0 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libpixman-1.so.0 (0x000014edceb7c000)
        libbz2.so.0 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libbz2.so.0 (0x000014edceb65000)
        libbrotlidec.so.1 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libbrotlidec.so.1 (0x000014edceb56000)
        libexpat.so.1 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libexpat.so.1 (0x000014edceb2a000)
        libbrotlicommon.so.1 => /sw/env/gcc-13.2.0_openmpi-4.1.6/pkgsrc/2025Q1-devel/lib/libbrotlicommon.so.1 (0x000014edceb05000)

but you might observe it linking to gcc14/lib/libgccjit.so.0 but
otherwise to my gcc-13 toolchain files. Somehow I am not surprised that
this does not work out. I see this in options.mk:


.if !${MACHINE_PLATFORM:MDarwin-*} && !${MACHINE_PLATFORM:MSunOS-*}
PKG_SUGGESTED_OPTIONS+= libgccjit
.endif

###
### Support libgccjit
###
.if !empty(PKG_OPTIONS:Mlibgccjit)
CONFIGURE_ARGS+=        --with-native-compilation
LDFLAGS+=               ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.gcc14-libjit}/gcc14/lib
GENERATE_PLIST+=        cd ${DESTDIR}${PREFIX} && \
        ${FIND} lib/emacs/${PKGVERSION_NOREV}/native-lisp/ \( -type f -o -type l \) -print | ${SORT};
.  include "../../lang/gcc14-libjit/buildlink3.mk"
PLIST.native=           yes
.else
PLIST.nonative=         yes
.endif

Reading a bit on the gcc wiki about this jit thing, I figured out that
apart from the question which version of libgccjit would fit my
toolchain, I need such to successfully run the conftest:

LIBRARY_PATH=/sw/compiler/gcc-13.2.0/lib:/sw/compiler/gcc-13.2.0/lib/gcc/x86_64-pc-linux-gnu/13.2.0:$LIBRARY_PATH ./conftest

I need LIBRARY_PATH set to locate all internal gcc libraries,
including crtbeginS.o. I don't need that for any other ordinary build.
This jit thing is special sauce. The toolchain knows where these files
are (though RPATH is a different matter, hence PASSHRU_RPATHDIRS is
needed).

I see  two issues. Wait, no: three issues.

1. Isn't gccjit something too esoteric to suggest as default for a text
   editor (at least emacs is in that category, not OS or IDE;-)?

2. How can one just assume that gcc14-libjit will match the compiler in
   use? How many platforms have gcc14 in base? The emacs package should
   then depend on a specific gcc from pkgsrc, shouldn't it? Is
   gccXX-libjit independent of the base gcc? We got multiple versions
   of it for a reason, I guess.

3. Does this work for anyone, actually? Using system gcc? Using pkgsrc
   gcc? How?

I'm trying a build with gcc13-libjit instead now. It's the first time I
deal with this at all. It also failed  due to incomplete LIBRARY_PATH
setting. I am not sure who would be responsible to set it. Not sure if
I should include the internal gcc directories in LIBRARY_PATH globally.
I will probably just disable the option for my builds, anyway, but for
pkgsrc hygiene, I'd like to have this discussed. 


Alrighty then,

Thomas

-- 
Dr. Thomas Orgis
HPC @ Universität Hamburg


Home | Main Index | Thread Index | Old Index