elixir-cldr / cldr_collation

CLDR Collation
Other
4 stars 3 forks source link

Build issue in Darwin devenv container #14

Closed serpent213 closed 5 days ago

serpent213 commented 6 days ago

Running Elixir via devenv on macOS. The dev container provides clang and the ICU library. Compilation error:

clang c_src/ucol.o -arch arm64 -flat_namespace -undefined suppress -shared -L/nix/store/q710sr5330qn5qajlm3smwsck56rah54-erlang-25.3.2.10/lib/erlang/usr/lib -lei -lpthread -lm -licucore -lstdc++ -o ./priv/ucol.so
ld: library not found for -licucore
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

If I understand correctly, this is caused by the Makefile:

ifeq ($(UNAME_SYS), Darwin)
    ICU_CFLAGS = -I$(BASEDIR)/c_src/platform/osx/icu
    ICU_LIBS = -lpthread -lm -licucore -lstdc++
else
    ICU_CFLAGS = $(shell pkg-config --cflags icu-uc icu-io)
    ICU_LIBS = $(shell pkg-config --libs icu-uc icu-io)
endif

...making assumptions that do not apply to my setup.

Might it be a way to run pkg-config first and check for Darwin in case that fails?

kipcole9 commented 5 days ago

Thanks for the report. I don' have any nix related components installed. However I did refactor the Makefile along the lines you suggested. Would you mind trying the version from GitHub main branch? ie {:ex_cldr_collation, github: "elixir-cldr", branch: "main"} and let me know if that works for you?

serpent213 commented 5 days ago

Thank you for the quick fix!

Yes, compilation runs flawlessly now, tested as well with the same devenv on x86_64-linux. 🙂

kipcole9 commented 4 days ago

I've published ex_cldr_collation version 0.7.4 with the following changelog entry:

Bug fixes

Thanks again for the collaboration.