Cloud Compile - Can-Utils
I'm an experienced electrical engineer, but definitely light when it comes to coding. I can do some Python, but haven't delved into C++ in years (or similar, where actual compiling takes place).
I want to use Can-Utils on my Omega:
But it appears that I'll either need to Cloud Compile or setup a cross-compilation environment.
I tried cross-compilation, but I hit a brick wall on my other Linux box with errors that seem like quite a bit to dive into.
As an alternative, it seems like Cloud Compile is perfect for me. With that said, I'm starting at zero for exactly how to take what is in the link above for Can-Utils, and package it CORRECTLY for Cloud Compile to do it's job for me.
Anyone able to lend a suggestion or two my way. I am willing to read material on this, but am having a hard time determining what to search for.
Made a little more progress over the weekend.
I went into the zip file from GitHub and stripped it of any and all non- C and H files, and evaluated the content of any files I was taking away. They all appeared to be 'harmless' to remove, such as the existing makefile which would be ignored anyway, and some readmes with little content, or one auto-config script file that I can always manually execute or add back in.
I do kind of get stuck at the same point though. I upload everything to cloud compile, it attempts to compile, and I'm faced with a wall of errors that appear to be:
- Mostly references to "multiple definition of ___"
- "first defined here"
and then finally:
- collect2: error: ld returned 1 exit status
- make: *** [bin/cloud-compile-target] Error 1
Can someone bridge the gap for me and let me know how to approach solving my errors? Am I attempting to use Cloud Compile in the correct way?
Lazar Demin administrators last edited by
I think you're definitely using Cloud Compile the correct way, it just looks like there's some issues with the code you're compiling!
Usually the 'multiple definitions of ___' error is due to a variable being initialized in a header file. If this header file is included in multiple source files, then it will actually create multiple definitions of the variable. Check out this StackOverflow thread for more info.
Also, for best practises, make sure you're using include guards.
Thanks much this has me a little more on track.
I looked over the header files, and almost every one appears to already have guards in place. BTW, this is proving a good lesson in the concept for me
For good measure, and after reading the articles, I also put #pragma once at the top of all header files just in case.
Unfortunately no luck. Looks like my errors are coming from the C files and not the headers. For example:
build/can-utils-master-edit/slcan_attach.o: In function
main': slcan_attach.c:(.text.startup+0x1): multiple definition ofmain'
build/can-utils-master-edit/bcmserver.o:bcmserver.c:(.text.startup+0x1): first defined here
Is placing guards in C file ALSO advised?