Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error "undefined reference to `test_helper_c2ptoi'" #29

Closed
msebald opened this issue Jan 17, 2018 · 16 comments
Closed

Compile error "undefined reference to `test_helper_c2ptoi'" #29

msebald opened this issue Jan 17, 2018 · 16 comments

Comments

@msebald
Copy link

msebald commented Jan 17, 2018

Copy-pasted from the old repository: dailab#13

I tried to compile libsml on a fresh Debian 9 Stretch amd64 box. uuid-dev and uuid-runtime is installed. This happens:

make[1]: Entering directory '/home/roi/src/libsml/sml'
make[1]: Nothing to be done for 'libsml'.
make[1]: Leaving directory '/home/roi/src/libsml/sml'
make[1]: Entering directory '/home/roi/src/libsml/examples'
make[1]: 'sml_server' is up to date.
make[1]: Leaving directory '/home/roi/src/libsml/examples'
make[1]: Entering directory '/home/roi/src/libsml/test'
make[2]: Entering directory '/home/roi/src/libsml/sml'
make[2]: Nothing to be done for 'libsml'.
make[2]: Leaving directory '/home/roi/src/libsml/sml'
cc -I../sml/include/ -Wall -luuid unity/unity.o unity/unity_fixture.o src/test_helper.o src/sml_octet_string_test.o src/sml_buffer_test.o src/sml_number_test.o src/sml_boolean_test.o src/sml_value_test.o src/sml_status_test.o src/sml_list_test.o src/sml_time_test.o src/sml_tree_test.o src/sml_file_test.o src/sml_open_request_test.o src/sml_get_profile_pack_request_test.o src/sml_message_test.o ../sml/lib/libsml.a test_main.c -o test
src/test_helper.o: In function `hex2binary':
test_helper.c:(.text+0xa3): undefined reference to `test_helper_c2ptoi'
collect2: error: ld returned 1 exit status
Makefile:33: recipe for target 'test' failed
make[1]: *** [test] Error 1
make[1]: Leaving directory '/home/roi/src/libsml/test'
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 2

Bug or did I do something wrong?

@hmueller01
Copy link

This is strange. test_helper_c2ptoi is defined in test_helper.c itself. Compiles fine on Raspberry and OSX. I have seen a pull on dailab from @tomweber having compile problems too. He removed the inline keyword from test_helper_c2ptoi definition. Can you please try this.

@hmueller01
Copy link

@andig Can reproduce this with Travis CI?

@andig
Copy link

andig commented Jan 19, 2018

Can reproduce this with Travis CI?

No, I can't.

@hmueller01
Copy link

I mean set up a Debian 9 Stretch environment and compile with this.

@msebald
Copy link
Author

msebald commented Jan 19, 2018

@hmueller01 Sorry I did not response until now. Too much to do. I can still test this if you like. Before I start: I am using the version from the old dailab repository. Did you change anything since taking over? It then would make sense to pull your repository first. As I need to modify stuff inside, it is not just pulling the new data.

@hmueller01
Copy link

We changed a lot i the mean time. So on the long run it would make sense to switch over.
Do you have the static inline uint8_t test_helper_c2ptoi() definition in your test/src/test_helper.c or without static? @TheCount changed this in 2013 ...

@andig
Copy link

andig commented Jan 19, 2018

I'm closing this issue as not related to our repo/software. Feel free to reopen after testing.

@andig andig closed this as completed Jan 19, 2018
@msebald
Copy link
Author

msebald commented Jan 19, 2018

It works using this repository. Thank you!

See here and here why and what I modified.

@hmueller01
Copy link

@msebald Why do you need a modification anyway? Is it only to exit after the first message?

@msebald
Copy link
Author

msebald commented Jan 19, 2018

@hmueller01 To be honest, I did not check on the code. ;-) I mean checking what exactly is the difference when replacing the complete transport_receiver function. The main reason is that I am not a coder and second I wanted to follow the instructions from the openHAB community 1 by 1 to get it up and running. ;-)

If it is no longer necessary to alter the code or if it is possible to get the needed output with an commandline option it would be a nice feature for all the people using libsml with openHAB.

@hmueller01
Copy link

@msebald This is why I am asking. What do you/openhab need? If you find that out maybe I can help to implement that and we can have it in the libsml repo. Let me know.

@msebald
Copy link
Author

msebald commented Jan 19, 2018

This is what I get when using the modified version:

[16:32:18] root@openhabian:/home/roi/volkszaehler/libsml/examples# ./sml_server /dev/sml0
1-0:1.8.0*255#20234.615#
1-0:1.8.1*255#20234.615#
1-0:16.7.0*255#1.081#

What is the original output? ;-) I could check, but I am sure that you will know it.

The output is parsed with a openHAB rule, see here.

@hmueller01
Copy link

Sorry, I got no message that you answered. I just saw it right now.
Is this the output of your modified sml_server? Does your "server" exit after reading one "record"?

@msebald
Copy link
Author

msebald commented Jan 23, 2018

Yes, that is the output. And yes, sml_server exits after the output. It is started by openHAB every x seconds, according to how you configured the rule. For me it is every 30 seconds.

@hmueller01
Copy link

Is it a problem if all sml messeges (e.g. like finger print) are in the output. If not, we only need a switch from permanent read to single read, right?

@msebald
Copy link
Author

msebald commented Jan 23, 2018

Yes, maybe. I am just a user and a very bad programmer. Did you have a chance to check what is changed for our use case with openHAB?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants