lvzon / dsmr-p1-parser

Ragel-based C-parser for Dutch Smart Meter P1-data (and similar IEC 62056-21 telegrams)
Apache License 2.0
42 stars 12 forks source link

Make.sh shows errors #1

Open adewilt8 opened 5 years ago

adewilt8 commented 5 years ago

Hi there,

I bought a P1 cable at sos solutions and was able to read messages using a PiZero using cu. I tried your solution, made sure to install ragel and build-essentials first, cloned the github but then when running make.sh I get the following error:

pi@ZeroW-Black:~/dsmr-p1-parser $ ./make.sh fsm name : parser num states: 576

p1-parser.c:996:18: warning: ‘parser_en_main’ defined but not used [-Wunused-const-variable=] static const int parser_en_main = 574; ^~~~~~ p1-parser.c:995:18: warning: ‘parser_en_rest_of_line’ defined but not used [-Wunused-const-variable=] static const int parser_en_rest_of_line = 572; ^~~~~~ crc16.c: In function ‘crc16’: crc16.c:31:13: warning: unused variable ‘x’ [-Wunused-variable] uint8_t x; ^ p1-parser.c:996:18: warning: ‘parser_en_main’ defined but not used [-Wunused-const-variable=] static const int parser_en_main = 574; ^~~~~~ p1-parser.c:995:18: warning: ‘parser_en_rest_of_line’ defined but not used [-Wunused-const-variable=] static const int parser_en_rest_of_line = 572; ^~~~~~ crc16.c: In function ‘crc16’: crc16.c:31:13: warning: unused variable ‘x’ [-Wunused-variable] uint8_t x; ^

Any idea how I can continue?

Kr,

Andreas

InvertedMinor commented 4 years ago

@lvzon could you please help?

lvzon commented 4 years ago

These are merely compiler warnings, it looks like the application does compile. Does the script create an executable file called p1-test-p1?

InvertedMinor commented 4 years ago

yep

lvzon commented 4 years ago

Well then the program should work. :-) Do note that it's just a test-application though... (This code is mostly meant as a basis for writing your own lightweight applications for reading smart meters in C.)

hansaplasst commented 2 years ago

I'm compiling for FreeBSD. Compiler gets stuck at: /usr/local/bin/ld: /tmp//ccKzaaHF.o:/home/user/dev/dsmr-p1-parser/logmsg.h:30: multiple definition of "logger"; /tmp//ccaIiEle.o:/home/user/dev/dsmr-p1-parser/logmsg.h:30: first defined here /usr/local/bin/ld: /tmp//ccX1wzik.o:/home/user/dev/dsmr-p1-parser/logmsg.h:30: multiple definition of "logger"; /tmp//ccaIiEle.o:/home/user/dev/dsmr-p1-parser/logmsg.h:30: first defined here collect2: error: ld returned 1 exit status

hansaplasst commented 2 years ago

I'm compiling for FreeBSD. Compiler gets stuck at: ...

Adding -z muldefs to the gcc compiler options in make.sh seems to do the trick. I hope this is the correct way to go ;-)