I am trying to include a C++ library with julia package. After BinaryBuilder’s wizard drops me into cross-compilation environment, the configure script that I sun within the source directory informs me that I need an additional library, say, libxxx-dev. So what is the correct procedure; do I add this library using apk tool? (the library is included among the ones distributed with julia compiler, in /usr/local/julia-1.5.3/libs)
You need to install the dependencies for the target system, using other JLL packages when the wizard asks you so at the beginning. Inside the wizard build environment you can run
The question is, the C++ library configure script stops because libgmp-dev is not available within the cross-compile environment. A version of Libgmp is included within julia distribution. So if I include GMP@ 6.1.2 from Yggdrasil, that will add to the build environment the same version as the one shipped with the compiler, and when my _jll package is installed, it will not need to download libgmp. Correct?
Uhm, the wizard doesn’t handle different versions very nicely. You can continue with whatever the wizard will install and we can fix it when you open the PR for Yggdrasil (which I assume is what you’re going to do?).
I warmly recommend you to write a build_tarballs.sh script, see Building Packages · BinaryBuilder.jl or just start from another simple script that you can find in Yggdrasil. It’s way easier if you need to restart from scratch multiple times.
I think you’re misunderstanding me somewhat. I don’t have a preference for any particular version of libgmp. I just want to compile the C++ library with the same libgmp as julia uses.
The build script refers to the particular version of libgmp. If I am interpreting the contents of julia artifacts’ directory correctly, it is the same libgmp as the julia ships with. Thus, in the Julia code that makes use of MPSolve_jll it should be safe to ccall((..., :libgmp)), shouldn’t it? Or is it actually safer to use libgmp from within MPSolve_jll namespace, like this: ccall((..., MPSolve_jll.libgmp))?
I tried getting a handle with dlopen() to both :libgmp and MPSolve_jll.libgmp, and the pointer returned is the same. The question is, would it stay the same in future releases?
I know that I can. What I am concerned about is making sure this libgmp is the same one that libmps is built against, because I am passing GMP types to ````MPsolve```.
As far as I know (I think @fingolfin knows more than me in this regard), if you target GMP v6.1, your code should work also with v6.2, there haven’t been breaking changes.