Recent

Author Topic: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"  (Read 678 times)

trev

  • Full Member
  • ***
  • Posts: 194
Argh... trying to compile FPC trunk for FreeBSD, but:

Code: [Select]
gmake clean all OS_TARGET=freebsd CPU_TARGET=x86_64
...

gmake[7]: Leaving directory '/usr/local/share/fpc-3.3.1/rtl/freebsd'
gmake[6]: Leaving directory '/usr/local/share/fpc-3.3.1/rtl'
gmake[5]: Leaving directory '/usr/local/share/fpc-3.3.1/compiler'
gmake rtl
gmake[5]: Entering directory '/usr/local/share/fpc-3.3.1/compiler'
gmake -C /usr/local/share/fpc-3.3.1/rtl 'OPT=   ' all
gmake[6]: Entering directory '/usr/local/share/fpc-3.3.1/rtl'
gmake -C freebsd all
gmake[7]: Entering directory '/usr/local/share/fpc-3.3.1/rtl/freebsd'
as --64 -o /usr/local/share/fpc-3.3.1/rtl/units/x86_64-freebsd/prt0.o x86_64/prt0.as
as --64 -o /usr/local/share/fpc-3.3.1/rtl/units/x86_64-freebsd/cprt0.o x86_64/cprt0.as
as --64 -o /usr/local/share/fpc-3.3.1/rtl/units/x86_64-freebsd/gprt0.o x86_64/gprt0.as
as --64 -o /usr/local/share/fpc-3.3.1/rtl/units/x86_64-freebsd/dllprt0.o x86_64/dllprt0.as
/usr/local/share/fpc-3.3.1/compiler/ppc1 -Ur -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -Fi../unix -Fi../bsd -Fi../bsd/x86_64 -Fi../freebsd/x86_64 -FE. -FU/usr/local/share/fpc-3.3.1/rtl/units/x86_64-freebsd -Cg -dx86_64 -dRELEASE  -Us -Sg ../bsd/system.pp
system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Fatal: Compilation aborted

The file "sysunixh.inc" exists in  /usr/local/share/fpc-3.3.1/rtl/unix/sysunixh.inc. I even tried putting the full path in the {$I...} but it still failed to open it.

Any ideas? Tips? Magic incantations?
« Last Edit: July 02, 2019, 02:32:19 pm by trev »
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7432
Maybe stale .ppu files somewhere? Clean again, and check there are no stale .os or ppus.

Oh, and you need to start with a release compiler 3.0.4

Since you seem to build in a system directory, also be wary of permissions. Can you write there?

trev

  • Full Member
  • ***
  • Posts: 194
I've cleaned, often :)

I have 3.04 FPC installed and working.

root is running the build.

Hmmmm.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7432

If you can't find something obvious, the only thing left is to check ktrace/strace/truss output for clues.

trev

  • Full Member
  • ***
  • Posts: 194
Trussing the failing command from the correct dircetory, nothing jumps out and smacks me in the face:

