chalk icon indicating copy to clipboard operation
chalk copied to clipboard

build: `make debug` doesn't produce a debug build

Open ee7 opened this issue 1 year ago • 2 comments

The README.md for the pytest-based testing says that make debug is the way to produce a debug build of chalk:

https://github.com/crashappsec/chalk/blob/ca217bd77211a0a6125840fd9167e3f76340738b/tests/functional/README.md#L47-L55

but that doesn't seem to work:

$ git clone --depth 1 https://github.com/crashappsec/chalk /tmp/chalk
$ cd /tmp/chalk
$ git log -1 --oneline
ca217bd (grafted, HEAD -> main, origin/main, origin/HEAD) test(fd_cache): make tests self-contained, and enable in CI (#276)
$ make debug
rm -f chalk chalk.bck
make chalk
make[1]: Entering directory '/tmp/chalk'
cp CHANGELOG.md src/docs/CHANGELOG.md
docker compose run --rm  chalk nimble -y build
[...]
+ strip chalk
+ ./chalk --debug --no-use-external-config --skip-command-report load default
[...]
make[1]: Leaving directory '/tmp/chalk'
$ file chalk
chalk: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

The fact that strip runs above shows that -d:debug isn't passed to nimble build:

https://github.com/crashappsec/chalk/blob/46ffecdfff56832ad6da0e63b205c4e2b4a4f576/chalk.nimble#L78-L81

In the Makefile:

https://github.com/crashappsec/chalk/blob/ca217bd77211a0a6125840fd9167e3f76340738b/Makefile#L47-L52

ee7 avatar May 06 '24 16:05 ee7

fixed in 5b825df (#286)

miki725 avatar May 06 '24 16:05 miki725

Thanks. That does cause make debug to pass --define:debug to the build command, with the output containing:

docker compose run --rm  chalk nimble -y build --define:debug

However, strip still runs. Unfortunately, it turns out that nimble still doesn't support checking a custom define in the nimble file (see upstream ticket).

I'll fix that. Edit: created PR https://github.com/crashappsec/chalk/pull/289

ee7 avatar May 06 '24 17:05 ee7