Open DrPyser opened 2 years ago
Started running into an error yesterday on MacOS as well. What do you see in mkmf.log
?
> To see why this extension failed to compile, please check the mkmf.log which can be found here:
>
> /nix/store/ki8cfza2gjhlpiyjgwsfp9bnfv4fpkhr-ruby2.7.5-nokogiri-1.13.8/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/nokogiri-1.13.8/mkmf.log
>
I'm running into this as well: mkmf.log - not sure how to read that, but this looks interesting:
have_library: checking for xsltParseStylesheetDoc() in -lxslt... -------------------- yes
"gcc -o conftest -I/nix/store/16yvxdp9hymiyzvbrw633wyqkcz32qqf-ruby-2.7.6/include/ruby-2.7.0/x86_64-linux -I/nix/store/16yvxdp9hymiyzvbrw633wyqkcz32qqf-ruby-2.7.6/include/ruby-2.7.0/ruby/backward -I/nix/store/16yvxdp9hymiyzvbrw633wyqkcz32qqf-ruby-2.7.6/include/ruby-2.7.0 -I. -I/nix/store/gr29zd01870ks0g732w3vxh5923bqvkw-libxslt-1.1.36-dev/include -I/nix/store/a1a339wssk9vzn6aqapbbc19jp7yh16i-libxml2-2.10.0-dev/include/libxml2 -I/nix/store/ilr6sa1pzik3xdssrp6h92bb1mcisw2s-zlib-1.2.12-dev/include -O3 -fPIC -std=c99 -Wno-declaration-after-statement -g -Winline -Wmissing-noreturn conftest.c -L. -L/nix/store/16yvxdp9hymiyzvbrw633wyqkcz32qqf-ruby-2.7.6/lib -Wl,-rpath,/nix/store/16yvxdp9hymiyzvbrw633wyqkcz32qqf-ruby-2.7.6/lib -L/nix/store/0ffy34parydi236kb0lbqx5ygjxvj55f-libxslt-1.1.36/lib -Wl,-rpath,/nix/store/0ffy34parydi236kb0lbqx5ygjxvj55f-libxslt-1.1.36/lib -L/nix/store/d2j68cj02lrdvdkqpld1k78mjfc1l12c-libxml2-2.10.0/lib -Wl,-rpath,/nix/store/d2j68cj02lrdvdkqpld1k78mjfc1l12c-libxml2-2.10.0/lib -L/nix/store/7pjbsjdpycjn62326663p1qi8d4jk92n-zlib-1.2.12/lib -Wl,-rpath,/nix/store/7pjbsjdpycjn62326663p1qi8d4jk92n-zlib-1.2.12/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -lxml2 -lz -Wl,-rpath,/nix/store/16yvxdp9hymiyzvbrw633wyqkcz32qqf-ruby-2.7.6/lib -L/nix/store/16yvxdp9hymiyzvbrw633wyqkcz32qqf-ruby-2.7.6/lib -lruby-2.7.6 -lxslt -lxml2 -lz -lm -lc"
conftest.c: In function 't':
conftest.c:16:57: error: 'xsltParseStylesheetDoc' undeclared (first use in this function)
16 | int t(void) { void ((*volatile p)()); p = (void ((*)()))xsltParseStylesheetDoc; return !p; }
| ^~~~~~~~~~~~~~~~~~~~~~
conftest.c:16:57: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libxslt/xslt.h>
4:
5: /*top*/
6: extern int t(void);
7: int main(int argc, char **argv)
8: {
9: if (argc > 1000000) {
10: int (* volatile tp)(void)=(int (*)(void))&t;
11: printf("%d", (*tp)());
12: }
13:
14: return !!argv[argc];
15: }
16: int t(void) { void ((*volatile p)()); p = (void ((*)()))xsltParseStylesheetDoc; return !p; }
/* end */
@DrPyser the issue you are experiencing is related to bundix not supporting platform specific gem
you can read more in nixpkgs manual https://nixos.org/manual/nixpkgs/stable/#developing-with-ruby
search for section 17.30.2.3. Platform-specific gems
You basically need to remove all platform specific gems from your Gemfile.lock ( i did manually )
as for @n8henrie not sure if you have same issue, please provide full build log
@raboof I think your issue is not related, can you provide steps to reproduce ? ( maybe in different issue )
@kirillrdy thanks for your input! I worked around with BUNDLE_FORCE_RUBY_PLATFORM=true nix run nixpkgs#bundix -- --lock
as detailed in https://discourse.nixos.org/t/issues-with-nix-reproducibility-on-macos-trying-to-build-nokogiri-ruby-error-unknown-warning-option/22019/9, has been working fine since then.
I thought the work around BUNDLE_FORCE_RUBY_PLATFORM=true nix run nixpkgs#bundix -- --lock
worked at first, but now it is failing, same as before:
LD_LIBRARY_PATH=.:/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/lib "gcc -o conftest -I/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/include/ruby-3.1.0/x86_64-linux -I/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/include/ruby-3.1.0/ruby/backward -I/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/include/ruby-3.1.0 -I. -I/nix/store/y9rvq4b8mzyvwv1hngq7s3rdnpga04d1-libxslt-1.1.37-dev/include -I/nix/store/s62qhij9drhr9j4pjypkn2132pw5aggc-libxml2-2.10.4-dev/include/libxml2 -I/nix/store/03grn1z9pl9m8702wkshj5pwnvknazim-zlib-1.2.13-dev/include -O3 -fPIC -std=c99 -Wno-declaration-after-statement -O2 -g -Winline -Wmissing-noreturn -Wconversion -Wno-sign-conversion conftest.c -L. -L/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/lib -Wl,-rpath,/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/lib -L/nix/store/6jnl91wyr95i3wfk20qjv9ny720vb8ia-libxslt-1.1.37/lib -Wl,-rpath,/nix/store/6jnl91wyr95i3wfk20qjv9ny720vb8ia-libxslt-1.1.37/lib -L/nix/store/702x44k2lnxzxsxpfkrqrw7572vvh8mp-libxml2-2.10.4/lib -Wl,-rpath,/nix/store/702x44k2lnxzxsxpfkrqrw7572vvh8mp-libxml2-2.10.4/lib -L/nix/store/69jpyha5zbll6ppqzhbihhp51lac1hrp-zlib-1.2.13/lib -Wl,-rpath,/nix/store/69jpyha5zbll6ppqzhbihhp51lac1hrp-zlib-1.2.13/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lxml2 -lz -Wl,-rpath,/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/lib -L/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/lib -lruby-3.1.4 -lxslt -lxml2 -lz -lm -lc"
conftest.c: In function 't':
conftest.c:16:57: error: 'xsltParseStylesheetDoc' undeclared (first use in this function)
16 | int t(void) { void ((*volatile p)()); p = (void ((*)()))xsltParseStylesheetDoc; return !p; }
| ^~~~~~~~~~~~~~~~~~~~~~
conftest.c:16:57: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libxslt/xslt.h>
4:
5: /*top*/
6: extern int t(void);
7: int main(int argc, char **argv)
8: {
9: if (argc > 1000000) {
10: int (* volatile tp)(void)=(int (*)(void))&t;
11: printf("%d", (*tp)());
12: }
13:
14: return !!argv[argc];
15: }
16: int t(void) { void ((*volatile p)()); p = (void ((*)()))xsltParseStylesheetDoc; return !p; }
/* end */
I thought the work around
BUNDLE_FORCE_RUBY_PLATFORM=true nix run nixpkgs#bundix -- --lock
worked at first, but now it is failing, same as before:LD_LIBRARY_PATH=.:/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/lib "gcc -o conftest -I/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/include/ruby-3.1.0/x86_64-linux -I/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/include/ruby-3.1.0/ruby/backward -I/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/include/ruby-3.1.0 -I. -I/nix/store/y9rvq4b8mzyvwv1hngq7s3rdnpga04d1-libxslt-1.1.37-dev/include -I/nix/store/s62qhij9drhr9j4pjypkn2132pw5aggc-libxml2-2.10.4-dev/include/libxml2 -I/nix/store/03grn1z9pl9m8702wkshj5pwnvknazim-zlib-1.2.13-dev/include -O3 -fPIC -std=c99 -Wno-declaration-after-statement -O2 -g -Winline -Wmissing-noreturn -Wconversion -Wno-sign-conversion conftest.c -L. -L/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/lib -Wl,-rpath,/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/lib -L/nix/store/6jnl91wyr95i3wfk20qjv9ny720vb8ia-libxslt-1.1.37/lib -Wl,-rpath,/nix/store/6jnl91wyr95i3wfk20qjv9ny720vb8ia-libxslt-1.1.37/lib -L/nix/store/702x44k2lnxzxsxpfkrqrw7572vvh8mp-libxml2-2.10.4/lib -Wl,-rpath,/nix/store/702x44k2lnxzxsxpfkrqrw7572vvh8mp-libxml2-2.10.4/lib -L/nix/store/69jpyha5zbll6ppqzhbihhp51lac1hrp-zlib-1.2.13/lib -Wl,-rpath,/nix/store/69jpyha5zbll6ppqzhbihhp51lac1hrp-zlib-1.2.13/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lxml2 -lz -Wl,-rpath,/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/lib -L/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/lib -lruby-3.1.4 -lxslt -lxml2 -lz -lm -lc" conftest.c: In function 't': conftest.c:16:57: error: 'xsltParseStylesheetDoc' undeclared (first use in this function) 16 | int t(void) { void ((*volatile p)()); p = (void ((*)()))xsltParseStylesheetDoc; return !p; } | ^~~~~~~~~~~~~~~~~~~~~~ conftest.c:16:57: note: each undeclared identifier is reported only once for each function it appears in checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <libxslt/xslt.h> 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: int (* volatile tp)(void)=(int (*)(void))&t; 11: printf("%d", (*tp)()); 12: } 13: 14: return !!argv[argc]; 15: } 16: int t(void) { void ((*volatile p)()); p = (void ((*)()))xsltParseStylesheetDoc; return !p; } /* end */
you need to ensure that in your Gemfile.lock
only ruby
is listed under PLATFORMS
I was under the impression that setting BUNDLE_FORCE_RUBY_PLATFORM=true
would be sufficient.
Anyway, I made the following change:
diff --git a/Gemfile.lock b/Gemfile.lock
index 061ab41..ca24938 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -14,7 +14,7 @@ GEM
eventmachine (1.2.7)
ffi (1.15.5)
forwardable-extended (2.6.0)
- google-protobuf (3.23.3-x86_64-linux)
+ google-protobuf (3.23.3)
html-proofer (4.4.3)
addressable (~> 2.3)
mercenary (~> 0.3)
@@ -59,7 +59,7 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
- nokogiri (1.15.2-x86_64-linux)
+ nokogiri (1.15.2)
racc (~> 1.4)
parallel (1.23.0)
pathutil (0.16.2)
@@ -87,7 +87,7 @@ GEM
zeitwerk (2.6.8)
PLATFORMS
- x86_64-linux
+ ruby
DEPENDENCIES
RbST
The I ran
BUNDLE_FORCE_RUBY_PLATFORM=true nix run 'nixpkgs#bundix'
But still getting the same error.
I was under the impression that setting
BUNDLE_FORCE_RUBY_PLATFORM=true
would be sufficient.Anyway, I made the following change:
diff --git a/Gemfile.lock b/Gemfile.lock index 061ab41..ca24938 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,7 +14,7 @@ GEM eventmachine (1.2.7) ffi (1.15.5) forwardable-extended (2.6.0) - google-protobuf (3.23.3-x86_64-linux) + google-protobuf (3.23.3) html-proofer (4.4.3) addressable (~> 2.3) mercenary (~> 0.3) @@ -59,7 +59,7 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) - nokogiri (1.15.2-x86_64-linux) + nokogiri (1.15.2) racc (~> 1.4) parallel (1.23.0) pathutil (0.16.2) @@ -87,7 +87,7 @@ GEM zeitwerk (2.6.8) PLATFORMS - x86_64-linux + ruby DEPENDENCIES RbST
The I ran
BUNDLE_FORCE_RUBY_PLATFORM=true nix run 'nixpkgs#bundix'
But still getting the same error.
BUNDLE_FORCE_RUBY_PLATFORM=true didn't work for me in the past
your diff looks correct ( assuming there are no more platform specific gems in lock ) also have a look at Gemfile
if that doesn't help, and if your Gemfile and Gemfile.lock are not sensitive, you can upload them somewhere I can give it a try.
Thanks for your help. Everything looks OK to me...
It is a public repo: https://github.com/brianmay/penguin_brian/
Thanks for your help. Everything looks OK to me...
It is a public repo: https://github.com/brianmay/penguin_brian/
ok i see the issue.
hashes of paltform specific gems are already in gemset.nix so bundix is still using those,
i've rm gemset.nix ran bundix again
diff --git a/gemset.nix b/gemset.nix
index 9047698..c3f9bdc 100644
--- a/gemset.nix
+++ b/gemset.nix
@@ -87,7 +87,7 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
- sha256 = "sha256-TbwKKNuVnNN8y7BA2lxUt71nLvO5I9DdCpnqJsvfn6k=";
+ sha256 = "1aczvz5jdslr1bfx08xrycp6ggdpaifdlh5hrdyd774mvcl0mg2d";
type = "gem";
};
version = "3.23.3";
@@ -237,7 +237,7 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
- sha256 = "sha256-INyAC4++TE9LWxZOaqOrgqNxvLJ+toXBZpYcNN2KItc=";
+ sha256 = "1mr2ibfk874ncv0qbdkynay738w2mfinlkhnbd5lyk5yiw5q1p10";
type = "gem";
};
version = "1.15.2";
@@ -370,7 +370,7 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
- sha256 = "sha256-TdwW90GmOIwkFA2VpWGqau2BwESPd9B0E808W45Pvvw=";
+ sha256 = "1z5y9y75ng6d2dsd0xwg8k083vbam9hsb58d2hj8qf5687vidp2d";
type = "gem";
};
version = "1.63.6";
I deleted the gemset.nix, ran gemset.nix, got the same diff as you, but still getting the same error when trying to build it :-(
I deleted the gemset.nix, ran gemset.nix, got the same diff as you, but still getting the same error when trying to build it :-(
haha, its like I am reliving my past :-)
if you read error carefully, it cant find mini_portile2 (2.8.2)
the issue is that nokogiri for ruby platform has different dependencies to precompiled nokogiry
so you can either manually edit lock file to add this diff
diff --git a/Gemfile.lock b/Gemfile.lock
index ca24938..c07a703 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -59,7 +59,9 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
- nokogiri (1.15.2)
+ mini_portile2 (2.8.2)
+ nokogiri (1.15.3)
+ mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.23.0)
pathutil (0.16.2)
or
nix shell nixpkgs#bundler nixpkgs#protobuf nixpkgs#gnumake nixpkgs#gcc
BUNDLE_FORCE_RUBY_PLATFORM=true bundle install
BUNDLE_FORCE_RUBY_PLATFORM=true bundle update nokogiri
bundix
hopefully this is the end of it !
but we should keep this thread open for others to find
Oh, I missed_ the fact it was a different error.
Now, next error :-)
ERROR: Error installing /nix/store/4rr01m662kqvg781hsiwi70k0pnm8h8m-sass-embedded-1.63.6.gem:
ERROR: Failed to build gem native extension.
current directory: /nix/store/fmpb9jya3laklldynj1y02jzhrc4153r-ruby3.1.4-sass-embedded-1.63.6/lib/ruby/gems/3.1.0/gems/sass-embedded-1.63.6/ext/sass
/nix/store/wcy993wz0zlcixaxivi6gha33afwq66n-ruby-3.1.4/bin/ruby -rrubygems /nix/store/wh57p9268fqlkr32lahgxzqa26sxqs7w-ruby3.1.4-rake-13.0.6/lib/ruby/gems/3.1.0/gems/rake-13.0.6/exe/rake RUBYARCHDIR\=/nix/store/fmpb9jya3laklldynj1y02jzhrc4153r-ruby3.1.4-sass-embedded-1.63.6/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/sass-embedded-1.63.6 RUBYLIBDIR\=/nix/store/fmpb9jya3laklldynj1y02jzhrc4153r-ruby3.1.4-sass-embedded-1.63.6/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/sass-embedded-1.63.6
fetch https://github.com/sass/dart-sass/releases/download/1.63.6/dart-sass-1.63.6-linux-x64.tar.gz
rake aborted!
SocketError: Failed to open TCP connection to github.com:443 (getaddrinfo: Temporary failure in name resolution)
huh? why is it trying to download from github?
https://github.com/ntkme/sass-embedded-host-ruby/blob/v1.63.6/ext/sass/Rakefile#L284
during gem build it tries to download dart-sass linux binary but since there is no internet in sandbox
you will need to patch that gem to use binary from the store.
Happy to have a look at it but not to day, feel free to reach out via discourse.nixos.org/
I found one solution here:
But this was going to be painful, the patch required changes for each version. And I couldn't get the patch to apply.
Then I found https://blog.yuribocharov.dev/posts/2023/08/09/developing-a-jekyll-site-on-nixos
gemConfig = {
sass-embedded = attrs: {
sass-embedded = attrs: {
DART_SASS = pkgs.fetchurl {
url = "https://github.com/sass/dart-sass/releases/download/1.64.2/dart-sass-1.64.2-linux-x64.tar.gz";
sha256 = "sha256-+RmtceWz5K2xaJZvuaJs31tocby4H/LwBBV15DRBCzs=";
};
};
};
};
Which perhaps isn't great, but at least it is working.
Curiously, while the first version uses the dart-sass-embedded
nixpg, the files are different:
$ find /nix/store/lix36887vmg904k8ks6ybmfdd8nc2qmb-dart-sass-embedded-1.62.1
/nix/store/lix36887vmg904k8ks6ybmfdd8nc2qmb-dart-sass-embedded-1.62.1
/nix/store/lix36887vmg904k8ks6ybmfdd8nc2qmb-dart-sass-embedded-1.62.1/bin
/nix/store/lix36887vmg904k8ks6ybmfdd8nc2qmb-dart-sass-embedded-1.62.1/bin/dart-sass-embedded
/nix/store/lix36887vmg904k8ks6ybmfdd8nc2qmb-dart-sass-embedded-1.62.1/lib
/nix/store/lix36887vmg904k8ks6ybmfdd8nc2qmb-dart-sass-embedded-1.62.1/lib/dart-sass-embedded.so
$ tar -tzvf dart-sass-1.64.2-linux-x64.tar.gz
-rw-r--r-- 0/0 82706 2023-08-01 09:39 dart-sass/src/LICENSE
-rwxr-xr-x 0/0 4986488 2023-08-01 09:39 dart-sass/src/dart
-rw-r--r-- 0/0 4965856 2023-08-01 09:39 dart-sass/src/sass.snapshot
-rwxr-xr-x 0/0 592 2023-08-01 09:39 dart-sass/sass
I am a bit sceptical the first version is going to work, it looks like the second filename is hard coded: https://github.com/ntkme/sass-embedded-host-ruby/blob/34674f3ebdea5855e0eece26245c0c3d01962a7a/ext/sass/Rakefile#L33
Wonder if this means the above discourse package is broken. I don't use it.
In any case I think this issue can be closed now.
Steps To Reproduce
Steps to reproduce the behavior:
bundix -l
bundix -i
:Build log
https://gist.github.com/DrPyser/69695ff1142be461a81c07cf2d09ae68
Notify maintainers
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.