Compilation error with Cobalt25.lts.20

48 views
Skip to first unread message

Ines ben halima

unread,
Jan 15, 2025, 9:42:45 AMJan 15
to cobalt-dev
Hi Team,

We are in the process of integrating YouTube using the following tag: 25.lts.20. Our environment includes the following details:

  • Chipset: arm7
  • GCC version in the toolchain: 8.3.0
  • C++ version: C++17
  • Starboard: 14

During the integration, we encountered the following compilation error:

"*****************************

../../base/cxx20_is_constant_evaluated.h: In function 'constexpr bool base::is_constant_evaluated()':

../../base/cxx20_is_constant_evaluated.h:16:10: error: '__builtin_is_constant_evaluated' was not declared in this scope

   return __builtin_is_constant_evaluated();

          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../base/cxx20_is_constant_evaluated.h:16:10: note: suggested alternative: 'is_constant_evaluated'

   return __builtin_is_constant_evaluated();

          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          is_constant_evaluated

****************************"

It should be noted that the function __builtin_is_constant_evaluated() is supported starting from GCC9.

Is there a way to successfully compile without upgrading the GCC version?

Thanks,

Ines,

Kaido Kert

unread,
Jan 15, 2025, 1:38:52 PMJan 15
to Ines ben halima, cobalt-dev
Hi,

It looks like you are getting this error when compiling code from base/ directory
It's expected that this code is compiled with the Chromium clang toolchain  ( clang version 17 defined here ), not the Starboard toolchain ( e.g. your system GCC 8.3.0 )

Please refer to Evergreen documentation for how to build Cobalt binary for Evergreen.

Kaido



You received this message because you are subscribed to the Google Groups "cobalt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobalt-dev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cobalt-dev/7d92a284-e6ab-488e-8b27-9bd6efdbd74dn%40googlegroups.com.

Ines ben halima

unread,
Jan 24, 2025, 3:25:59 AMJan 24
to Kaido Kert, cobalt-dev
Hi Kaido,
Thank you for your prompt response.

We attempted to activate the flag build_with_separate_cobalt_toolchain to build Cobalt using the Clang toolchain (based on the provided link) and subsequently build our Starboard implementation using the GCC (8.3.0) toolchain. However, we are still encountering compilation issues.

Did we use the correct flag? Is there any documentation available that explains how to build Cobalt and a custom Starboard implementation using different toolchains?

Ines,

--
*--*
*Regards*
*Ben Hlima INES*


Kaido Kert

unread,
Jan 24, 2025, 2:37:14 PMJan 24
to Ines ben halima, cobalt-dev
The documentation to follow is Evergreen build documentation, there are instructions there how to configure your build.

Your Starboard GN config needs to set `sb_is_evergreen_compatible = true`. 

Note that Cobalt and Starboard need to be built separately, e.g. there will be two separate `out/` directories for the build artifacts for Cobalt and your platform Starboard. 
The docs should cover this.

You should also be able to use our Raspberry-Pi 2 as a reference on how to build Starboard + Cobalt correctly for a target platform.

Note that  build_with_separate_cobalt_toolchain flag is not intended to be used by Evergreen platforms. It provides related functionality, but it will conflict with Evergreen.

Kaido

 

Ines ben halima

unread,
Jan 27, 2025, 3:52:03 AMJan 27
to Kaido Kert, cobalt-dev
Hi Kaido,

Thank you for your prompt response and the provided documentation. 

I should have mentioned that our Starboard implementation does not support Evergreen features. 

In this case, is it still necessary to have two separate out/ directories for the build artifacts (Cobalt and our Starboard)?

Additionally, can the build_with_separate_cobalt_toolchain flag be used in our case?

Ines,

Kaido Kert

unread,
Jan 27, 2025, 12:16:16 PMJan 27
to Ines ben halima, cobalt-dev
We no longer support running Cobalt in non-Evergreen configurations.
Your platform should be configured at least for Evergreen Lite ( e.g. no updater ) 

Yes, you can still likely use `build_with_separate_cobalt_toolchain=true` to get the build to work, this is how our Raspi-2 and other reference platforms are configured to build.
You can refer to our CI build setup and the GN configuration for that platform ( see recent builds here ). There are no dedicated doc pages for this however.

No, separate `/out` directories are not necessary with that setup, both toolchains ( Cobalt & Starboard ) are used from the same generated tree, depending on a build target.

Kaido



Ines ben halima

unread,
Mar 13, 2025, 7:24:30 AMMar 13
to cobalt-dev

Hi Kaido,

Following your latest recommendation, I have modified the toolchain  file BUILD.gn as shown below.

 #here we set the host toolchain witch is clang 17
cobalt_clang_toolchain("native_target") {
  cc = "$CC_HOST"
  cxx = "$CXX_HOST"

   ld = cxx
  ar = "$AR_HOST"

  toolchain_args = {
    current_os = "linux"
    current_cpu = "x86"
    is_clang = true
    is_starboard = false
    is_native_target_build = true
  }
}
#here we set our toolchain witch is gcc 8
gcc_toolchain("target") {
  cc = "$CC"
  cxx = "$CXX"

  readelf = "$READELF"
  nm = "$NM"
  ld = cxx
  ar = "$AR"

   toolchain_args = {
    is_clang = false
  }
}

cobalt_clang_toolchain("cobalt") {
  native_linker_path = gcc_toolchain_cxx
}

Additionally, I have enabled the relevant flags in the BUILDCONFIG.gn file and made the following adjustments:

is_native_target_build = false
sb_is_modular = true
build_with_separate_cobalt_toolchain = true

 host_toolchain = "//$starboard_path/toolchain:native_target"

 if (build_with_separate_cobalt_toolchain) {
  cobalt_toolchain = "//$starboard_path/toolchain:cobalt"
  starboard_toolchain = "//$starboard_path/toolchain:target"
} else {
  starboard_toolchain = ""//$starboard_path/toolchain:target"
  cobalt_toolchain = starboard_toolchain 
}

In your opinion, can I, with these modifications, successfully compile the Cobalt core using the Clang toolchain while building our Starboard with GCC?
If you have any suggestions or insights that could assist me, I would greatly appreciate your guidance to help resolve the issue.

 Thank you very much for your support,

Ines

Reply all
Reply to author
Forward
0 new messages