atomicobject / heatshrink

data compression library for embedded/real-time systems
ISC License
1.31k stars 176 forks source link

Compiling for ESP8266 fails #47

Closed dominikfehr closed 6 years ago

dominikfehr commented 6 years ago

Hey,

I've just tried to use the library on a ESP8266 platform. Sadly there are several errors displayed in heatshrink.c:

Error GCC invalid conversion from 'void' to 'io_handle' [-fpermissive] 121:37 Error GCC 'heatshrink_encoder_alloc' was not declared in this scope 282:86 Error GCC 'heatshrink_encoder_free' was not declared in this scope 305:32 Error GCC 'heatshrink_decoder_alloc' was not declared in this scope 352:39 Error GCC 'heatshrink_decoder_free' was not declared in this scope 382:32

Any help is appreciated :)

dominikfehr commented 6 years ago

first may be fixed as:

from: io = malloc(sizeof(*io) + buf_sz); to: io = (io_handle*)malloc(sizeof(*io) + buf_sz);

silentbicycle commented 6 years ago

heatshrink.c is a command line program for working with heatshrink-compressed data. You probably won't need to compile it for your ESP8266 at all -- it probably just needs the encoder and/or decoder files. Does everything else compile without issue?

heatshrink.c would be used to pack data before loading it onto your system, to unpack compressed data you've extracted, or to test which settings make the best trade-off for compressing representative data.

dominikfehr commented 6 years ago

right. removed heatshrink.c from project, tho still some undefined references but the encoder and decoder header files are included:

.pioenvs\nodemcuv2\src\main.o:(.text._Z17heatshrink_encodePhjPFvhE+0x20): undefined reference to `heatshrink_encoder_poll(heatshrink_encoder*, unsigned char*, unsigned int, un

signed int*)'
.pioenvs\nodemcuv2\src\main.o: In function `heatshrink_encode(unsigned char*, unsigned int, void (*)(unsigned char))':
main.cpp:(.text._Z17heatshrink_encodePhjPFvhE+0x4a): undefined reference to `heatshrink_encoder_reset(heatshrink_encoder*)'
main.cpp:(.text._Z17heatshrink_encodePhjPFvhE+0x6b): undefined reference to `heatshrink_encoder_sink(heatshrink_encoder*, unsigned char*, unsigned int, unsigned int*)'
main.cpp:(.text._Z17heatshrink_encodePhjPFvhE+0x8e): undefined reference to `heatshrink_encoder_finish(heatshrink_encoder*)'
main.cpp:(.text._Z17heatshrink_encodePhjPFvhE+0xa3): undefined reference to `heatshrink_encoder_poll(heatshrink_encoder*, unsigned char*, unsigned int, unsigned int*)'
main.cpp:(.text._Z17heatshrink_encodePhjPFvhE+0x10e): undefined reference to `heatshrink_encoder_finish(heatshrink_encoder*)'
collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\nodemcuv2\firmware.elf] Error 1
silentbicycle commented 6 years ago

Are you sure heatshrink_encoder.o is being linked? Those undefined references are all the non-static functions it defines.

dominikfehr commented 6 years ago

OK, seems to be a problem with the build environment, thanks.