Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New recipe: MEOS #9453

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions M/MEOS/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "MEOS"
version = v"1.2.0"

# MEOS (Mobility Engine, Open Source) is a standalone C library and the core component of MobilityDB.
# For further information, see https://libmeos.org
sources = [
GitSource("https://github.com/MobilityDB/MobilityDB.git", "60048b5b4b7ce2f7560c024d1af024db73b3bd5b")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused: why is the recipe called MEOS build it builds a project called "MobilityDB". I just went to https://github.com/MobilityDB/MobilityDB and it doesn't mention "MEOS" in the README.md (though there is a subdirectory called meos).

So is MEOS a subset of MobilityDB? But building MobilityDB for some reason... only builds and installs MEOS, not the whole thing?

Perhaps it would be good to add a few comments to explain the situation? Or rename this recipe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's explained in the PR description (and on the linked website). I will add a similar comment with the link to the source here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Mobility Engine Open Source" also does not seem to be the obvious search hit for "MeOS" on Google.

Recommendation: Choose a longer, more explicit name, e.g., MobilityEngineOpenSource.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that Google doesn't help (right now), but I'm not sure if that's a good requirement? Eigen, much more famous, doesn't show up in my search results either. I suppose we tend to follow how the external library calls itself, which is MEOS. Is there a naming guide for when we deviate from the library name itself?

FWIW, it is supposed to mirror similarly named software (also recipes here), namely GEOS (but GDAL and PROJ also come to mind).

]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/MobilityDB

cmake -B build \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_BUILD_TYPE=Release \
-DMEOS=ON \
-DHAVE_X86_64_POPCNTQ_EXITCODE="FAILED_TO_RUN" \
-DHAVE_X86_64_POPCNTQ_EXITCODE__TRYRUN_OUTPUT=
Comment on lines +23 to +24
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? This is such an old instruction which should be moderately safe to assume to be available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently it's not the instruction, but the TRY_RUN statement is not allowed in cross-compile mode:

[14:57:59] CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
[14:57:59]    HAVE_X86_64_POPCNTQ_EXITCODE (advanced)
[14:57:59]    HAVE_X86_64_POPCNTQ_EXITCODE__TRYRUN_OUTPUT (advanced)
[14:57:59] For details see /workspace/srcdir/MobilityDB/build/TryRunResults.cmake

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the TRY_RUN statement is not allowed in cross-compile mode:

I know. But I expect that try-run is running a check whether the instruction is available. Which of course could also be done with a simple compiler check instead of a try-run.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just workarounded the error with the instruction CMake gave me (I'm not affiliated with MobilityDB/MEOS so I can't answer the why, but I'm happy to make an upstream issue). AFAIK there's no code in MEOS actually making use of this check (anymore MobilityDB/MobilityDB#610).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use a cross-compilation environment, so any try_run call in a CMake script will basically be pointless. From the CMake docs (https://cmake.org/cmake/help/latest/command/try_run.html#behavior-when-cross-compiling):

When cross compiling, the executable compiled in the first step usually cannot be run on the build host. The try_run command checks the CMAKE_CROSSCOMPILING variable to detect whether CMake is in cross-compiling mode. If that is the case, it will still try to compile the executable, but it will not try to run the executable unless the CMAKE_CROSSCOMPILING_EMULATOR variable is set. Instead it will create cache variables which must be filled by the user or by presetting them in some CMake script file to the values the executable would have produced if it had been run on its actual target platform. These cache entries are:

cmake --build build --parallel ${nproc}
cmake --install build
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_cxxstring_abis(supported_platforms())
filter!(x -> arch(x) != "i686", platforms) # __int128 not supported on i686
filter!(x -> !startswith(arch(x), "armv"), platforms) # __int128 not supported on armv
filter!(!=(Platform("aarch64", "freebsd")), platforms) # Misses most dependencies

# The products that we will ensure are always built
products = [
LibraryProduct("libmeos", :libmeos)
]

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency(PackageSpec(name="GEOS_jll", uuid="d604d12d-fa86-5845-992e-78dc15976526"))
Dependency(PackageSpec(name="JSON_C_jll", uuid="9cdfc4e7-e793-5089-b6f7-569a57a60f0a"))
Dependency(PackageSpec(name="PROJ_jll", uuid="58948b4f-47e0-5654-a9ad-f609743f8632"))
evetion marked this conversation as resolved.
Show resolved Hide resolved
Dependency(PackageSpec(name="GSL_jll", uuid="1b77fbbe-d8ee-58f0-85f9-836ddc23a7a4"); compat="~2.7.2")
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"8")