When building this derivation on aarch64-darwin
{ lib, stdenv, fetchFromGitHub, postgresql, buildPgrxExtension_0_11_3, cargo }:
buildPgrxExtension_0_11_3 rec {
pname = "pg_jsonschema";
version = "0.3.1";
inherit postgresql;
src = fetchFromGitHub {
owner = "supabase";
repo = pname;
rev = "v${version}";
hash = "sha256-YdKpOEiDIz60xE7C+EzpYjBcH0HabnDbtZl23CYls6g=";
};
nativeBuildInputs = [ cargo ];
CARGO="${cargo}/bin/cargo";
cargoHash = "sha256-VcS+efMDppofuFW2zNrhhsbC28By3lYekDFquHPta2g=";
[...]
}
ā¦I am seeing this error
error: builder for '/nix/store/f2l1mmmdwlfmgi573hxp1f6qx7zihv98-pg_jsonschema-0.3.1.drv' failed with exit code 1;
last 25 log lines:
> _json_matches_schema_wrapper in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> _jsonb_matches_schema_wrapper in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> _jsonschema_is_valid_wrapper in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> _jsonschema_validation_errors_wrapper in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> pgrx_pg_sys::submodules::panic::do_ereport::hfe61f19947abbacd in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> "_errhint", referenced from:
> pgrx_pg_sys::submodules::panic::do_ereport::hfe61f19947abbacd in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> "_makeArrayResult", referenced from:
> pgrx_pg_sys::submodules::panic::run_guarded::h21cb3d48f146972e in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> "_CurrentMemoryContext", referenced from:
> pgrx_pg_sys::submodules::panic::run_guarded::h06a14908341f51f0 in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> pgrx_pg_sys::submodules::panic::run_guarded::h21cb3d48f146972e in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> pgrx::fcinfo::pg_12_13_14_15::pg_getarg::hc159b2c765c403b8 in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> _json_matches_schema_wrapper in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> _jsonb_matches_schema_wrapper in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> _jsonschema_is_valid_wrapper in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> _jsonschema_validation_errors_wrapper in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> ...
> "_jsonb_out", referenced from:
> pgrx_pg_sys::submodules::panic::run_guarded::h06a14908341f51f0 in pg_jsonschema.pg_jsonschema.cd8733de31c8f1ea-cgu.0.rcgu.o
> ld: symbol(s) not found for architecture arm64
> clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
>
>
I am guessing that this might end up being fixed by a combination of the PRās
NixOS:staging
ā reckenrode:clang-liblto-fix-mk2
opened 07:39PM - 15 Apr 24 UTC
## Description of changes
Clang assumes that `libLTO.dylib` is located at `..⦠/lib` in the same prefix as `clang`, but thatās not true in nixpkgs. `libLTO.dylib` is actually located at `libllvm^lib/lib.libLTO.dylib`.
This is the first piece to fixing LTO on Darwin. The other is updating ld64, which I will be doing in a separate PR later this week. This PR does not depend on that PR because there is no harm passing the correct path to ld64. It does not perform LTO by default, and trying to use `-flto` even with the correct path remains broken.
Testing was done using my WIP PR for ld64 with clang 16. See https://github.com/NixOS/nixpkgs/issues/19098#issuecomment-2041752524 for output. It can also be validated by setting `NIX_DEBUG=1` when running clang, then confirming that the path passed to `-lto_library` actually exists in the store.
Note: Testing was done on https://github.com/NixOS/nixpkgs/pull/302481. Iām building against the common clang branch now.
## Things done
- Built on platform(s)
- [ ] x86_64-linux
- [ ] aarch64-linux
- [x] x86_64-darwin
- [x] aarch64-darwin
- For non-Linux: Is sandboxing enabled in `nix.conf`? (See [Nix manual](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
- [ ] `sandbox = relaxed`
- [ ] `sandbox = true`
- [ ] Tested, as applicable:
- [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
- and/or [package tests](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests)
- or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
- [ ] Tested compilation of all packages that depend on this change using `nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"`. Note: all changes have to be committed, also see [nixpkgs-review usage](https://github.com/Mic92/nixpkgs-review#usage)
- [x] Tested basic functionality of all binary files (usually in `./result/bin/`)
- [24.05 Release Notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2405.section.md) (or backporting [23.05](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2305.section.md) and [23.11](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) Release notes)
- [ ] (Package updates) Added a release notes entry if the change is major or breaking
- [ ] (Module updates) Added a release notes entry if the change is significant
- [ ] (Module addition) Added a release notes entry if adding a new NixOS module
- [x] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
<!--
To help with the large amounts of pull requests, we would appreciate your
reviews of other pull requests, especially simple package updates. Just leave a
comment describing what you have tested in the relevant package/service.
Reviewing helps to reduce the average time-to-merge for everyone.
Thanks a lot if you do!
List of open PRs: https://github.com/NixOS/nixpkgs/pulls
Reviewing guidelines: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#reviewing-contributions
-->
---
Add a :+1: [reaction] to [pull requests you find important].
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc
and
NixOS:staging
ā reckenrode:ld64
opened 02:09AM - 30 Apr 24 UTC
## Description of changes
This PR updates cctools and ld64. It also fixes rel⦠ated breakage. It is currently set to draft until 24.05 is released. I will be rebasing weekly against staging, resolving any merge conflicts then. Before updating the ld64 branch, I build my configs and the Darwin channel blockers to confirm no regressions.
The following notes are copied from https://discourse.nixos.org/t/darwin-updates-news/42249/10.
### Packaging Changes
* cctools, ld64, and libtapi are now built from Appleās [OSS distributions](https://github.com/apple-oss-distributions) repo instead of the [cctools-port](https://github.com/tpoechtrager/cctools-port) and [apple-libtapi](https://github.com/tpoechtrager/apple-libtapi) repos.
* These versions (cctools 1010.6, ld64 951.9, libtapi 1500.0.12.3) correspond to the versions shipped with Xcode 15. cctools and ld64 are current as of Xcode 15.3. Packages should no longer have to patch around missing flags or feature support.
* Restoring Linux support is a WIP. I have made some changes to use non-private and non-portable APIs, but I am currently focused on getting Darwin updates first.
* The packages have been moved to the by-name hierarchy. Aliases are provided to the old names, but there are some breaking changes (see below).
* cctools is now only cctools. This is technically a breaking change (see below). ld64 has been moved to its own, separate package.
* darwin.binutils is now the package that defines the mix of cctools and LLVM tools. It has been update with additional tools. See below for the breakdown of what it contains.
* The build system has been replaced with Meson. I did this because dealing with xcbuild stinks, and these packages eventually need to support Linux for cross-compilation.
* corecrypto and CommonCrypto hashing APIs are reimplemented using OpenSSL on both Darwin (and eventually) Linux. cctools-port only does this on non-Darwin platforms.
* libtapi has been split into separate out and lib outputs. Most packages only need libtapi.dylib, which is ~500 KiB compared to ~30 MiB for the tapi binary.
* libtapi is linked against zlib. I donāt know what it uses zlib to do, but the upstream libtapi is also linked against zlib, and I want to match what upstream is doing.
_Note:_ ld-prime is will not be packaged because it is not currently included in the source releases. While I think itās unlikely, ld-prime will be added separately as a new package should the source be released.
### New Features
* LTO support. With this update, LTO works. I had to patch ld64 to look for libLTO.dylib in the store and clang to pass the correct path (see https://github.com/NixOS/nixpkgs/pull/304350). I bootstrap ld64 and link it with itself with LTO enabled to make sure that LTO actually works.
* Code directory support. cctools is built with libcodedirectory support, which allows strip and install_name_tool to identify linker-created signatures and update them automatically. This removes the need for postLinkSignHook and actually makes it harmful to continue using it by default (because it prevents automatic signature updates by replacing them with a non-linker-created signature).
###
Breaking Changes
* ld64 and cctools use GCD (libdispatch) for parallelism. This should improve performance, but it technically ups the required macOS version to 10.14. The APIs it uses are present under different names in 10.12, so I have attempted to patch around them. It builds with the 10.12 SDK, but it will need testing to confirm the tools actually work. This was the driver of updating the default SDK on x86_64-darwin for 24.11.
* Apple removed support for nested static archives from ld64. This happened with the release of Xcode 14, so it has been out in the ecosystem for a few years. Hopefully packages have adapted by now. For example, Kyua adds libutils.a to libcli.a using libcli_a_LIBADD in automake. This will fail to link with ld64 951.9.
* ld64 is more picking about command-line arguments. Passing `-rpath` when merging Mach-O object files fails.
* GNU as has been moved to the cctools^gas output. `-q` and `-Q` flags are supported to control whether it calls GNU as or the clang assembler (matching the upstream behavior of `as`).
* cctools only provides binaries from cctools. ld64 is a separate package now.
* darwin.cctools-apple, darwin.cctools-port, and darwin.cctools-llvm are replaced by just cctools. cctools-llvm is an alias to darwin.bintools.
* The old names canāt be used in nixpkgs because aliases are disabled when ofborg eval is run. The PR updating the tools will include changes for all packages using the old names. (Updates for LTO will be done in a separate PR or PRs.)
* Use of postLinkSignHook has been removed from bintools-wrapper. Because it removes linker-created signatures, it breaks the automatic updating of signatures by strip and install_name_tool. Unless youāre manually invoking codesign, you shouldnāt be affected. install_name_tool will do the right thing by default.
* `strip` and `install_name_tool` are no longer wrapped with `sigtool`. If you are modifying linker-signed binaries, which should be the typical case, they will update the signatures automatically. If you are manually invoking `codesign`, you will need to update the signatures manually after running `strip` or `install_name_tool`.
### stdenv updates
* Stage 2 has been collapsed from two parts into one stage. The source-based CF is not coming back. It adds a lot of complexity to the bootstrap.
* As noted in breaking changes, the Darwin stdenv no longer provides bintools using postLinkSignHook. Once the bootstrap tools are updated with these releases, it may be possible to drop sigtool completely from the bootstrap. Until that happens, early stages manually implement postLinkSignHook because the bootstrap tools ld64 does not appear capable of signing binaries on its own.
* As part of this update, I have to update the stdenv to use the new paths.
* The overall stdenv size is down by ~20 MiB due to dropping tapi from the closure. It also drops signtool and signingUtils, but those binaries are small.
* curl and GNU binutils throw when used during the bootstrap. curl should never be used during the bootstrap (to allow it to be updated without triggering a whole rebuild of Darwin). GNU binutils generally shouldnāt be used on Darwin (e.g., https://github.com/NixOS/nixpkgs/issues/299606), so the bootstrap shouldnāt need to use it.
### darwin.bintools changes
darwin.bintools changes
* c++filter is no longer linked from GNU binutils. It is linked from LLVM. A handful of packages are linked from cctools because LLVM does not provided drop-in replacements for them. The lists of tools are exported as attributes on darwin.bintools (`llvm_cmds` and `cctools_cmds` respectively). All binaries are symlinked to their traditional names (e.g., llvm-strip is symlinked to strip).
* LLVM tools: addr2line, ar, c++filt, dsymutil, lipo, install-name-tool, nm, objcopy, objdump, otool, size, strings, strip
* cctools tools: codesign_allocate, gprof, ranlib (and ld from ld64)
* Darwin is still `isCCTools` and not `isLLVM` because it does not use lld by default. Maybe that could change with lld 18, but Iām doubtful.
### Resolved Issues
* LTO works. Closes https://github.com/NixOS/nixpkgs/issues/19098.
* ld64 no longer crashes linking Haskell applications. Closes https://github.com/NixOS/nixpkgs/issues/149692.
## Things done
- Built on platform(s)
- [ ] x86_64-linux
- [ ] aarch64-linux
- [x] x86_64-darwin
- [x] aarch64-darwin
- For non-Linux: Is sandboxing enabled in `nix.conf`? (See [Nix manual](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
- [ ] `sandbox = relaxed`
- [ ] `sandbox = true`
- [ ] Tested, as applicable:
- [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
- and/or [package tests](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests)
- or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
- [ ] Tested compilation of all packages that depend on this change using `nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"`. Note: all changes have to be committed, also see [nixpkgs-review usage](https://github.com/Mic92/nixpkgs-review#usage)
- [x] Tested basic functionality of all binary files (usually in `./result/bin/`)
- [24.05 Release Notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2405.section.md) (or backporting [23.05](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2305.section.md) and [23.11](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) Release notes)
- [ ] (Package updates) Added a release notes entry if the change is major or breaking
- [ ] (Module updates) Added a release notes entry if the change is significant
- [ ] (Module addition) Added a release notes entry if adding a new NixOS module
- [x] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
<!--
To help with the large amounts of pull requests, we would appreciate your
reviews of other pull requests, especially simple package updates. Just leave a
comment describing what you have tested in the relevant package/service.
Reviewing helps to reduce the average time-to-merge for everyone.
Thanks a lot if you do!
List of open PRs: https://github.com/NixOS/nixpkgs/pulls
Reviewing guidelines: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#reviewing-contributions
-->
---
Add a :+1: [reaction] to [pull requests you find important].
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc
Although I am not 100% sure.
@reckenrode thought Iād ask and see also if there is anything I can do to help with these fixes?
If you check the whole log, is there an error about an unrecognized file format? Something about a bunch of hex digits? If so, thatās due to broken LTO support. Looking at upstreamās Cargo.toml
, they set LTO = fat
on release builds, so I assume thatās it.
Iāve been waiting to move forward due to the freeze on breaking changes before the release. Now that staging is open for post-24.05 changes, Iām going to start cherry-picking prerequisite PRs once the Darwin channel blockers finish building locally.
2 Likes