Conversation
|
Can't this be a part of autoreconfHook? |
Unfortunately autoreconfHook isn't called by default. So a stdenv adapter would still be needed (to add autoreconfHook as an extra dependency). Calling autoreconfHook instead of fixPathToUsrBinFileInConfigureScript could be done in theory, but in practice autoreconfHook breaks a lot of packages -- it uses the latest autotools instead of whatever version was used when the package was created. The ./configure script is basically a vendored dependency. The long-run, decade-scale fix is to upgrade to libtool 2.4.7 and wait for all the packages in nixpkgs to run autoreconf upstream (and fix the breakage that occurs). The breakage caused by blindly autoreconfHook'ing things is why I prefer this PR over #166722. I tried getting |
|
So this is a temporary solution until libtool is upgraded? At least it's nice to have this solved in the short term. |
No. Read the section titled "implementation". There are two changes, only one of them can be removed when libtool is upgraded. The one that can be removed is clearly marked with a comment mentioning this, and is found in the same file where the The rest needs to stay due to vendoring in |
|
Pushed three additional patches. One just expands a comment with more detail, another factors out As a side effect of the third patch, Perhaps we should consider including |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nixlang-how-do-you-find-all-uses-of-a-declaration/18369/14 |
|
I was talking to @alyssais about this. She pointed out https://discourse.nixos.org/t/rfc-libtool-updates-and-improved-nix-nixos-support/15660 this to me too, which is very exciting. I would like to move closer to |
|
(Edit: I think the person who started this discourse thread is the same person who committed the bugfix that was released in libtool-2.4.7)
Yes, that's certainly good news! But just like the bugfix in libtool-2.4.7, it won't affect the hundreds (or thousands?) of packages that have an old
I would like that as well, but the amount of breakage it will cause is mind-boggling. So many packages fail to build when you add Making I hope this PR does not end up blocked on some hoped-for future |
|
|
#167071 is a PR to upgrade to libtool 2.4.7. If #167071 merges first then the changes to |
Here's a great example: #163401 (comment) |
SuperSandro2000
left a comment
There was a problem hiding this comment.
Not a big fan that we add another package to bootstrapping.
The names you have chosen are horrible long. I don't think anyone can remember them. Maybe we can passthru them for autoconf and autoreconfHook so that you can easily access them.
lib/systems/default.nix
Outdated
There was a problem hiding this comment.
Suggestion: How about we always fix this to not needing to keep track of this and in projects? Because I don't think that anytime soon this is fixed everywhere.
There was a problem hiding this comment.
@SuperSandro2000, thank you so much for taking the time to review this PR (and my others too, but this one especially). I really appreciate it; this is the PR I was afraid would get stuck in limbo forever.
Suggestion: How about we always fix this to not needing to keep track of this and in projects?
I would prefer this too. I was trying to minimize rebuilds, but in hindsight maintainability matters more.
If the fix is applied on all platforms then this definitely needs to go into staging. The good news: if this goes into staging it can build off of #167071, which will make this PR much shorter.
I will incorporate your other feedback, switch branches, and remove the parts that are no longer necessary after #167071.
Again, thank you so much for wading into this complicated issue and taking the time to understand what's going on here!
|
Converted to draft while I rework this. |
|
Useful for future reference: This will add code to |
|
Okay, I think this should work. Running some rebuilds overnight to be sure. The new approach applies the This let me simplify the top-level addition, which is now called just |
libtool2-macos11.patch has been merged upstream as 9e8c88251 Co-authored-by: Sandro <[email protected]>
libtool's libtool.m4 script assumes that `file` is available, and can
be found at `/usr/bin/file` (this path is hardwired). Furthermore,
the script with this assumption is vendored into the ./configure
scripts of an enormous number of packages.
The use of /usr/bin/file in ./configure scripts only affects sandboxed
cross-builds to a x86_64-linux host as well as any sandboxed build
(cross or native) to these hosts: x86_64-freebsd, *-hpux, *-irix,
mips64*-linux, powerpc*-linux, s390x-linux, s390x-tpf, sparc-linux,
and *-solaris.
This commit adds `replaceUsrBinFile`, which will check the ./configure
script to see if it vendors a pre-version-2.4.7 copy of libtool.m4.
If it does, it will `substituteInPlace` the use of `/usr/bin/file`
with `${buildPackages.file}/bin/file`.
If a pre-version-2.4.7 copy of libtool.m4 is *not* vendored then
replaceUsrBinFile will cause the build to fail -- this ensures that
replaceUsrBinFile gets removed as upstream packages gradually upgrade
to a fixed version of libtool and re-run autoconf.
This commit allows the following commands to complete, which should
enable Hydra to produce bootstrap-files for mips64el:
```
nix-build \
--option sandbox true \
--option sandbox-fallback false \
pkgs/top-level/release-cross.nix \
-A bootstrapTools.mips64el-linux-gnuabi64.build
nix-build \
--option sandbox true \
--option sandbox-fallback false \
. \
-A pkgsCross.mips64el-linux-gnuabi64.nix_2_4
```
Co-authored-by: Sandro <[email protected]>
| ''); | ||
|
|
||
| # libtool.m4 prior to version 2.4.7 invokes "/usr/bin/file", and is vendored into many ./configure scripts | ||
| replaceUsrBinFile = |
There was a problem hiding this comment.
Maybe we could convert this to a setupHook in which case we would never need to call it manually? We would need to remove the exit part but it would make it a lot less work to maintain.
There was a problem hiding this comment.
I think it would be logical to make this part of fixLibtool in pkgs/stdenv/generic/setup.sh.
There was a problem hiding this comment.
I would love to do that but I can't figure out how to thread the reference to ${buildPackages.file} down into setup.sh. Also even if I could do that, it would create a circular dependency in many cases, wouldn't it? If you have ideas on how to do this please give me a hint and I will investigate this. It really belongs in fixLibtool() if it is possible to put it there.
By the way, speaking of crazy circular dependencies, the ./configure script that ships with file-5.41.tar.gz tries to call /usr/bin/file! The package ships with a circular dependency! Talk about crazy...
There was a problem hiding this comment.
Maybe we could convert this to a setupHook
Thanks I will try that.
There was a problem hiding this comment.
the
./configurescript that ships withfile-5.41.tar.gztries to call/usr/bin/file! The package ships with a circular dependency!
I would love to do that but I can't figure out how to thread the reference to
${buildPackages.file}down intosetup.sh. Also even if I could do that, it would create a circular dependency in many cases, wouldn't it?
I should add that these are two arguments for considering putting file in the bootstrap-tools. I know that adding more stuff to the bootstrap-tools is never an easy decision, but when you have packages that depend on themselves (like a C compiler) and which 99% of the ecosystem has a vendored dependency upon, well... that's sort of what the bootstrap-files is for.
Then we could have fixLibtool() replace /usr/bin/file with file, since the bootstrap-tools bin directory is always in the $PATH. So there wouldn't be any need to thread the package reference down into there through the nixlang code.
It's ugly, but so is the problem that it fixes.
There was a problem hiding this comment.
See #168413 for a much, much simpler solution that simply (a) patches configure scripts unconditionally and (b) includes file in stdenv's common-path.nix.
I'm running a rebuild-the-world on that PR, it'll take all day.
I would appreciate insight on whether or not that approach is considered mergeable if it works. If so, I would much prefer it. It's basically a two-line change plus a workaround for libidn2 trying to autoreconf itself.
|
Closed in favor of #168413, which is much much simpler and more maintainable -- at the cost of having to rebuild everything. |
Problem
In libtool<=2.4.6 the libtool.m4 script assumes that
fileis available, and can be found at/usr/bin/file(this path is hardwired). This fails for sandboxed builds. This script is vendored into the./configurescripts of an enormous number of packages.The use of /usr/bin/file in ./configure scripts affects sandboxed cross-builds to a
x86_64-linuxhosts as well as all sandboxed builds (cross and native) tox86_64-freebsd,*-hpux,*-irix,mips64*-linux,powerpc*-linux,s390x-linux,s390x-tpf,sparc-linux, and*-solaris.(Immediate) Motivation
This is currently preventing the generation of Hydra-built
bootstrap-filesfor mips64el-linux-gnuabi64, and will affect many of the other new platforms we try to bootstrap on.The build of the
pcrepackage (and a few others) emits these lines when its configure script is run:The build does not fail until much later, when make-bootstrap-files.nix tries to make a copy libpcre.so, which was never built.
Solution
An earlier revision of this PR tried to use fancy
stdenvadapters to fix this problem without causing mass rebuilds. SuperSandro2000's suggestion to simply apply the fix everywhere seems like it will be more maintainable.Currently this PR adds a new top-level expression
replaceUsrBinFilewhich will check to see if the package being built has a vendoredlibtool.m4older than 2.4.7. If it does, then it willsubstituteInPlace ./configure --replace /usr/bin/file ${buildPackages.file}/bin/file. If it does not find this, it will abort the build with an error message. This ensures that maintainers will remove thereplaceUsrBinFileas soon as upstream regenerates their autoconf with an unaffected libtool >= 2.4.7.This commit also adds
replaceUsrBinFiletonativeBuildInputsof a large number (but not all) of the packages that need it.Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes