I have some small Fortran scripts that I use in a Julia package I am developing. Currently, I have just compiled them myself into a shared library and used ccall. But I want my package to be deployable on other people’s computers, without them having to compile the code themselves.
So I tried to use BinaryBuilder.jl to deploy binaries for many platforms. When trying to run my build_tarball.jl script, I ran into the error
ERROR: LoadError: InitError: BinaryBuilder supports only Julia v1.7.
So I switched to Julia v1.7, hoping to use this version to run BinaryBuilder, but then use the resulting _jll package with Julia v1.11. Is this not possible? And if not, is there a new preferred way to deploy shared libraries of Fortran code?
After building the shared library and deploying to a _jll package, when I import the package in Julia v1.7 the library shows up in the package namespace, but not in v1.11. (libbsplines is the name of the shared library I am looking for)
I am hoping that there is a way to get BinaryBuilder.jl to make _jll packages that work with v1.11, but if not, does anyone know an alternative way to accomplish the same endgoal?
The version of Julia used for running BinaryBuilder is totally unrelated to the versions of Julia which can use the generated packages. All jlls hosted on Yggdrasil are built with v1.7 and then used with any Julia version (well, in practice v1.6+ as a matter of fact, but not in any way dependent on the Julia version used for BinaryBuilder).
I don’t quite know what you’re doing, but if I need to do a completely blind guess you built the package for libgfortran4 but not libgfortran5, or something like that: Building Packages · BinaryBuilder.jl.
Thanks for the input, I’m not really sure what I am doing so any advice is appreciated.
I don’t understand the nuances of libgfortran4 vs 5, but I think that’s covered by me using expand_gfortran_versions. I’m not sure if my explicit use of gfortran in the build script interferes with this.
Also, I am deploying my own github repo, not Yggdrasil. Should that make a difference in the build process? I used my own github repo because I didn’t want to cause any chaos in a publicly hosted environment while I am still learning to use BinaryBuilder.
This is my build_tarballs.jl script.
using BinaryBuilder
using Pkg: PackageSpec
name = "BSplines"
version = v"0.1.9"
sources = [
DirectorySource("./src"),
]
script = raw"""
cd ${WORKSPACE}/srcdir
gfortran -O3 -shared -fPIC -fdefault-real-8 bsplvb.f bsplvd.f -o libbsplines.${dlext}
install -D libbsplines.${dlext} ${libdir}/libbsplines.${dlext}
"""
# Only linux for now
platforms = [HostPlatform()]
#platforms = supported_platforms()
platforms = expand_gfortran_versions(platforms)
products = [
LibraryProduct("libbsplines", :libbsplines),
]
dependencies = [
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae")),
]
build_tarballs(
ARGS,
name,
version,
sources,
script,
platforms,
products,
dependencies,
julia_compat="1.11"
)
That’s wrong, since HostPlatform literally encodes all properties of the current “platform”, including the current Julia version, but no one uses HostPlatform there. Maybe you want to elaborate what you want to achieve. For which platforms do you want to build your package?
That’s almost certainly the issue! I’ll change that and see if that fixes things.
I want to build my package for all platforms, but while I was still figuring out how things work, I only built for the host platform to reduce the build time. I hadn’t considered that the Julia version was part of the platform. I assumed the platform only had to do with the OS and compiler info.