Cannot build Haiku (missing aligned_alloc)

I got a lot of errors when try to build a small change I did for an app.

…/…/…/generated/build_packages/gcc_syslibs_devel-8.3.0_2019_05_24-13-x86_64/develop/headers/c++/cstdlib:132:11: error: ‘aligned_alloc’ has not been declared in ‘::’
132 | using ::aligned_alloc;
| ^~~~~~~~~~~~~

I wonder if its my configuration if no one else is having problem?
I updated both buldtools and haiku src to the latest. Built jam and installed it.
Update: Could it be my GCC version?

gcc (2021_04_27) 11.1.0

Another Q: Why isnt zlib installed by default? I had to install it manually - its required to build Haiku with that lib.

aligned_alloc become required for GCC 11.

1 Like

On mobile phone, but I think you need to specify C++17 build flag -std=C++17

I applied your patch @X512 and now the aligned_malloc errors are gone. But new problems occur:

DownloadLocatedFile1 …/…/…/generated/download/gcc_syslibs-11.1.0_2021_04_27-1-x86_64.hpkg
–2021-11-07 10:36:49--
Resolving… C++ …/…/…/generated/objects/haiku_host/x86_64/release/tools/gensyscalls/x86_64/gensyscalls.o
Connecting to|2a03:b0c0:2:d0::3481:e001|:443… failed: Network is unreachable.
Connecting to||:443… connected.
HTTP request sent, awaiting response… 404 Not Found
2021-11-07 10:36:49 ERROR 404: Not Found.

wget --retry-connrefused --timeout 30 -O “…/…/…/generated/download/gcc_syslibs-11.1.0_2021_04_27-1-x86_64.hpkg” $source/packages/gcc_syslibs-11.1.0_2021_04_27-1-x86_64.hpkg || exit 1
touch “…/…/…/generated/download/gcc_syslibs-11.1.0_2021_04_27-1-x86_64.hpkg”

This patch expects that the gcc_syslibs package is availble on the haiku build packages repository (it is not, yet), or that you put it in the generated/downloads/ directory manually.

At the moment, building Haiku with gcc11 is not working, so gcc 8.3 needs to be used. This should be the case if you follow these instructions: Compiling for x86_64 | Haiku Project

I am trying to download an old HPKG from HaikuDepot (GCC 8.3) but it only return 404. How do I downgrade GCC in the best way?

due to the dependencies you will have to use an older version of haiku

So it’s just temporary because the documentation states that nightly or beta releases contain all the software needed to build Haiku.

Do you know if beta 3 would do it?

Please create a bugrport and attach a complete description of what you are doing (which hrev you are running, which hrev you are trying to compile, and which command you used) and a complete build log.

Even if you use beta3 you will still get the gcc 11 update, so that won’t change anything. However, building Haiku involves building a gcc8 compiler from the buildtools repository so this should not be a problem. If it’s not working, that’s a bug, and we need more information to see what’s happening and try to fix it.

I am just trying to build Lanchbox from src/app/lanunchbox with jam.

Sorry if I’m nitpicking but you just misspelled “launchbox” twice in a row. Could that be the culprit?

Nah, its GCC 8.3 which I don’t have installed.
Update: Solved. Needed to run ./configure twice for some reason.