Closed Pi-Cla closed 2 weeks ago
If you run cargo fetch
with your target triple ahead of time you should get all the Rust deps you need. I don't know how you go about taring those up, but the Cargo cache location and all is quite standard, we're not doing anything special with that. Thereafter the build can be run offline, for example export CARGO_FEATURE_FLAGS==--offline
will make sure and keep Cargo's head out of the clouds during the SILE build process.
I have tried export CARGO_FEATURE_FLAGS==--offline
but it still results in the makefile calling a cargo build command without the --offline
flag so it still tries to connect to the internet
Try configuring with --with-system-lua-sources
.
I wrote a lot more but the power went out :-(
Still the same result.
I wonder if there is a way to get the Makefile to only build the lua portion of SILE. Then I could just use the typical openSUSE cargo macros to build with the vendored deps...
I have fixed it. @Pi-Cla I am pinging you everywhere :P
I have tried
export CARGO_FEATURE_FLAGS==--offline
but it still results in the makefile calling a cargo build command without the--offline
flag so it still tries to connect to the internet
@Pi-Cla That flag me thinks are for the feature flags for a Rust crate that's probably starts with the name lua. The correct flag to use vendor rust sources in our builds are
unset LIBSSH2_SYS_USE_PKG_CONFIG
export RUSTFLAGS=" -Clink-arg=-Wl,-z,relro,-z,now -C debuginfo=2 -C incremental=false -C strip=none"
export CARGO_AUDITABLE=auditable
export CARGO_FEATURE_VENDORED=1
@alerque btw we have resolved it. you don't need a fix on your side. :saluting_face:
Thanks for all the work on packaging this guys. I'm glad you got it worked out to build (and as a distro packager myself it warms my heart to see the dynamic build with system dependencies, offline build phase, etc.!).
Even though you got it to build, looking at the spec file I do have to wonder if there is anything we can do here upstream to make downstream builds easier to adapt to various requirements. I left a comment over there, but I'm not really clear on how you're using system Lua 5.1 headers but then also setting the vendored feature to get mlua to use LuaJIT anyway? If so why not just use --without-system-lua-sources
? Is there a way we could simplify or group the config options in a more idiomatic way that would have been easier to figure out? It's been a bit of a brain teaser to figure out how to support both dynamic linking with system deps and static builds with also optionally everything embedded.
Also on the RUSTFLAGS topic, is there a better way to set the flag we need without forcing you to have to set or reset everything like that?
Even though you got it to build, looking at the spec file I do have to wonder if there is anything we can do here upstream to make downstream builds easier to adapt to various requirements. I left a comment over there, but I'm not really clear on how you're using system Lua 5.1 headers but then also setting the vendored feature to get mlua to use LuaJIT anyway? If so why not just use
--without-system-lua-sources
?
TBH I am not really sure either. Vendored dependencies are really new to openSUSE e.g. Rust and has been since 2 years ago (except NPM packages?). I am one of the early adopters of this style of packaging. And we gradually started to support vendoring dependencies to other languages e.g. Zig has started using their own package manager of which I have to accommodate the changes as well.
Also on the RUSTFLAGS topic, is there a better way to set the flag we need without forcing you to have to set or reset everything like that?
Tbh I am not sure either. The RUSTFLAGS
I use are from one of the rpm macros which most Rust packages in openSUSE use during cargo build
. See https://github.com/Firstyear/cargo-packaging
you're using system Lua 5.1 headers but then also setting the vendored feature to get mlua to use LuaJIT anyway?
@Pi-Cla might clean that up for later (?). I was experimenting a bit and I am not sure which Lua to use.
Even though you got it to build, looking at the spec file I do have to wonder if there is anything we can do here upstream to make downstream builds easier to adapt to various requirements.
Tbh, I really don't know the answer to that. We have to adapt when upstream does changes things and although, sometimes it can be tiring, but so far, I was able to figure out how most software I package for openSUSE are built like this one. And you have already done so much to tell us the sources and what to do in https://github.com/sile-typesetter/sile?tab=readme-ov-file#from-source. What I usually do is check deps and then check your build scripts as well in .github
(GitHub Actions).
@alerque We finally got it to build with the luajit-devel headers. For some reason --I think because the headers are placed in a non-standard location-- we needed to add:
export LUA_INCLUDE="-I/usr/include/luajit-5_1-2.1"
to the %build and %install sections of the specfile.
Unless this is the standard location this looks like openSUSE packaging just placing headers in non-standard locations again... :(
Edit: this also works
export LUA_INCLUDE="$(pkg-config --cflags-only-I luajit)"
On openSUSE we create a vendored tarball of rust dependencies before building because the virtual machine which builds the package is intentionally not connected to the internet.
So eventually the configure script attempts to connect to the internet but fails:
Is there a way to both prevent it from connecting to the internet and to point it to the vendored tarball of rust dependencies?