rabbitmq / lz4-erlang

LZ4 compression library for Erlang.
Other
19 stars 8 forks source link

Rebar3 compatibility #10

Closed silviucpp closed 3 years ago

silviucpp commented 3 years ago

Hello,

I have a project with rebar3 and this lib as dep.

when i try to do rebar3 upgrade lz4 I receive:

===> Dependency failure: source for lz4 does not contain a recognizable project and can not be built

This happens starting with revision "851d9801e97b43f0c3473b91547988f21bc9d380" older one works just fine

Silviu

michaelklishin commented 3 years ago

This library is consumed by an erlang.mk-based build system and erlang.mk will automatically convert (generate an app file) for its dependencies. Rebar3 compatibility would be nice to have.

@dumbbell https://github.com/rabbitmq/lz4-erlang/commit/851d9801e97b43f0c3473b91547988f21bc9d380 does not explain why the .app file was removed. Should we add a source file for Rebar users?

essen commented 3 years ago

The .app file was what's needed for compatibility. :-)

silviucpp commented 3 years ago

I see previously the lz4.app was in ebin. I think the correct path will be in the src instead.

essen commented 3 years ago

No you're confusing with .app.src, the .app must be in ebin.

silviucpp commented 3 years ago

@essen having .app.src insead of the .app is not enough for rebar compatibility ?

essen commented 3 years ago

If we use a .app.src we have to maintain deps (and more) in two places, and we don't want to do that. We want Erlang.mk to generate everything from the Makefile, and we can commit the .app that was generated so that Rebar doesn't complain. I'm not sure why it was removed.

silviucpp commented 3 years ago

I reverted that commit but still fails for some reason:

src/lz4_nif.erl:28: can't find include lib "host_triple/include/code_loading.hrl"; Make sure host_triple is in your app file's 'applications' list src/lz4_nif.erl:32: undefined macro 'load_nif_from_host_triple_dir/3'

lukebakken commented 3 years ago

@silviucpp if you could provide a repository we can clone to reproduce what you report it would speed up diagnosis a lot. Thanks.

silviucpp commented 3 years ago

@lukebakken

git clone https://github.com/rabbitmq/lz4-erlang.git
cd lz4-erlang     
git checkout lz4-erlang-10 
rebar3 compile      

Fails with:

===> Compiling src/lz4_nif.erl failed
src/lz4_nif.erl:28: can't find include lib "host_triple/include/code_loading.hrl"; Make sure host_triple is in your app file's 'applications' list
src/lz4_nif.erl:32: undefined macro 'load_nif_from_host_triple_dir/3'
src/lz4_nif.erl:30: function on_load/0 undefined
rebar3 -v
rebar 3.14.1 on Erlang/OTP 23 Erts 11.1.1

Also please not the app is not building on OSX Catalina with Xcode 12 because of https://github.com/ninenines/nif_helpers/issues/2

An workaround is to change into Makefile the CFLAGS line with :

CFLAGS += -I $(DEPS_DIR)/lz4_src/lib -Wno-implicit-function-declaration
michaelklishin commented 3 years ago

@silviucpp let's stick to one problem at a time. The library does build for me on Catalina and Big Sur with XCode 12 (I run gmake), although there is a couple of "argument unused" warnings from Clang.

michaelklishin commented 3 years ago

Actually, after merging #11 and cleaning I do see the implicit function declaration compilation failure. However, that and the host_triple dependency are not related to the .app file removal.

essen commented 3 years ago

For host_triple it needs to be added to rebar.config (I would suggest make rebar.config to generate it, but I see there's already one with custom commands so you'll most likely need to add it manually.)

michaelklishin commented 3 years ago

Done in master.

rebar3 clean; rebar3 compile

now succeeds for me on both Catalina and Big Sur.

silviucpp commented 3 years ago

@essen the https://github.com/rabbitmq/lz4-erlang/commit/18a1ff83e4c3b27ab1f3ffe7829ce478757a8b27 don't you think should be added into the host_triple makefile ? to be inherited by all projects that is using this lib ?

essen commented 3 years ago

It should be added to Erlang.mk.