Maybe a Linux build problem - redefinition errors

Status
Not open for further replies.

bboyes

Well-known member
In the effort to get a Linux dev system (Ubuntu 17.04, Unity/gnome desktop) going I'm getting a lot of redefinition errors when I try to build programs which build fine in the same version of Arduino and Teensyduino, with same source code and library files.

@PaulStoffregen or other Linux gurus please see this ic2_t2 issue which seems to want to force in Wire library when I don't want to use it at all, causing clashes with i2c_t3. Happens in Arduino 1.8.2/TD1.36 and Arduino 1.8.4/TD1.39. This does not happen on Windows.
 
Maybe hard to say, without knowing more on which libraries you are including. Also check that you don't have any private versions of these libraries installed on one or the other system.
That is in the <Arduino sketch folder>/libraries
 
I do have private libraries, see the compiler output at the link. This is so I can control the version in use and in the case of some such as Ethernet2 I have forked them to add essential features. Those are all pulled from github and so all that code *should be* identical on the Windows and Linux systems.
 
Sorry not much help... Hopefully others will have some other suggestions.

If it were me, I would probably go back to my Windows machine, rename your <arduino sketch folder> to something else. Try to download the exact stuff you have on the Linux machine and try building, to see if it still compiles or run into same issue.

Or I would try to do something logically like copy all of your Windows files from your sketch folder to your Linux machine (different folder) and then use a source compare program like meld to see if you see any logical differences.

Hopefully nothing subtle differences like you have a file looking for wire.h but the one installed by Teensy maybe is Wire.h... Linux files are case sensitive.
 
First, with a quick look I can see Documents/code/Arduino/libraries/i2c_t3/i2c_t3.h, which looks like you have custom copy of i2c_t3.h installed in your Document folder. Please try using only the i2c_t3 that Teensyduino installs.

@PaulStoffregen or other Linux gurus please see this ic2_t2 issue which seems to want to force in Wire library when I don't want to use it at all, causing clashes with i2c_t3. Happens in Arduino 1.8.2/TD1.36 and Arduino 1.8.4/TD1.39. This does not happen on Windows.

Just to be perfectly clear, I WILL NOT LOOK AT THIS unless you post the complete source code to reproduce the problem. The error messages and description of the problem is NOT ENOUGH, no matter how clear and simple it may seem. Even if the code seems trivial, you must post a complete program that I copy into Arduino to reproduce the problem. Or if one of the library's examples will do, it's ok to just be specific about which example to use. Of course, the smallest & simplest program which reproduces the problem is best. Please don't post a giant program, especially one that brings in a ton of other libs, unless that is absolutely the only way to reproduce the issue.

If you have posted the code, please point me to it. I scrolled up that page and saw no files attached and no messages with code to copy & paste into Arduino. I didn't look back through the 23 prior pages. If it's on one of those, please point me to the exact message.
 
However, without seeing your code, I'll make a very blind guess.

Maybe your program is bringing in some library, which in turn is using Wire instead of i2c_t3. Modern versions of Arduino try to discover when libraries depend on other libs, even if not included in your main code.

The big difference between Windows and Linux is case sensitivity of filenames. Maybe somewhere there's an include with the wrong case, such that it matches one thing on Windows and another on Linux. This is blind guess afterall....

If that doesn't help, post a complete program. I do investigate problems, but only when complete code is posted. I'm not going to try guessing (more than I have in this message) what code might cause this. You have that code. Post it in your next message.
 
OK thanks... I understand. Yes I have forked i2c_t3 in order to add a couple of important features... I did issue a pull request a while ago. For now I need to use the fork. We turn on auto recovery and log when it gets used, is part of the reason. Anyway... the program pulls in multiple custom libraries, so including all the source code would be a chore. It is part of a big complex project. I can see what #include triggers the problem and I wonder if the #include order somehow matters on Linux but not Windows. I'll dig into this more. Thanks for thinking about it. I posted here since perhaps there might have been some "Oh, on Linux you need to be aware of X" and that would be the answer. Ah, well. Not so simple.

Next step will be to try to get a look at the whole preprocessed file and/or the object file and see where Wire is getting pulled in. It's really odd that Windows and Linux seem to have such different outcome. I don't see any evidence that it is a case sensitivity issue.
 
Last edited:
OK thanks... I understand. Yes I have forked i2c_t3 in order to add a couple of important features... I did issue a pull request a while ago. For now I need to use the fork.

Just FYI - I'm going to be working on a significant update soon, and I'll try to add this in (but it will probably be a more generic error logging as discussed a long time ago - when it gets closer I might discuss form in i2c_t3 thread). I'm going to add in a few other requested things, so it might take some time (mostly because the changes are deep and need a lot of regression testing).

On this topic my first thought was similar to Paul, in that it might be a lib pulling in Wire - but you said it was the same code as Windows, so it shouldn't be happening. I did have a thought there - it might be a Wire include which is bracketed by some ifdef condition that for whatever reason is different in the Linux env. Maybe grep your source for all the Wire.h includes and prefix them with a #warning to see if any dump at compile.
 
Status
Not open for further replies.
Back
Top