Build of this port fails at configure phase as following if (1) ports-mgmt/porttools is installed in build environment and (2) NATIVECOMP option is ON.
checking for getpagesize... (cached) yes
checking for working mmap... (cached) yes
checking for main in -lXbsd... no
checking for pthread library... -lpthread
checking for thread support... yes
checking for getaddrinfo_a in -lanl... no
checking for gnutls >= 2.12.2... yes
checking for jansson >= 2.7... yes
checking for libkqueue... no
checking for library containing kqueue... none required
checking for library containing inflateEnd... -lz
checking for dlopen... (cached) yes
checking for dladdr... yes
checking for dlfunc... yes
usage: dirname string [...]
usage: dirname string [...]
checking for gcc_jit_context_acquire in -lgccjit... no
configure: error: ELisp native compiler was requested, but libgccjit was not found.
Please try installing libgccjit or a similar package.
If you are sure you want Emacs be compiled without ELisp native compiler,
pass the --without-native-compilation option to configure.
===> Script "configure" failed unexpectedly.
Please report the problem to emacs@FreeBSD.org [maintainer] and attach the
including the output of the failure of your make command. Also, it might be
a good idea to provide an overview of all packages installed on your system
(e.g. a /usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1
make: stopped in /usr/ports/editors/emacs-devel
Full build log: https://www.utahime.org/FreeBSD/poudriere/data/logs/bulk/130amd64-default-emacs/2021-08-23_13h20m28s/logs/emacs-devel-nox-126.96.36.19910815,2.log
Note that in order to reproduce the build error with poudriere /usr/ports/editors/emacs-devel/Makefile is modified so ports-mgmt/porttools is added to BUILD_DEPENDS.
Thanks for reporting it. I'm able to reproduce it.
From my preliminary analysis of the problem, excerpt from the config.log:
configure:16368: checking for gcc_jit_context_acquire in -lgccjit
configure:16393: cc -o conftest -pipe -g -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -I -isystem /usr/local/include -L/usr/local/lib/gcc11 -Wl,-rpath=/usr/local/lib -fstack-protector-strong -L/usr/local/lib -L conftest.c -lgccjit -lutil >&5
ld: error: cannot open /usr/local/include: Is a directory
cc: error: linker command failed with exit code 1 (use -v to see invocation)
configure:16393: $? = 1
configure: failed program was:
| /* confdefs.h */
It seems like "-I -isystem" is the culprit here, need to figure out where it's coming from. I'll follow up later with.
Created attachment 227396 [details]
Now I think I know what is happening. ports-mgmt/porttools installs shell script named `port`. But configure script of emacs regards it as utility used to interact with MacPorts. And it sets up CFLAGS, header directories, library directory, etc. assuming that environment is MacOS and GCC is installed by using MacPorts. As a result configure fails to detect libgccjit. Attached patch fixes it by patching configure.ac.
Created attachment 227397 [details]
Updated patch file
* Improve patch so it can be upstreamed.
Original version only comments out the detection of 'port' command in configure.ac. So it doesn't work as is expected on MacOS and MacPorts environment and therefore can't be upstreamed. Updated version changes configure.ac so it tries to detect 'port' command only if $opsys is 'darwin'. So it can be upstreamed as it can not only fix our problem but also works fine on MacOS and MacPorts environment.
(In reply to Yasuhiro Kimura from comment #3)
The attached patch works for me.
We've an update scheduled for September 01, 2021, and we'll include this patch then. Could you please submit it upstream, and link us here ?
(In reply to Ashish SHUKLA from comment #4)
> Could you please submit it upstream, and link us here ?
I have submitted to upstream as following.
Great. Looks like it will get pulled from upstream in the 2021-09-01 port update.
A commit in branch main references this bug:
Author: Joseph Mingrone <jrm@FreeBSD.org>
AuthorDate: 2021-09-01 22:56:57 +0000
Commit: Joseph Mingrone <jrm@FreeBSD.org>
CommitDate: 2021-09-01 22:59:35 +0000
editors/emacs-devel: Update to 2021-09-21 commit, a15f549
editors/emacs-devel/Makefile | 4 ++--
editors/emacs-devel/distinfo | 6 +++---
editors/emacs-devel/pkg-plist | 7 ++++---
3 files changed, 9 insertions(+), 8 deletions(-)
Thanks for submitting and upstreaming. Please re-open if the issue isn't resolved.