daa84 / neovim-gtk

gtk ui for neovim
GNU General Public License v3.0
716 stars 57 forks source link

FTBFS: failed to compile `nvim-gtk v0.2.0 #166

Closed mcepl closed 5 years ago

mcepl commented 5 years ago

Describe the bug When building in the network isolated environment (e.g., build systems for all Linux distributions) it is necessary (due to the unfortunate lack of dynamic linking for rust) to provide a tarball with the third party dependencies. Therefore, outside of the build environment I first create vendor tarball like this:

$  cargo build --release
$  rm -rf vendor/ && cargo vendor --frozen >_cargo_config
$ tar cvJf neovim-gtk-vendor.tar.xz vendor/

and then use tarball in the build process:

mkdir .cargo
cat >.cargo/config <<EOF
[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "./vendor"
EOF
cargo build --release

Build works without problems, but then when I run cargo install --force --root %{buildroot}%{_prefix} --path . I get failed command and the end of the log:

[  648s] + cargo install --force --root /home/abuild/rpmbuild/BUILDROOT/neovim-gtk-0.1.2~git.1544347959.a440248-0.x86_64/usr --path .
[  648s]   Installing nvim-gtk v0.2.0 (/home/abuild/rpmbuild/BUILD/neovim-gtk-0.1.2~git.1544347959.a440248)
[  648s]     Updating crates.io index
[  648s] warning: spurious network error (2 tries remaining): curl error: Could not resolve host: github.com
[  648s] ; class=Net (12)
[  648s] warning: spurious network error (1 tries remaining): curl error: Could not resolve host: github.com
[  648s] ; class=Net (12)
[  648s] error: failed to compile `nvim-gtk v0.2.0 (/home/abuild/rpmbuild/BUILD/neovim-gtk-0.1.2~git.1544347959.a440248)`, intermediate artifacts can be found at `/home/abuild/rpmbuild/BUILD/neovim-gtk-0.1.2~git.1544347959.a440248/target`
[  648s] 
[  648s] Caused by:
[  648s]   failed to fetch `https://github.com/rust-lang/crates.io-index`
[  648s]

Why suddenly cargo requires the network connection? It didn't for a long time.

Technical information (please complete the following information):

Full build log.

daa84 commented 5 years ago

Think cargo install can be replaced with simple copy of executable. Not remember why i use cargo install here.

mcepl commented 5 years ago
%install
mkdir -p %{buildroot}%{_datadir}/%{binname}/
cp -p -r runtime %{buildroot}%{_datadir}/%{binname}/
install -p -m 0644 -D desktop/org.daa.NeovimGtk.desktop \
    %{buildroot}%{_datadir}/applications/org.daa.NeovimGtk.desktop
install -p -m 0644 -D desktop/org.daa.NeovimGtk_128.png \
    %{buildroot}%{icondir}/hicolor/128x128/apps/org.daa.NeovimGtk.png
install -p -m 0644 -D desktop/org.daa.NeovimGtk_48.png \
    %{buildroot}%{icondir}/hicolor/48x48/apps/org.daa.NeovimGtk.png
install -p -m 0644 -D desktop/org.daa.NeovimGtk.svg \
    %{buildroot}%{icondir}/hicolor/scalable/apps/org.daa.NeovimGtk.svg
install -p -m 0644 -D desktop/org.daa.NeovimGtk-symbolic.svg \
    %{buildroot}%{icondir}/hicolor/symbolic/apps/org.daa.NeovimGtk-symbolic.svg

install -p -m 0755 -D target/release/nvim-gtk \
    %{buildroot}%{_bindir}/nvim-gtk

rm -vf %%{buildroot}%%{_prefix}/.crates.toml

Seems to work just fine. I understand that cargo install is expected to be used for Rust projects, but it just doesn't work for me, and this does.

daa84 commented 5 years ago

don't see any problems with replace cargo install with cp

mcepl commented 5 years ago

Works with the current version of build scripts on https://build.opensuse.org/package/show/home:mcepl:neovim/neovim-gtk