Bug 217582 - lang/fpc build error on 12-CURRENT
Summary: lang/fpc build error on 12-CURRENT
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Jose Alonso Cardenas Marquez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-06 11:26 UTC by Alastair Hogge
Modified: 2019-08-15 18:35 UTC (History)
3 users (show)

See Also:


Attachments
Fix FPC build when LLD is the system linker. (1.23 KB, patch)
2018-02-02 15:25 UTC, Dan McGregor
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alastair Hogge 2017-03-06 11:26:29 UTC
Hi,

On a 12-CURRENT -r314700 host & jail, lang/fpc fails to build:

====>> Building lang/fpc
build started at Mon Mar  6 19:13:37 AWST 2017
port directory: /usr/ports/lang/fpc
building for: FreeBSD direwolf.local. 12.0-CURRENT FreeBSD 12.0-CURRENT amd64
maintained by: freebsd-fpc@FreeBSD.org
Makefile ident:      $FreeBSD: head/lang/fpc/Makefile 434894 2017-02-26 17:38:04Z acm $
Poudriere version: 3.2-pre
Host OSVERSION: 1200023
Jail OSVERSION: 1200023
Job Id: 01

---Begin Environment---
SHELL=/bin/csh
OSVERSION=1200023
UNAME_v=FreeBSD 12.0-CURRENT
UNAME_r=12.0-CURRENT
BLOCKSIZE=K
MAIL=/var/mail/root
STATUS=1
SAVED_TERM=screen-256color
MASTERMNT=/usr/local/poudriere/data/.m/generic-head-generic/ref
UID=0
FORCE_PACKAGE=yes
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
POUDRIERE_BUILD_TYPE=bulk
PKGNAME=fpc-3.0.2
OLDPWD=/
PWD=/usr/local/poudriere/data/.m/generic-head-generic/ref/.p/pool
MASTERNAME=generic-head-generic
SCRIPTPREFIX=/usr/local/share/poudriere
USER=root
HOME=/root
POUDRIERE_VERSION=3.2-pre
SCRIPTPATH=/usr/local/share/poudriere/bulk.sh
GID=0
LIBEXECPREFIX=/usr/local/libexec/poudriere
LOCALBASE=/usr/local
PACKAGE_BUILDING=yes
---End Environment---

---Begin OPTIONS List---
---End OPTIONS List---

--CONFIGURE_ARGS--

--End CONFIGURE_ARGS--

--CONFIGURE_ENV--
MAKE=gmake XDG_DATA_HOME=/wrkdirs/usr/ports/lang/fpc/work  XDG_CONFIG_HOME=/wrkdirs/usr/ports/lang/fpc/work  HOME=/wrkdirs/usr/ports/lang/fpc/work TMPDIR="/tmp" SHELL=/bin/sh CONFIG_SHELL=/bin/sh
--End CONFIGURE_ENV--

--MAKE_ENV--
XDG_DATA_HOME=/wrkdirs/usr/ports/lang/fpc/work  XDG_CONFIG_HOME=/wrkdirs/usr/ports/lang/fpc/work  HOME=/wrkdirs/usr/ports/lang/fpc/work TMPDIR="/tmp" NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  LIBDIR="/usr/lib"  CC="cc" CFLAGS="-O2 -pipe  -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing"  CPP="cpp" CPPFLAGS="-DLIBICONV_PLUG"  LDFLAGS=" -fstack-protector" LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing  -DLIBICONV_PLUG"  MANPREFIX="/usr/local" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 444"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444"
--End MAKE_ENV--

--PLIST_SUB--
FPC_I386="@comment
"
FPC_AMD64=""
FREEBSD=""
PORTVERSION=3.0.2
BUILDNAME=x86_64-freebsd
OSREL=12.0
PREFIX=%D
LOCALBASE=/usr/local
RESETPREFIX=/usr/local
PORTDOCS=""
PORTEXAMPLES=""
LIB32DIR=lib
DOCSDIR="share/doc/fpc"
EXAMPLESDIR="share/examples/fpc"
DATADIR="share/fpc"
WWWDIR="www/fpc"
ETCDIR="etc/fpc"
--End PLIST_SUB--

--SUB_LIST--
PREFIX=/usr/local
LOCALBASE=/usr/local
DATADIR=/usr/local/share/fpc
DOCSDIR=/usr/local/share/doc/fpc
EXAMPLESDIR=/usr/local/share/examples/fpc
WWWDIR=/usr/local/www/fpc
ETCDIR=/usr/local/etc/fpc
--End SUB_LIST--

