Compiling with make on GNU/Linux - strange error when using addons

I have developed using QT Creator and can run and make both examples and my own projects. I am running on Debian 11 Testing.

Now I am trying to compile my own code using just make, including two addons (from my DStudio project.

So I added an addons.make in the project folder with the names of the two addons, one on each line.

I get this strange error message, which to me looks like something is confusing source files with compiled ones?

(...)
oprogramming/of/apps/myApps/ofDStudioDemo8Permutate/src/main.cpp
In file included from /usr/include/boost/filesystem/path_traits.hpp:29,
                 from /usr/include/boost/filesystem/path.hpp:26,
                 from /usr/include/boost/filesystem.hpp:16,
                 from /home/staffan/Documents/projects/tech/audioprogramming/of/libs/openFrameworks/utils/ofFileUtils.h:20,
                 from /home/staffan/Documents/projects/tech/audioprogramming/of/libs/openFrameworks/ofMain.h:7,
                 from /home/staffan/Documents/projects/tech/audioprogramming/of/apps/myApps/ofDStudioDemo8Permutate/src/main.cpp:1:
/./bin/locale:1:1: error: stray ‘\177’ in program
    1 | ELF          >    I      @       ��          @ 8   @         @       @       @       �      �                                                                                       `6      `6                    @       @       @       <       <                    �       �       �      p      p                   ��      ��      ��      �$      h%                   ȭ      Ƚ      Ƚ      �      �                  8      8      8                                  X      X      X      D       D              S�td   8      8      8                            P�td   d�      d�      d�      �      �             Q�td                                                  R�td   ��      ��      ��      p      p             /lib64/ld-linux-x86-64.so.2              GNU � �     

Does anyone have a clue as to what is going on?

i am using the standard Makefile and I have nothing setup in the config.make.

EDIT:
In

/usr/include/boost/filesystem/path_traits.hpp

is the line

#include <locale>

so I guess the make system or compiler (?) somehow gets confused and includes the “locale” bin file. But why does it do this only when I have an addons.make?

EDIT: Originally posted this question for developing on a Rock Pi 4 via SSH, but now I discoevered that I have the same problem on my Debian laptop.

This is possibly an issue of accidentally copying weird invisible characters in your code, when you paste something that you find in the internet.

there → /./bin/locale:1:1: error: stray ‘\177’ in program
this means, that there was an unexpected character \177. Since it’s invisible you wouldn’t see it.

check these:
won’t work
will work

As you see it’s pretty tricky, the code looks exactly the same, but one of them works the other one doesn’t.
I generated the different lines like that:

#include <iostream>

int main()
{
    std::cout << "std::cout \177<< \"this won't work\";" << std::endl;
    std::cout << "std::cout << \"this will work\";" << std::endl;
}

Output:

std::cout << "this won't work";
std::cout << "this will work";

try copying each line in your code and you will see that the first one will probably successfully break it :slight_smile:

You should probably hunt for \177 in the addons you’re trying to use.

1 Like

Thank you for your extensive and very clear answer!

Though, I don’t think that is the problem.

is a binary file, that is somehow in error included from /usr/include/boost/filesystem/path_traits.hpp, line 29, if I understand the g++ output correctly. And that is a system file. Furthermore, the following ELF characters suggests it is a binary file.

And it all works completely fine, ie i can build it, using QT Creator, without any errors.

Well, to be sure i looked for anything non-printable with grep but could not find anything.

Right now I am checking compiler flags, which differ between the QT Creator environment and the standard make system.

Hmmm, here is the cause of the error. This is one of the -I sent to g++
-I/./bin
so it prefers to include the /./bin/locale binary (but why /./?)

I use the standard make files and I must admit that I’m really bad at understanding this stuff…

I have two addons listed in addons.make, ofxDStudio and ofxDaisysP.

I can see that this is sent to the compiler (excerpt):

-I/home/staffan/Documents/projects/tech/audioprogramming/of/addons/ofxDStudio/src -I/. -I. -I./obj -I./obj/linux64 -I./obj/linux64/Release -I./obj/linux64/Release/src -I/./bin -I./bin -I./bin/data -I./src -I/home/staffan/Documents/projects/tech/audioprogramming/of/addons/ofxDaisySP/src

So between the includes of the library some other stuff is added which breaks the compilation…

OK, so in the make process PROJECT_ADDONS_INCLUDES is set to
/home/staffan/Documents/projects/tech/audioprogramming/of/addons/ofxDStudio/src /. . ./obj ./obj/linux64 ./obj/linux64/Release ./obj/linux64/Release/src /./bin ./bin ./bin/data ./src
by the config.addons.mk : define parse_addons_includes. Seems strange.

EDIT: Found it!
One addon (ofxDSound) depends on another (ofxDaisySP). So i added
ADDON_DEPENDENCIES = ofxDaisysP
in the addon_config.mk for ofxDSound.
This leads to an “empty” addon (blank string) being sent to
config_addons.mk function parse_addon
generating the bad -I paths.
I removed the ADDON_DEPENDENCIES and included both addongs in the projects addons.make file, and then everything works.

I guess this is a bug?

3 Likes

Oooops! My bad.

I misspelled the ADDONS_DEPENDENCIES addon (upper/lowercase typo). Embarassing! :slight_smile:

Everything works now!