zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.44k stars 6.4k forks source link

Error : undefined reference when using a function from 'lz4frame.h'. #73262

Open bubilili opened 3 months ago

bubilili commented 3 months ago

Describe the bug

I am developing a Zephyr project for an STM32 H747BIT6. I'm trying to use LZ4 frame for message compression. So I added #include "lz4frame.h" to a source cpp file and then tried to use 'LZ4F_compressFrameBound(input_size, NULL)'. As in the code snippet below..

`std::vector LZ4MessageCompression::compress_frame(const std::string &input) { LOG_INF("compress input: %s", input.c_str());

/* Cal input size for mem allocation */
const size_t input_size = input.size();
    const int dst_size = LZ4F_compressFrameBound(input_size, NULL);

} When I compiled the project I got this errorundefined reference to LZ4F_compressFrameBound'

The prj.conf contains CONFIG_LZ4=y I was able to use LZ4_compressBound with lz4.hincluded.

Environment

github-actions[bot] commented 3 months ago

Hi @bubilili! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

github-actions[bot] commented 1 month ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

parthitce commented 1 month ago

@bubilili not sure if you are still looking to work with lz4 for the mentioned usecase. If so, I have tried adding the needed files and compiled the lz4 frametest sample in zephyr.

I can add the support officially into zephyr samples once https://github.com/zephyrproject-rtos/zephyr/pull/76184 is merged.

changes are here: https://github.com/zephyrproject-rtos/zephyr/compare/main...linumiz:zephyr:fix/zephyr/73262