---Begin make.conf---
USE_PACKAGE_DEPENDS=yes
BATCH=yes
WRKDIRPREFIX=/wrkdirs
PORTSDIR=/usr/ports
PACKAGES=/packages
DISTDIR=/distfiles
#### /usr/ports/Mk/Scripts/ports_env.sh ####
ARCH=amd64
CONFIGURE_MAX_CMD_LEN=262144
HAVE_COMPAT_IA32_KERN=YES
OPSYS=FreeBSD
OSREL=12.0
OSVERSION=1200023
PYTHONBASE=/usr/local
_JAVA_OS_LIST_REGEXP=native\|linux
_JAVA_VENDOR_LIST_REGEXP=openjdk\|oracle\|sun
_JAVA_VERSION_LIST_REGEXP=1.6\|1.7\|1.8\|1.6+\|1.7+\|1.8+
_OSRELEASE=12.0-CURRENT
_SMP_CPUS=8
#### Misc Poudriere ####
---End make.conf---
--Resource limits--
cpu time               (seconds, -t)  unlimited
file size           (512-blocks, -f)  unlimited
data seg size           (kbytes, -d)  33554432
stack size              (kbytes, -s)  524288
core file size      (512-blocks, -c)  unlimited
max memory size         (kbytes, -m)  unlimited
locked memory           (kbytes, -l)  unlimited
max user processes              (-u)  34304
open files                      (-n)  1024
virtual mem size        (kbytes, -v)  unlimited
swap limit              (kbytes, -w)  unlimited
socket buffer size       (bytes, -b)  unlimited
pseudo-terminals                (-p)  unlimited
kqueues                         (-k)  unlimited
umtx shared locks               (-o)  unlimited
--End resource limits--
=======================<phase: check-sanity   >============================
===========================================================================
=======================<phase: pkg-depends    >============================
===>   fpc-3.0.2 depends on file: /usr/local/sbin/pkg - not found
===>   Installing existing package /packages/All/pkg-1.10.0_2.txz
[direwolf.local.] Installing pkg-1.10.0_2...
[direwolf.local.] Extracting pkg-1.10.0_2: .......... done
===>   fpc-3.0.2 depends on file: /usr/local/sbin/pkg - found
===>   Returning to build of fpc-3.0.2
===========================================================================
=======================<phase: fetch-depends  >============================
===========================================================================
=======================<phase: fetch          >============================
===> Fetching all distfiles required by fpc-3.0.2 for building
===========================================================================
=======================<phase: checksum       >============================
===> Fetching all distfiles required by fpc-3.0.2 for building
=> SHA256 Checksum OK for freepascal/fpc-3.0.2.source.tar.gz.
=> SHA256 Checksum OK for freepascal/ppcx64-3.0.2-freebsd.tar.gz.
=> SHA256 Checksum OK for freepascal/fpc-3.0.2.man.tar.gz.
===========================================================================
=======================<phase: extract-depends>============================
===========================================================================
=======================<phase: extract        >============================
===> Fetching all distfiles required by fpc-3.0.2 for building
===>  Extracting for fpc-3.0.2
=> SHA256 Checksum OK for freepascal/fpc-3.0.2.source.tar.gz.
=> SHA256 Checksum OK for freepascal/ppcx64-3.0.2-freebsd.tar.gz.
=> SHA256 Checksum OK for freepascal/fpc-3.0.2.man.tar.gz.
===========================================================================
=======================<phase: patch-depends  >============================
===========================================================================
=======================<phase: patch          >============================
===>  Patching for fpc-3.0.2
===>  Applying FreeBSD patches for fpc-3.0.2
===========================================================================
=======================<phase: build-depends  >============================
===>   fpc-3.0.2 depends on executable: gmake - not found
===>   Installing existing package /packages/All/gmake-4.2.1_1.txz
[direwolf.local.] Installing gmake-4.2.1_1...
[direwolf.local.] `-- Installing gettext-runtime-0.19.8.1_1...
[direwolf.local.] |   `-- Installing indexinfo-0.2.6...
[direwolf.local.] |   `-- Extracting indexinfo-0.2.6: .... done
[direwolf.local.] `-- Extracting gettext-runtime-0.19.8.1_1: .......... done
[direwolf.local.] Extracting gmake-4.2.1_1: .......... done
===>   fpc-3.0.2 depends on executable: gmake - found
===>   Returning to build of fpc-3.0.2
===========================================================================
=======================<phase: lib-depends    >============================
===========================================================================
=======================<phase: configure      >============================
===>  Configuring for fpc-3.0.2
===========================================================================
=======================<phase: build          >============================
===>  Building for fpc-3.0.2
##### STARTING COMPILER #####
(cd /wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler && /usr/bin/env XDG_DATA_HOME=/wrkdirs/usr/ports/lang/fpc/work  XDG_CONFIG_HOME=/wrkdirs/usr/ports/lang/fpc/work  HOME=/wrkdirs/usr/ports/lang/fpc/work TMPDIR="/tmp" NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  LIBDIR="/usr/lib"  CC="cc" CFLAGS="-O2 -pipe  -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing"  CPP="cpp" CPPFLAGS="-DLIBICONV_PLUG"  LDFLAGS=" -fstack-protector" LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing  -DLIBICONV_PLUG"  MANPREFIX="/usr/local" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 444"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444"  LDVER=ld.bfd gmake cycle FPCMAKE=/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/utils/fpcm/bin/x86_64-freebsd/fpcmake  FPCTARGET=x86_64-freebsd  ARCH=x86_64  OPT=""  BSDHIER=1  INSTALL="install  -m 0644"  INSTALLEXE="install  -s -m 555"  INSTALLSCR="install  -m 555"  INSTALL_PREFIX=/wrkdirs/usr/ports/lang/fpc/work/stage/usr/local DESTDIR=/wrkdirs/usr/ports/lang/fpc/work/stage PP=/wrkdirs/usr/ports/lang/fpc/work/ppcx64-3.0.2-freebsd)
gmake[1]: Entering directory '/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler'
gmake tempclean ppc3.exe
gmake[2]: Entering directory '/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler'
/bin/rm -f ppcross ppc ppc1.exe ppc2.exe ppc3.exe ./msg2inc.exe pp1.wpo pp2.wpo
gmake 'OLDFPC=' next CYCLELEVEL=1
gmake[3]: Entering directory '/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler'
gmake rtlclean rtl
gmake[4]: Entering directory '/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler'
gmake -C  clean
gmake[5]: Entering directory '/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler'
gmake[5]: *** clean: No such file or directory.  Stop.
gmake[5]: Leaving directory '/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler'
gmake[4]: *** [Makefile:4078: rtlclean] Error 2
gmake[4]: Leaving directory '/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler'
gmake[3]: *** [Makefile:3967: next] Error 2
gmake[3]: Leaving directory '/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler'
gmake[2]: *** [Makefile:3972: ppc1.exe] Error 2
gmake[2]: Leaving directory '/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler'
gmake[1]: *** [Makefile:3984: cycle] Error 2
gmake[1]: Leaving directory '/wrkdirs/usr/ports/lang/fpc/work/fpc-3.0.2/compiler'
*** Error code 2

Stop.
make: stopped in /usr/ports/lang/fpc
====>> Cleaning up wrkdir
===>  Cleaning for fpc-3.0.2
build of lang/fpc ended at Mon Mar  6 19:13:40 AWST 2017
build time: 00:00:03
!!! build failure encountered !!!
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2017-03-06 11:26:29 UTC
Maintainer informed via mail
Comment 2 Alastair Hogge 2017-03-06 13:01:39 UTC
In the host's log:
pid 18686 (ppcx64-3.0.2-freebs), uid 65534: exited on signal 12 (core dumped)
pid 18690 (ppcx64-3.0.2-freebs), uid 65534: exited on signal 12 (core dumped)
pid 18695 (ppcx64-3.0.2-freebs), uid 65534: exited on signal 12 (core dumped)
pid 18699 (ppcx64-3.0.2-freebs), uid 65534: exited on signal 12 (core dumped)
Comment 3 Dan McGregor 2018-02-02 15:25:18 UTC
Created attachment 190268 [details]
Fix FPC build when LLD is the system linker.

This also affects 11-STABLE when using lld as the system linker, and FPC 3.0.4 that was just committed. I fixed the build issue, but it still looks for "ld" rather than "ld.bfd" or the result of getenv("LD").
Comment 4 Ed Maste freebsd_committer freebsd_triage 2018-02-17 03:16:20 UTC
The bug that prevented fpc from building with lld as the linker should now be fixed upstream, https://bugs.freepascal.org/view.php?id=32900

I tried to test by building upstream src but also encountered a segfault:

gmake[3]: Leaving directory '/usr/home/emaste/src/freepascal/packages/fpmkunit'
./fpmake clean --localunitdir=.. --os=freebsd --cpu=x86_64 -o -Ur -o -Xs -o -O2 -o -n -o -Cg -o -dx86_64 -o -dRELEASE --compiler=/usr/home/emaste/src/freepascal/compiler/ppcx64 -bu
gmake[2]: *** [Makefile:1723: clean] Segmentation fault (core dumped)
gmake[2]: Leaving directory '/usr/home/emaste/src/freepascal/packages'
Comment 5 Walter Schwarzenfeld 2019-08-14 23:06:30 UTC
We have version 3.0.4. Most of the patch changes are in the Makefile.

Is there still any problem or could we close here?
Comment 6 Alastair Hogge 2019-08-15 13:41:56 UTC
Hi,

I have only recently started using FreeBSD again, unfortunately Ed's patch did not work as of earlier this month on -CURRENT. 

I did come across a solution to the problem in: https://wiki.freepascal.org/FreeBSD. The solution is add options COMPAT[4-10] in the kernel config.

If I can find some time, I will make the changes to my kernel and attempt the build again, however, I am no longer interested in lang/fpc or editors/lazarus-qt5, sorry. I do appreciate the time and effort people have made in investigating this bug, thanks.
Comment 7 Jose Alonso Cardenas Marquez freebsd_committer freebsd_triage 2019-08-15 18:35:08 UTC
I have committed new changes to lang/fpc and editors/lazarus. Please, see it at

https://svnweb.freebsd.org/ports?view=revision&revision=509004
https://svnweb.freebsd.org/ports?view=revision&revision=509005
https://svnweb.freebsd.org/ports?view=revision&revision=509007

It doesn't work with lld and maybe will not work on short time. We must be use binutils from base or from ports and change LDPATH into fpc/Makefile to ld.bfd path. Also I regenerate fpc bootstrap. It should be work only with COMPAT_FREEBSD11 added to kernel config on 12.X (COMPAT from 4 to 10 should not be necessary)