Subject: bug#40462: 28.0.50; Building nativecomp branch segfaulting on FreeBSD

From: Ashish SHUKLA <[email-masked]>
Date: Sat, 2 May 2020 13:24:49 +0530

On 5/2/20 3:33 AM, Andrea Corallo wrote:
> Hi Ashish,
> 
> Okay I've got a VM with FreeBSD 12.1-RELEASE.
> 
> I had to install gmake and a bunch of other GNU utilies and libraries to
> compile GCC.
> 
> I've compiled and installed the current GCC trunk configuring as:
> 
> ../configure --enable-host-shared --enable-languages=jit \
> --disable-bootstrap --enable-checking=release
> gmake -j2
> sudo gmake install

I updated lang/gcc9 port to include changes required to enable gccjit,
so instead of GCC trunk, I ended up using GCC 9.3.0

> 
> Note: to have libgccjit working I had to do the following trick:
> 
> # rm /usr/bin/ld
> # ln -s /usr/local/bin/ld.bfd /usr/bin/ld

The port takes care of using ld from binutils.

> 
> Otherwise the GCC driver was using lld and this was trying to link the
> .eln against the C standard library (!?) failing.
> 
> Did you had the same problem?  
> 
> I then compiled Emacs on 02e3ffad6d as follow:
> 
> ./autogen.sh
> ./configure --without-x --with-gnutls=ifavailable --with-nativecomp \
> --without-makeinfo
> time gmake NATIVE_FAST_BOOT=1 V=1 -j2

my configure flags were same as mentioned previously, and gmake switches
are:

   gmake BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 0)"'

I guess I can try with NATIVE_FAST_BOOT=1 V=1. I will report back.

> 
> It took ~40min and went clean.  Now I did a quick test and everything
> looks normal.  My LD_LIBRARY_PATH and LIBRARY_PATH are empty and I think
> I had to run only 'ldconfig -R' to have libgccjit visible.
> 
> I'm starting a full build for the night but I do not see why it should
> fail at this point.
> 
> Why can't I reproduce the error?  Do you see any important difference
> between our recepies?

I used the FreeBSD ports to install everything. Whereas you used GCC
from trunk unlike me, and used these GNU make arguments, which I wasn't.

Anyways, I'll report back with my results.

Thanks!
-- 
Ashish SHUKLA