Including lager in an erlang.mk project

1.3k Views Asked by At

I'm trying to add lager to a simple erlang.mk project. I understand lager uses parse transforms, so you have to set compile flags accordingly; so following advice from here:

Lager calls failing during Common Test test runs

my Makefile looks as follows:

PROJECT = hello_erlang_mk
DEPS = cowboy lager

# this must be first
include erlang.mk

# Compile flags
ERLC_COMPILE_OPTS= +'{parse_transform, lager_transform}'

# Append these settings
ERLC_OPTS += $(ERLC_COMPILE_OPTS)
TEST_ERLC_OPTS += $(ERLC_COMPILE_OPTS)

The release builds fine but somehow lager never seems to be included:

Eshell V5.10.4  (abort with ^G)
([email protected])1> lager:info("~s is ~s!", [lager, cool]).
** exception error: undefined function lager:info/2

Anyone have any pointers on how to get lager working within an erlang.mk project ?

[I'm using Erlang R16B03, Ubuntu 14.04]

Thanks.

2

There are 2 best solutions below

0
On BEST ANSWER

Forgive me. Noob error. application:start(lager). Sorry.

0
On

I believe there is nothing to do with erlang.mk. The problem is -- you try to call lager:info from the shell. But actually there is no such function in the lager module. lager:info is just a command for parse transform that is unfolded to some other (more complex) constructions during compilation time.

If you want to check if you application contains lager, you can try from shell lager:status() for example (which is 'honest' function in the lager module). Or lager:module_info().