Help with "boost" to compile [missing: Boost_INCLUDE_DIR]

I’m just learning Haiku and programming on this system.
I am trying to compile a program that requires Boost dependencies (Along with others)

But when compiling it, CMake gives me the following error:
“Could NOT find Boost (missing: Boost_INCLUDE_DIR)”

According to what I have read on other sites, what I have to do is specify to CMake where boost is, but I don’t know in Haiku where the libraries that I install are located

Or even if I installed boost correctly, I installed the “boost_build”, “boost_x86”, and “boost170_x86” packages but I don’t know which of those might contain the libraries I need, or how I tell CMake where to find it.

I understand that my problem can be very basic, but I am getting to know the system, and I would greatly appreciate your help.

Install the _devel subpackage too. Check the HaikuDepot menu to make them visible (the _develop packages are hidden in default).

Also read the FAQ and the user guide.

I recently read in another post that I had to install the _develop packages, and indeed I installed them, but always the same message, that boost is missing

1 Like

There is a boost_build and boost_build_x86 package. Perhaps you need the _x86 version in addition to the _devel packages that @extrowerk mentioned. Also, you may need to run setarch x86 to change to gcc11 before running cmake.

2 Likes

@robante15 welcome to the Haiku community :slight_smile:

Because you mention _x86 packages I assume you are on 32bit Haiku.
The 32bit Version of Haiku has 2 versions of the gcc compiler installed, gcc2 for binary compatibility with BeOS R5 and a modern one (gcc11 at the moment) for everything else. When you open a terminal, the paths for the compiler and the headers default to gcc2 (which only makes sense to use when compiling very old apps or parts of the system that involve binary compatibility). To change to gcc11, like @Lrrr already explained, you need to issue the command “setarch x86”.
The packages you need to compile software against boost are boost_x86 and boost_x86_devel. (or if you need a specific version there are also packages for that). “pkgman search boost” gives you a list of all boost packages, you can install them with "pkgman install "

I don’t know if cmake needs anything else to find the libraries, but I’m sure somebody else can comment on that.

3 Likes

Indeed, I needed this, set the architecture to x86 and I no longer have problems with CMake

Now the problem I have is that it does not find the <GL/glx.h> file when doing the include
I don’t know which development package includes that file?

Yes, I was looking at that, which could be said to be three main architectures

x86, x86 gcc2, and x64… I still don’t fully understand that and it probably confuses me, but thank you very much for your answers that helps me understand the system better

Yeah that happened to me in the beginning too. The reason for all this is that the goal for Haiku was (and still is, to some extent) to be a replacement for BeOS R5 which was compiled and shipped with gcc 2.95. Because gcc doesn’t have a stable ABI, to maintain binary compatibility with BeOS, the 32bit version of Haiku still has to be compiled with gcc2 (only the OS itself, not neccessarily the applications).
To be able to use newer C++ features in applications a more modern gcc environment was included.

Long story short, if you don’t care about running original BeOS software and have 64bit capable hardware (which you most likely do) you can use the 64bit version, which only has the modern gcc11 compiler because it is incompatible with old BeOS software anyway.

Glx is *nix and x11 specific header. It is not supported on Haiku, Haiku is not *nix.

@robante15, which software are you trying to compile?

I am trying to compile OpenRW which is a re-implementation of the GTA III renderware engine.
The build requirements are few, and I thought this might be a good starting point for understanding Haiku ports.

I would like to port Geany IDE one day, but it runs on GTK 3, and I understand that the GTK port is still being developed.

Hint: Pick a simpler project to learn the differences.

Don’t worry, the “hello_world.c” compiles without problems

There probably are simpler programs to start porting, but I don’t think it is impossible. At least OpenRW also runs on Windows and on Mac so it should be able to work without X11 specific headers in theory. Maybe you need to configure some options to work without glx.h. Unfortunately, my knowledge of both cmake and OpenGL is very limited, so I can’t help you here.

I’m not sure it is actively being developed, but there were some experiments with the browser based backend of GTK

Thank you very much, and with what you have helped me I have understood a little better how the libraries work to compile.

And yes, I’m going to look for some smaller project to start, the thing is that since there is no GTK I can’t even start with a simple text editor something like “notepad”, but I’ll look

And with OpenRW I hope to find more information about the implementation of glx.h and how it works internally, maybe replacing the library, or looking for other implementations, I don’t think it’s totally impossible to port

But GTK3 is in the depot, at least for 64 bit.

1 Like

If you want to work on something between Geany and a notepad equivalent, there’s a syntax highlighting editor called Koder in the Haiku Depot that’s open source. You can learn Haiku’s Layout Kit from there. There should be a link in the about box telling where its source can be downloaded from. I think I was able to build the HaikuPorts source using HaikuPorter, both available from GitHub.

boost_build is a tool similar to jam that you probably don’t need.

boost_x86 is the old 1.57 version of boost, do not use it. Uninstall it if you can to avoid any conflicts.

You need boost170_x86 and boost170_x86_devel.

For the old boost 1.57 recipe we made the effort of splitting boost into several smaller packages. Unfortunately for newer versions this was dropped so now you have to install everything from boost.

After doing all this, make sure to delete all files generated by cmake in your project and start over. cmake can remember that boost was not found in a previous run, and will not search for it again even after you have installed the packages.

2 Likes

I can look into this in the near future.

1 Like

I thought the boost package without the version was always the latest one.