silviucpp / erlkaf

Erlang kafka driver based on librdkafka
MIT License
83 stars 41 forks source link

Fix compilation error under elixir 1.13 #43

Closed escobera closed 2 years ago

escobera commented 2 years ago

fixes #42

escobera commented 2 years ago

@silviucpp this is my first time dealing with makefiles, don't know if this is enough, specially on the pure erlang side of things. Try and give it a spin before merging please. Any feedback is greatly welcome!

silviucpp commented 2 years ago

@escobera I tested on erlang and all it's ok. with this fix also elixir it's working ?

escobera commented 2 years ago

Oh noes! This isn't good enough :cry: Hmm, my tests are failing at CI.

/builds/prospeccao/antecedentes/deps/erlkaf
make[1]: Entering directory '/builds/prospeccao/antecedentes/deps/erlkaf/c_src'
 CPP    erlkaf_config.cc
 CPP    erlkaf_consumer.cc
 CPP    erlkaf_logger.cc
 CPP    erlkaf_message.cc
 CPP    erlkaf_nif.cc
 CPP    erlkaf_producer.cc
 CPP    nif_utils.cc
 CPP    queuecallbacksdispatcher.cc
 CPP    queuemanager.cc
 CPP    topicmanager.cc
 LD     erlkaf_nif.so
/usr/bin/ld: cannot open output file /builds/prospeccao/antecedentes/_build/test/lib/erlkaf/priv/erlkaf_nif.so: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [nif.mk:78: /builds/prospeccao/antecedentes/_build/test/lib/erlkaf/priv/erlkaf_nif.so] Error 1
make[1]: Leaving directory '/builds/prospeccao/antecedentes/deps/erlkaf/c_src'
make: *** [Makefile:7: compile_nif] Error 2
===> Hook for compile failed!

Locally it did work. =/

@silviucpp there's prolly more work to be done at the makefile to make it work properly, I'll poke around a little more.

silviucpp commented 2 years ago

I guess /builds/prospeccao/antecedentes/_build/test/lib/erlkaf/priv/erlkaf_nif.so does not exists. can you search where was generated instead ?

escobera commented 2 years ago

I guess /builds/prospeccao/antecedentes/_build/test/lib/erlkaf/priv/erlkaf_nif.so does not exists. can you search where was generated instead ?

I'm pokin around our CI here to check what's going on. Will report once I have that info.

escobera commented 2 years ago

@silviucpp .so file is not generated, maybe it is a race condition of sorts?

I wasn't creating the /priv dir in the new location, so it wasn't being able to LD the file. Now I think it is doing the right thing

silviucpp commented 2 years ago

Hmm basically ld reports that cannot open the location: /usr/bin/ld: cannot open output file /builds/prospeccao/antecedentes/_build/test/lib/erlkaf/priv/. Does this path exists ?

escobera commented 2 years ago

Tested on my application here and it is building correctly now! :partying_face:

silviucpp commented 2 years ago

Can you test by replacing with the attached file. I did some cleanups . in my opinion looks better. What I did was to insert a new var named PRIV_DIR and set it based on REBAR_BARE_COMPILER_OUTPUT_DIR .

Just to avoid setting the priv dir location into multiple places inside the make file. Please review and commit and see if it's working. on erlang works

https://www.dropbox.com/s/fmmf306x31hfcwa/nif.mk?dl=1

escobera commented 2 years ago

Yeah, your version definitely looks better. It works on my test case and app. Thanks for the feedback!