mikejm

mikejm

I have been able to add a number of packages to my testserver project with no issues. I would like to also add the H3 package here:

However, when I add that to my dependencies and run iex -S mix phx.server or mix deps.compile h3 I get:

CMake Deprecation Warning at CMakeLists.txt:4 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19044.
CMake Error at cmake/ASan.cmake:8 (set_property):
  set_property could not find CACHE variable CMAKE_BUILD_TYPE.  Perhaps it
  has not yet been created.
Call Stack (most recent call first):
  CMakeLists.txt:10 (include)


-- Configuring incomplete, errors occurred!
===> Hook for compile failed!

** (Mix) Could not compile dependency :h3, "escript.exe "c:/Users/Mike/.mix/elixir/1-14/rebar3" bare compile --paths h:/filePath/testserver/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile h3", update it with "mix deps.update h3" or clean it with "mix deps.clean h3"

I have confirmed c:/Users/Mike/.mix/elixir/1-14/rebar3 does in fact exist.

Is there any obvious way to fix this? Or to figure out more precisely the issue? The package is from 2020, so maybe there is just something inside it I might need to update?

Thanks for any help.

Showing Posts 7 to 1

dimitarvp

dimitarvp

It has been a very long time since I last dealt with C/C++ and CMake so I can’t help you, I am afraid. Even if I wanted to, it would take time, time that I don’t have much of.

I’d again advise you to just go with the Rust dependency, it’s much easier and transparent to work with Rust + the Elixir<=>Rust bridge called rustler.

I and others can help you with it, but if you really want help with the C/++ and CMake problems then I am not your guy. :zipper_mouth_face:

mikejm

mikejm OP

Hey @dimitarvp. I tried building the erlang h3 version here by downloading it, going in the folder and running “make” but I got the same error as the Hex H3 (likely the same build then):

./rebar3 compile
===> Verifying dependencies...
-- Building for: Visual Studio 17 2022
CMake Deprecation Warning at CMakeLists.txt:4 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.38.33130.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at cmake/ASan.cmake:8 (set_property):
  set_property could not find CACHE variable CMAKE_BUILD_TYPE.  Perhaps it
  has not yet been created.
Call Stack (most recent call first):
  CMakeLists.txt:10 (include)


-- Found Erlang: c:/Program Files/Erlang OTP/erts-13.1.2/include
-- Found Git: C:/Program Files/Git/mingw64/bin/git.exe (found version "2.38.1.windows.1")
fatal: not a git repository (or any of the parent directories): .git
CMake Warning at cmake/FindH3.cmake:21 (message):
  could not get erlang-h3 tag, falling back on hard-coded version
Call Stack (most recent call first):
  CMakeLists.txt:92 (find_package)


-- Using upstream h3 tag v3.6.4 based on local tag v3.6.4
-- Configuring incomplete, errors occurred!
===> Hook for compile failed!

make: *** [Makefile:6: compile] Error 1

In terms of the problems, to break this down, it seems only #2 is a true error but to review it all:

1) Deprecation warning

This comes from the line in CMakeLists.txt:

cmake_minimum_required(VERSION 3.3)

Presumably, I can just increase this to 3.5. I did that and the deprecation warning resolved without new issues.

2) Asan.cmake Error

This file Asan.cmake contains only the following, with line 8 being the last one that is throwing the error that seems to be breaking the build:

# This file provides a custom build type, `CMAKE_BUILD_TYPE_ASAN`

set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fsanitize=address -fno-omit-frame-pointer -fno-common" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_ASAN "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fsanitize=address -fno-omit-frame-pointer -fno-common" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_ASAN "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -fsanitize=address" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_ASAN "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} -fsanitize=address" CACHE STRING "" FORCE)

set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "ASan")

There is obviously a problem with this set_property line. Any idea what it is or how to fix it?

CMakeLists.txt line 10 is the last here:

cmake_minimum_required(VERSION 3.5)
project(ErlangH3 C)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_C_STANDARD 99)

list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake)
include(ASan)

3) .git Message

I am not sure if this is meaningful? I am not sure what it is trying to say.

4) Could not get erlang-h3 tag

This derives from FindH3.cmake:

# Use this repo's semantic version as the tag to fetch from up
# upstream uber/h3
find_package(Git REQUIRED)
execute_process(COMMAND
  ${GIT_EXECUTABLE} describe --tags
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  RESULT_VARIABLE GIT_SUCCESS
  OUTPUT_VARIABLE ERLANG_H3_TAG
  )
if(NOT GIT_SUCCESS EQUAL "0")
  message(WARNING "could not get erlang-h3 tag, falling back on hard-coded version")
  set(ERLANG_H3_TAG "v3.6.4")
endif()
string(REGEX REPLACE "\n$" "" ERLANG_H3_TAG "${ERLANG_H3_TAG}")
string(REGEX MATCH "^v[0-9]+\.[0-9]+\.[0-9]+" UPSTREAM_H3_GIT_TAG "${ERLANG_H3_TAG}")
message(STATUS "Using upstream h3 tag ${UPSTREAM_H3_GIT_TAG} based on local tag ${ERLANG_H3_TAG}")

Again is there any likely significance to this?

Any thoughts or ideas on how to solve #2 in particular which is what seems to be breaking it? Thanks.

mikejm

mikejm OP

I find it absolutely hilarious (in a good way) that this forum is the complete 100% antithesis of StackOverflow. :joy::clinking_beer_mugs:

I am so used to just not asking programming questions of any kind and suffering in silence to figure things out because there is no point even asking anything on StackOverflow these days. GitHub discussion pages are usually dead. Rarely, if you can find a Discord server for a particular niche that can be good.

Anyway, thanks for being nice and helpful. Even small answers like, “It’s probably going to be a mess trying to fix that thing,” can save a person a lot of wasted time.

dimitarvp

dimitarvp

Oh, only one of them is actually a direct translation without the underlying C/C++ dependency: GitHub - HydroniumLabs/h3o: Rust implementation of the H3 geospatial indexing system. · GitHub

Then I’d start there.

dimitarvp

dimitarvp

Hope you make the alternative work.

Looking at Bindings | H3, I’d just choose one of the Rust libraries and then use rustler to bind to it. Should be a much smoother ride with less surprises.

As for paying people, sure. Maybe there will be takers for a C/C++ project managed by cmake but again, I’d put my chips on Rust if I were you.

mikejm

mikejm OP

@dimitarvp H3 is Uber’s hexagonal global spatialization library which they made open source:

https://www.uber.com/en-CA/blog/h3/

https://github.com/uber/h3

People have adapted it into many languages. There are easily available working C# versions I have tested and it was formally released with JavaScript support. At some point soon I will need a working Elixir implementation.

If you think I might have to do it myself, any pointers for someone who knows virtually nothing about coding Elixir? :joy: Maybe I will have to pay someone to fix it? I dunno.

Edit: I just looked again and there is another version here: GitHub - helium/erlang-h3: Erlang binding for Uber's H3 spatial coordinate library · GitHub I will try to build that from the instructions there. Thanks.

dimitarvp

dimitarvp

If the library hasn’t been updated in a while and it has native dependencies + even deprecation warnings then your chances are not good I am afraid.

What does h3 do? A quick glance didn’t give me an answer. It is an option to replace it I’d reckon.

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
bradley
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
Alvinkariuki
How Can I Optimise Compile Time Dependencies I have been building an elixir application for about 2 years now. Many modules and files ha...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews