Andre,

I've never built gcc for aarch64-freebsd.  I was going to
suggest doing the full bootstrap, but that seems to be too
slow.  On amd64, I use

../gcc/configure --prefix=$WDIR \
   --enable-languages=c,c++,fortran,lto \
   --enable-bootstrap \
   --disable-nls \
   --disable-libssp \
   --disable-multilib \
   --without-libintl

I looked at the FreeBSD ports collection and how it builds
gcc16.  I did not see missing --enable-* or --disable-*.
If you have the ports collection installed in the vm, you
can do 

cd /usr/ports/lang/gcc16-devel
make config |& tee logfile

to see if the port is doing anything to mitigate the issue.
Note, you might need 'make configure'.  This likely a slow
process as it downloads the source code and computes a md5
and then uncompresses.

(more below)

On Mon, Jun 30, 2025 at 03:40:33PM +0200, Andre Vehreschild wrote:
> 
> how to you get a recent gcc compile on aarch64-freebsd-14.3 ? I am seeing
> several issues in core libraries of gcc that are far away from where I touched
> the compiler.
> 
> I am configuring with:
> 
> configure --disable-multilib\
>                        --enable-stage1-languages=c,fortran,c++\
>                        --enable-checking=yes \
>                        --enable-offload-defaulted \
>                        --prefix="${INSTALLPATH}" \
>                        CFLAGS="-g -O0 -DENABLE_ASSERT_CHECKING" CXXFLAGS="-g 
> -O0"\
>                        STAGE1_CFLAGS="-g -O0 -DENABLE_ASSERT_CHECKING" 
> STAGE1_CXXFLAGS="-g -O0"
> 
> Yes, I am doing only stage1. I run this fully virtualized and it is slow. I
> don't want to wait three days for a full bootstrap.
> 
> One of the errors I get is:
> 
> /libgcc/unwind-dw2-fde-dip.c:69:10: error: 'ElfW' redefined [-Werror]
>    69 | # define ElfW __ElfN
>       |          ^~~~
> In file included from /usr/include/machine/elf.h:45,
>                  from /usr/include/elf.h:37,
>                  from <snip>/gcc/gcc.test/libgcc/unwind-dw2-fde-dip.c:36:
> /usr/include/sys/elf_generic.h:59:9: note: this is the location of the 
> previous
> definition 
> 59 | #define ElfW(x)         __ElfN(x)
>      |         ^~~~
> 
> Have you ever seen this before and know a way around it?
> 

I've not seen this error.  elf_generic.h. has the comment

/* Define ElfW for compatibility with Linux, prefer __ElfN() in FreeBSD code */
#define ElfW(x)         __ElfN(x)

perhaps, just deleteing the line will allow you to proceed.

-- 
Steve

Reply via email to