Code: [Select]
access("../bsd/system.pp",F_OK)                  = 0 (0x0)
open("../bsd/system.pp",O_RDONLY,0666)           = 3 (0x3)
read(3,"{\n    This file is part of the "...,32768) = 9346 (0x2482)
compat11.fstat(3,{ mode=-rw-r--r-- ,inode=1467049,size=9346,blksize=32768 }) = 0 (0x0)
compat6.lseek(0x3,0x0,0x0,0x1)                   = 9346 (0x2482)
compat6.mmap(0x0,0x8000,0x3,0x1002,0xffffffffffffffff,0x0,0x0) = 34370965504 (0x800ab5000)
compat6.mmap(0x0,0x8000,0x3,0x1002,0xffffffffffffffff,0x0,0x0) = 34370998272 (0x800abd000)
open("../bsd/",O_RDONLY,0666)                    = 4 (0x4)
compat11.fstat(4,{ mode=drwxr-xr-x ,inode=2013753,size=512,blksize=32768 }) = 0 (0x0)
compat11.getdents(0x4,0x800a1d550,0x400)         = 396 (0x18c)
compat11.stat("../bsd/:º",0x7fffffffca50)        ERR#2 'No such file or directory'
close(4)                                         = 0 (0x0)
open("./",O_RDONLY,0666)                         = 4 (0x4)
compat11.fstat(4,{ mode=drwxr-xr-x ,inode=1778728,size=1024,blksize=32768 }) = 0 (0x0)
compat11.getdents(0x4,0x800a1d550,0x400)         = 520 (0x208)
compat11.stat("./)$x7fffffffca50)                ERR#2 'No such file or directory'
close(4)                                         = 0 (0x0)
close(3)                                         = 0 (0x0)
system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
write(1,"system.pp(37,2) Fatal: Cannot op"...,63) = 63 (0x3f)
munmap(0x800aa5000,32768)                        = 0 (0x0)
munmap(0x800aad000,32768)                        = 0 (0x0)
Fatal: Compilation aborted
write(1,"Fatal: Compilation aborted\n",27)       = 27 (0x1b)
munmap(0x800a8d000,32768)                        = 0 (0x0)
munmap(0x800a95000,32768)                        = 0 (0x0)
munmap(0x800a85000,32768)                        = 0 (0x0)
munmap(0x800a75000,32768)                        = 0 (0x0)
munmap(0x800a5d000,32768)                        = 0 (0x0)
munmap(0x800a65000,32768)                        = 0 (0x0)
munmap(0x800a6d000,32768)                        = 0 (0x0)
munmap(0x800a05000,262144)                       = 0 (0x0)
munmap(0x800a45000,32768)                        = 0 (0x0)
munmap(0x800a55000,32768)                        = 0 (0x0)
munmap(0x8009fd000,32768)                        = 0 (0x0)
munmap(0x800abd000,32768)                        = 0 (0x0)
munmap(0x800ab5000,32768)                        = 0 (0x0)
munmap(0x800a9d000,32768)                        = 0 (0x0)
munmap(0x8008fd000,1048576)                      = 0 (0x0)
exit(0x1)
process exit, rval = 1

o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7432
All the compat stuff is strange, did you enable ld.bfd ?

trev

  • Full Member
  • ***
  • Posts: 194
No, but I see from the man page for ld that:

Quote
ld.lld is a drop-in replacement for the GNU BFD and gold linkers.   
It accepts most of the same command line arguments and linker   
scripts as GNU linkers.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7432
FPC/Freebsd only support ld.bfd atm. Starting with FreeBSD12, the llvm one is default, but it is a lot more sensitive, and FPC hasn't been validated against it on freebsd yet.

trev

  • Full Member
  • ***
  • Posts: 194
I can compile FPC 3.0.4 successfully from source (the installed binary is for FPC 3.0.4). It just dislikes trunk. I'll retry trunk on FreeBSD 11.3.

Thanks for the help marcov.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

trev

  • Full Member
  • ***
  • Posts: 194
Now I remember why I was using FreeBSD 12.

FPC won't compile at all on FreeBSD 11.2-STABLE.

And the pkg install of fpc-3.0.4 simply core dumps.

Code: [Select]

 $ truss fpc
sigaction(SIGFPE,{ 0x42a270 SA_SIGINFO ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0)
sigaction(SIGSEGV,{ 0x42a270 SA_SIGINFO ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0)
sigaction(SIGBUS,{ 0x42a270 SA_SIGINFO ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0)
sigaction(SIGILL,{ 0x42a270 SA_SIGINFO ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0)
ioctl(1,TIOCGETA,0x7fffffffe6a4)                 = 0 (0x0)
ioctl(2,TIOCGETA,0x7fffffffe6a4)                 = 0 (0x0)
ioctl(1,TIOCGETA,0x7fffffffe6a4)                 = 0 (0x0)
ioctl(2,TIOCGETA,0x7fffffffe6a4)                 = 0 (0x0)
compat6.mmap()                                   ERR#78 'Function not implemented'
SIGNAL 12 (SIGSYS) code=SI_KERNEL
process killed, signal = 12 (core dumped)
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7432
I usually use the .tar's with shellscript installer from the FPC site. (that's because I compiled them myself: -)

Anyway, I haven't spent much attention to the LLVM migration yet, since I lost my primary use for FreeBSD :-)

trev

  • Full Member
  • ***
  • Posts: 194
As a last ditch effort I tried creating a FreeBSD cross compiler on macOS 10.14.5 ... that bombed out with:

Code: [Select]
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C freebsd all
/bin/mkdir -p /usr/local/share/fpc-3.1.1/rtl/units/x86_64-freebsd
x86_64-freebsd-as --64 -o /usr/local/share/fpc-3.1.1/rtl/units/x86_64-freebsd/prt0.o x86_64/prt0.as
make[5]: x86_64-freebsd-as: No such file or directory
make[5]: *** [prt0.o] Error 1
make[4]: *** [freebsd_all] Error 2
make[3]: *** [rtl] Error 2
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.x86_64-freebsd] Error 2

I give up.

(I successfully built Win32 and Win654 cross compilers on macOS a few days ago.)
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7432
Wait a minute, you are not building ON FreeBSD but OS X ?

That'd be uncharted territory.

trev

  • Full Member
  • ***
  • Posts: 194
I tried building FPC 3.0.4 on native FreeBSD 12.0-RELEASE - this works.

I tried building FPC trunk on native FreeBSD 12.0-RELEASE - this fails (suggested as needed to get https working on FreeBSD with a current openssl. see https://forum.lazarus.freepascal.org/index.php/topic,45962.0.html).

I tried building FPC 3.0.4 and trunk on native FreeBSD 11.2-STABLE - this fails in both cases.

I then tried building a FreeBSD cross compiler with FPC 3.0.4 and trunk on macOS 10.14.5 - this fails in both cases. No problem with the native macOS builds or the Windows 32 and 64 bit cross builds.

So, no, I was building natively on FreeBSD. Trying to build a FreeBSD cross compiler on macOS was the final hope of a drowning programmer  :'(
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1122
Quote
Trying to build a FreeBSD cross compiler on macOS was the final hope of a drowning programmer

In that case, you could give fpcupdeluxe a try !
I just tried with trunk, and could successfully build a cross-compiler for FreeBSD.