Lazarus

Free Pascal => Unix => Topic started by: trev on July 02, 2019, 02:26:48 pm

Title: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: trev on July 02, 2019, 02:26:48 pm
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?
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: marcov on July 02, 2019, 02:39:55 pm
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?
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: trev on July 02, 2019, 02:45:50 pm
I've cleaned, often :)

I have 3.04 FPC installed and working.

root is running the build.

Hmmmm.
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: marcov on July 02, 2019, 02:48:14 pm

If you can't find something obvious, the only thing left is to check ktrace/strace/truss output for clues.
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: trev on July 02, 2019, 03:04:08 pm
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

Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: marcov on July 02, 2019, 03:06:33 pm
All the compat stuff is strange, did you enable ld.bfd ?
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: trev on July 02, 2019, 03:16:41 pm
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.
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: marcov on July 02, 2019, 03:20:28 pm
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.
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: trev on July 02, 2019, 03:49:00 pm
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.
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: trev on July 02, 2019, 04:08:33 pm
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)
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: marcov on July 02, 2019, 04:12:23 pm
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 :-)
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: trev on July 02, 2019, 04:31:12 pm
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.)
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: marcov on July 02, 2019, 04:33:32 pm
Wait a minute, you are not building ON FreeBSD but OS X ?

That'd be uncharted territory.
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: trev on July 03, 2019, 03:44:06 am
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  :'(
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: DonAlfredo on July 03, 2019, 08:20:44 am
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.
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: trev on July 10, 2019, 10:30:24 am
Now that I'm back home, I checked and yes, I can build the cross compiler on macOS, I just cannot build the required FreeBSD units. That is:

Code: [Select]
ls -l usr/local/share/fpc-3.1.1/rtl/units/
drwxr-xr-x  200 root  wheel  6400 10 Jul 16:31 x86_64-darwin <<-- OK
drwxr-xr-x    2 root  wheel    64 10 Jul 16:31 x86_64-freebsd   <<-- EMPTY :(

The problem is:

Code: [Select]
make[5]: x86_64-freebsd-as: No such file or directory

which seems to suggest to me that macOS is looking for a FreeBSD x86_64 (cross?) assembler that does not exist.
Title: Re: FreeBSD: system.pp(37,2) Fatal: Cannot open include file "sysunixh.inc"
Post by: marcov on July 10, 2019, 10:36:01 am
When crosscompiling you need to provide crossbinutils, yes.

Usually, linux and *bsd crossbinutils build fairly easily.
TinyPortal © 2005-2018