Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and CI static builds #3765

Merged
merged 25 commits into from Oct 17, 2020
Merged

Conversation

@Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Jun 29, 2020

We like static builds because we can use to make demos more self-contained and less spooky on systems without a regular installation of Nix.

There number of things that didn't work out of the box also makes us think CI would be a good idea. Static linking shouldn't be this invasive for most programs, but a few things have accumulated. Hopefully we can eventually fix them more elegantly by using a non-bespoke build system (that e.g. could use pkg-config private deps to figure out the right link order).

musl doesn't like this identifier
this is needed for static linking to work properly
this seems to break in Musl/Static with:

terminate called after throwing an instance of 'std::bad_function_call'
  what():  bad_function_call
@Ericson2314 Ericson2314 changed the title Fix and ci static builds Fix and CI static builds Jun 29, 2020
mk/programs.mk Outdated Show resolved Hide resolved
src/libutil/util.cc Outdated Show resolved Hide resolved
@Ericson2314 Ericson2314 changed the title Fix and CI static builds Semi-WIP: Fix and CI static builds Jun 30, 2020
@Ericson2314
Copy link
Member Author

@Ericson2314 Ericson2314 commented Jun 30, 2020

I guess I'll call it semi-wip, hah. It works, but it would be nice to accomplish some things differently.

@domenkozar
Copy link
Member

@domenkozar domenkozar commented Jun 30, 2020

Also needs -A build-static in .github/nix/test.yml

@matthewbauer
Copy link
Member

@matthewbauer matthewbauer commented Jul 29, 2020

#3507 has a good explanation of why the getHome* changes are needed.

@Ericson2314 Ericson2314 changed the title Semi-WIP: Fix and CI static builds Fix and CI static builds Jul 30, 2020
@domenkozar domenkozar requested a review from edolstra Jul 31, 2020
src/nix/why-depends.cc Outdated Show resolved Hide resolved
flake.nix Outdated Show resolved Hide resolved
@Ericson2314 Ericson2314 changed the title Fix and CI static builds WIP: Fix and CI static builds Oct 15, 2020
Ericson2314 added 4 commits Oct 15, 2020
And remove one that we didn't actually need to add
Per the comments, the underlying issue is
libarchive/libarchive#1446, knowing this
allows the hack to be much more targetted.
@Ericson2314 Ericson2314 changed the title WIP: Fix and CI static builds Fix and CI static builds Oct 15, 2020
@Ericson2314
Copy link
Member Author

@Ericson2314 Ericson2314 commented Oct 15, 2020

@edolstra OK think this is finally cleaned up and ready!

@Ericson2314
Copy link
Member Author

@Ericson2314 Ericson2314 commented Oct 15, 2020

Ugh, tests failed because evidently the channel doesn't include NixOS/nixpkgs@9f5ba92 yet?

Oh right, I got to bump the flake lock.

@Ericson2314
Copy link
Member Author

@Ericson2314 Ericson2314 commented Oct 15, 2020

Well, and now there are different problems: errors installing nix in the mac CI runner. :(

@Ericson2314 Ericson2314 force-pushed the fix-and-ci-static-builds branch from 68d5666 to 1d09923 Oct 16, 2020
@edolstra edolstra merged commit e6247a5 into NixOS:master Oct 17, 2020
2 checks passed
@edolstra
Copy link
Member

@edolstra edolstra commented Oct 17, 2020

BTW I noticed that the nix binary has some references to openssl and nlohmann_json:

$ nix-store -qR ./result/
/nix/store/4nayz4kkm15s5xxl9q3x4amz63wnffrg-openssl-1.1.1g-x86_64-unknown-linux-musl
/nix/store/akmnk90lr4snlh52i90fk4h9j4k9bhxh-nlohmann_json-3.7.3-x86_64-unknown-linux-musl
/nix/store/nkgg7yaaijh1f06a8zck2diz3014fm13-nix-3.0pre20201017_e6247a5-x86_64-unknown-linux-musl

which would be nice to get rid of to get a really minimal closure.

@Ericson2314 Ericson2314 deleted the fix-and-ci-static-builds branch Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants