Wattsi doesn't build anymore
zcorpan opened this issue · 4 comments
$ ./build.sh
Writing /Users/zcorpan/git/whatwg/wattsi/src/version.inc
compile: mode=RELEASE main=wattsi testcmd=bin/wattsi defines=-dUSEROPES -dLINES -dPARSEERROR
compile: COMPILING - RELEASE MODE
Compiling Release Version
Target OS: Darwin for x86_64
Compiling wattsi.pas
Compiling ./lib/fileutils.pas
Compiling ./lib/exceptions.pas
Assembling (pipe) ../bin/exceptions.s
Assembling (pipe) ../bin/fileutils.s
Compiling ./lib/stringutils.pas
Compiling ./lib/unicode.pas
Assembling (pipe) ../bin/unicode.s
Compiling ./lib/utf8.pas
Assembling (pipe) ../bin/utf8.s
Compiling ./lib/genericutils.pas
Assembling (pipe) ../bin/genericutils.s
Assembling (pipe) ../bin/stringutils.s
Compiling ./lib/hashfunctions.pas
Assembling (pipe) ../bin/hashfunctions.s
Compiling ./lib/hashtable.pas
Assembling (pipe) ../bin/hashtable.s
Compiling ./lib/hashset.pas
Assembling (pipe) ../bin/hashset.s
Compiling ./lib/plasticarrays.pas
Assembling (pipe) ../bin/plasticarrays.s
Compiling ./lib/ropes.pas
Assembling (pipe) ../bin/ropes.s
Compiling ./lib/wires.pas
Assembling (pipe) ../bin/wires.s
Compiling ./lib/canonicalstrings.pas
Assembling (pipe) ../bin/canonicalstrings.s
Compiling ./html/dom.pas
Assembling (pipe) ../bin/dom.s
Compiling ./html/webdom.pas
Compiling ./html/specutils.pas
Assembling (pipe) ../bin/specutils.s
Compiling ./lib/rtlutils.pas
Assembling (pipe) ../bin/rtlutils.s
Assembling (pipe) ../bin/webdom.s
Compiling ./html/htmlparser.pas
Compiling ./html/entities.pas
Assembling (pipe) ../bin/entities.s
Assembling (pipe) ../bin/htmlparser.s
Compiling ./lib/json.pas
Assembling (pipe) ../bin/json.s
Assembling (pipe) ../bin/wattsi.s
Linking ../bin/wattsi
ld: file not found: /usr/lib/crt1.10.5.o
An error occurred while linking
wattsi.pas(3017) Error: Error while linking
wattsi.pas(3017) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/local/bin/ppcx64 returned an error exitcode
You need the following packages:
fp-compiler fp-units-fcl fp-units-net libc6-dev
We should update the readme.
Do you have the homebrew fpc package installed? Or did you install the fpc binary from the upstream installer? (I mean from Sourceforge or one of the fpc mirrors.) Or did you build fpc from the sources?
Pretty sure some changes that happened in MacOS Mojave (10.14) are what caused this — specifically, some changes that break versions of fpc built for older MacOS versions because they look for the crt1.10.5.o
file in an old place instead of the new place where it now lives in Mojave, which is here:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/crt1.10.5.o
So to fix it, make sure you have the latest XCode & XCode command-line tools installed — and if you’re using homebrew, ensure you have the latest homebrew fpc package installed: 3.0.4_1 (=“revision 1”).
And if you’re not using the homebrew package but instead installed from the upstream (Sourceforge) distribution, then make sure you get the very latest upstream fpc version from there — 3.0.4a or later:
Both that fpc 3.0.4a upstream version and 3.0.4_1 homebrew version were released only a month ago, and include what’s necessary for getting fpc to look for the crt1.10.5.o
file in the right place.
More details
To install the latest XCode command-line tools:
xcode-select --install
Here’s my XCode version info:
$ /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version
Xcode 10.1
Build version 10B61
…and here’s my XCode command-line-tools version info:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 10.1.0.0.1.1539992718
volume: /
location: /
install-time: 1540951554
groups: com.apple.FindSystemFiles.pkg-group
And here’s my fpc version info:
$ fpc -h | grep "Compiler version"
Free Pascal Compiler version 3.0.4 [2018/10/02] for x86_64
That’s for the fpc installed from homebrew:
$ brew info fpc
fpc: stable 3.0.4 (bottled)
Free Pascal: multi-architecture Pascal compiler
https://www.freepascal.org/
/usr/local/Cellar/fpc/3.0.4_1 (3,309 files, 190.1MB) *
Poured from bottle on 2018-10-14 at 19:18:37
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/fpc.rb
With those versions of everything, I can build wattsi successfully — even from a fresh clone:
git clone git@github.com:whatwg/wattsi.git && cd wattsi && ./build.sh
If you didn’t install fpc from homebrew but instead installed an upstream fpc release, then one thing you might want to try setting is the equivalent of what the homebrew fpc install script does here:
# Help fpc find the startup files (crt1.o and friends) with 10.14 SDK
args = (MacOS.version >= :mojave) ? ['OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"'] : []
But if you installed fpc from the latest 3.0.4a or later release https://sourceforge.net/projects/freepascal/files/Mac%20OS%20X/3.0.4/fpc-3.0.4a.intel-macosx.dmg/download then it should already be doing the equivalent of that change — which apparently is that, to the /etc/fpc.cfg
file, it adds this:
-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
See the related discussion at http://forum.lazarus-ide.org/index.php?topic=42657.0
One other thing I’m doing in my environment is this:
export MACOSX_DEPLOYMENT_TARGET=10.14
But the build succeeds for me even if I don’t do that. Setting that to 10.9
or any higher version number just eliminates some annoying spurious warnings.
You need the following packages:
fp-compiler fp-units-fcl fp-units-net libc6-dev
I think those are needed only on Debian and Ubuntu or any other Debian-derived distros (because the Debian package maintainers split the upstream fpc distribution into multiple packages).
We should update the readme.
Agreed — see #93