Recent

Author Topic: [SOLVED] Missing downloads for FPC 3.2.0 for i386  (Read 2045 times)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 757
Re: Missing downloads for FPC 3.2.0 for i386
« Reply #15 on: July 15, 2020, 08:17:49 pm »
Code: Text  [Select][+][-]
  1. make clean all FPC="/usr/local/lib/fpc/3.0.4/ppc386 -FD=/Users/trev/bin/clang/bin/" OS_TARGET=darwin CPU_TARGET=i386 CPU_SOURCE=i386 OPT="/Users/trev/bin/clang/bin/"

clang and as are also linked from /usr/local/bin/ to /Users/trev/bin/clang/bin/.

That is wrong (don't pass options in FPC, fpc never uses "=" in parameters and OPT is a parameter list for fpc, so no parameters without prefix). You need to call it like this:

Code: Text  [Select][+][-]
  1. make clean all FPC="/usr/local/lib/fpc/3.0.4/ppc386" CROSSBINDIR="/Users/trev/bin/clang/bin/" OS_TARGET=darwin CPU_TARGET=i386 CPU_SOURCE=i386

And if you have additional parameters for the compiler (aside from a potential BINUTILSPREFIX) you need to provide them in OPT as if you'd pass them onto the compiler (e.g. OPT="-O2 -glw").

Edit: clarified the incorrect use.
It should even not be necessary to use -FD. Did Xcode 3.1.4 already include clang? If not, pass -Aas-darwin to OPT to tell the compiler to use "as" instead. Xcode 3.1.4 by default installs the command line tools (in /usr/bin).

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 941
  • Former Delphi 1-7, 10.2 User
Re: Missing downloads for FPC 3.2.0 for i386
« Reply #16 on: July 16, 2020, 05:48:29 am »
> Did Xcode 3.1.4 already include clang?

No. I installed llvm+clang-2.6-i386-darwin9.tar.gz from llvm.org.

Using the default /usr/bin/as (Apple Inc version cctools-698.1~1, GNU assembler version 1.38) OR the llvm-v2.6 llvm-as symlinked to /usr/local/bin/as (with /usr/local/bin occurring in the path before /usr/bin) and:

Code: [Select]
make clean all FPC="/usr/local/lib/fpc/3.0.4/ppc386" CROSSBINDIR="/Users/trev/bin/clang/bin/" OS_TARGET=darwin CPU_TARGET=i386 CPU_SOURCE=i386
results in:

Code: [Select]
/bin/mkdir -p i386/units/i386-darwin
/usr/local/share/fpcsrc/fpc-3.2.0/compiler/ppc1 -Ur -Xs -O2 -n -Fui386 -Fusystems -Fu/usr/local/share/fpcsrc/fpc-3.2.0/rtl/units/i386-darwin -Fii386 -FD/Users/trev/bin/clang/bin/ -FE. -FUi386/units/i386-darwin -dRELEASE -Aas-darwin    -di386 -dGDB -dBROWSERLOG -Fux86 -Sew pp.pas
ld: could not find entry point "start" (perhaps missing crt1.o)
An error occurred while linking
pp.pas(266,1) Error: Error while linking
pp.pas(266,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[5]: *** [ppc386] Error 1
make[4]: *** [next] Error 2
make[3]: *** [ppc2] Error 2
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.i386-darwin] Error 2

crt1.o exists in:

Code: [Select]
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/crt1.o
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/crt1.o
/usr/lib/crt1.o
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 757
Re: Missing downloads for FPC 3.2.0 for i386
« Reply #17 on: July 16, 2020, 11:24:36 am »
You have to add -WM10.5 (or -WM10.4) to OPT because of https://wiki.freepascal.org/User_Changes_3.2.0#Default_Target_macOS_version

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 941
  • Former Delphi 1-7, 10.2 User
Re: Missing downloads for FPC 3.2.0 for i386
« Reply #18 on: July 16, 2020, 01:11:28 pm »
That certainly progressed the build much further until:

Code: [Select]
[ 95%] Compiled package utils-unicode
Start compiling package utils-pas2js for target i386-darwin.
       Compiling pas2js/BuildUnit_utils_pas2js.pp
       Compiling pas2js/dirwatch.pp
       Compiling pas2js/httpcompiler.pp
       Compiling pas2js/pas2js.pp
       Linking pas2js/bin/i386-darwin/pas2js
       Compiling pas2js/pas2jslib.pp
       Linking pas2js/bin/i386-darwin/libpas2jslib.dylib
The installer encountered the following error:
External command "/usr/local/share/fpcsrc/fpc-3.2.0/compiler/ppc386 -Tdarwin -FEpas2js/bin/i386-darwin -FUpas2js/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/rtl/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-json/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-base/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/univint/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-res/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/rtl-objpas/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-js/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-passrc/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/pastojs/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/paszlib/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/hash/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-process/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-web/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-db/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-xml/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/iconvenc/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/rtl-extra/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/ibase/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/mysql/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/odbc/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/oracle/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/postgres/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/sqlite/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-net/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fcl-fpcunit/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/libtar/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/openssl/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/fastcgi/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/httpd22/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/httpd24/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/libmicrohttpd/units/i386-darwin/ -Fu/usr/local/share/fpcsrc/fpc-3.2.0/packages/webidl/units/i386-darwin/ -Ur -Xs -O2 -n -FD/Users/trev/bin/clang/bin/ -WM10.5 -di386 -dRELEASE -viq pas2js/pas2jslib.pp" failed with exit code 256. Console output:
Target OS: Darwin for i386
Compiling pas2js/pas2jslib.pp
Assembling pas2jslib
clang: warning: argument unused during compilation: '-mmacosx-version-min=10.5'
Linking pas2js/bin/i386-darwin/libpas2jslib.dylib
Error: Error while linking
Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
/usr/bin/strip: bad n_sect for symbol table entry 9754 in: /usr/local/share/fpcsrc/fpc-3.2.0/utils/pas2js/bin/i386-darwin/libpas2jslib.dylib

make[2]: *** [all] Error 1
make[1]: *** [utils_all] Error 2
make: *** [build-stamp.i386-darwin] Error 2
« Last Edit: July 16, 2020, 01:13:52 pm by trev »
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 757
Re: Missing downloads for FPC 3.2.0 for i386
« Reply #19 on: July 16, 2020, 07:32:11 pm »
That looks like a bug in the clang version you are using. I would really recommend to use "as" instead.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 941
  • Former Delphi 1-7, 10.2 User
Re: Missing downloads for FPC 3.2.0 for i386
« Reply #20 on: July 17, 2020, 02:40:06 am »
I removed llvm-as altogether so that the Xcode-supplied "as" was used, but I have the identical error result.
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 757
Re: Missing downloads for FPC 3.2.0 for i386
« Reply #21 on: July 17, 2020, 06:01:42 pm »
The compiler uses clang, not llvm-as (which can only read LLVM IR and translate it into LLVM bitcode). You have to explicitly use the -Aas-darwin parameter to make the compiler use "as".

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 941
  • Former Delphi 1-7, 10.2 User
Re: Missing downloads for FPC 3.2.0 for i386
« Reply #22 on: July 18, 2020, 03:47:22 am »
Using:

Code: [Select]
make clean all FPC="/usr/local/lib/fpc/3.0.4/ppc386" CROSSBINDIR="/Users/trev/bin/clang/bin/" OS_TARGET=darwin CPU_TARGET=i386 CPU_SOURCE=i386 OPT="-WM10.5 -Aas-darwin"
unfortunately results in the identical error. llvm-as not linked to /usr/local/bin/as. "which as" shows /usr/bin/as.
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 757
Re: Missing downloads for FPC 3.2.0 for i386
« Reply #23 on: July 18, 2020, 02:03:30 pm »
That looks then like a bug in strip (not being able to handle dynamic libraries correctly). You can add -Xs- to OPT to disable stripping.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 941
  • Former Delphi 1-7, 10.2 User
Re: Missing downloads for FPC 3.2.0 for i386
« Reply #24 on: July 19, 2020, 02:19:01 am »
Success! Thanks Jonas.

I'd completely overlooked the fact that adding a minus after a setting like -Xs would disable it when looking for a way to disable strip.
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 757
Re: [SOLVED] Missing downloads for FPC 3.2.0 for i386
« Reply #25 on: July 19, 2020, 10:36:47 am »
I noticed that on the wiki you recommend people to download clang and use that under Mac OS X 10.5. Please don't do that. clang barely existed at the time and was nowhere near as mature as the assembler "as" that came with Xcode, and it was never even tested at the time. It's also much slower than "as". Or perhaps back then clang even still called "as" to perform the actual assembling, as I'm not sure it even already had an internal assembler.

We can tell people to just use -Aas-darwin, optionally by creating a configuration file in their home directory called ".fpc.cfg" that contains e.g.
Code: [Select]
#include /etc/fpc.cfg
-WM10.5
-Aas-darwin

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 941
  • Former Delphi 1-7, 10.2 User
Re: [SOLVED] Missing downloads for FPC 3.2.0 for i386
« Reply #26 on: July 19, 2020, 02:18:30 pm »
Fixed. Thanks!
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 757
Re: [SOLVED] Missing downloads for FPC 3.2.0 for i386
« Reply #27 on: July 19, 2020, 02:24:46 pm »
Thanks!

 

TinyPortal © 2005-2018