# What is the minimum gcc/g++ version required to build Ray ? g++-4.9 gives me some compiling error

**URL:** <https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390>\
**Category:** Ray Core\
**Created:** [March 24, 2021, 9:25pm UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390 "2021-03-24T21:25:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yncxcw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/yncxcw/32/15_2.png) [@yncxcw](https://discuss.ray.io/u/yncxcw)\
**Post date:** [March 24, 2021, 9:25pm UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390/1 "2021-03-24T21:25:36Z")

</div>

This [line](https://github.com/ray-project/ray/blob/releases/1.2.0/src/ray/core_worker/common.h#L59) complains when compiling with g++4.9

---

<div class="post-metadata">

**Author:** ![pcmoritz](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/pcmoritz/32/130_2.png) [@pcmoritz](https://discuss.ray.io/u/pcmoritz)\
**Post date:** [March 24, 2021, 10:30pm UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390/2 "2021-03-24T22:30:33Z")

</div>

Hey thanks for asking! So given that g++ 4.9 supports c++14 (with the -std=c++14 flag), it should be possible to support it. What is the error message? Can you contribute a fix as a PR?

---

<div class="post-metadata">

**Author:** ![yic](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/yic/32/437_2.png) [@yic](https://discuss.ray.io/u/yic)\
**Post date:** [March 24, 2021, 10:42pm UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390/3 "2021-03-24T22:42:28Z")

</div>

I think we need gcc-5.  
Most of the features supported in c++ 14 are in gcc5. [Compiler support for C++14 - cppreference.com](https://en.cppreference.com/w/cpp/compiler_support/14)

---

<div class="post-metadata">

**Author:** ![pcmoritz](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/pcmoritz/32/130_2.png) [@pcmoritz](https://discuss.ray.io/u/pcmoritz)\
**Post date:** [March 24, 2021, 11:35pm UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390/4 "2021-03-24T23:35:37Z")

</div>

Ah thanks for the clarification, that makes sense!

---

<div class="post-metadata">

**Author:** ![yncxcw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/yncxcw/32/15_2.png) [@yncxcw](https://discuss.ray.io/u/yncxcw)\
**Post date:** [March 25, 2021, 9:59pm UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390/5 "2021-03-25T21:59:16Z")

</div>

Actually it failed on this type of code:

```auto
void func(std::map<int, int>& arg={}) {

}

```

Error message with gcc4.9

```auto
error: could not convert '<brace-enclosed initializer list>()' from '<brace-enclosed initializer list>' to 'std::map<int, int>&'
 void func(std::map<int, int>& arg={}) {}

```

It passed on both \>= g+±5

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [March 27, 2021, 10:25pm UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390/6 "2021-03-27T22:25:34Z")

</div>

I think we use this style for the default variables, and it is probably not supported in the old compiler…

---

<div class="post-metadata">

**Author:** ![yic](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/yic/32/437_2.png) [@yic](https://discuss.ray.io/u/yic)\
**Post date:** [March 29, 2021, 10:24pm UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390/7 "2021-03-29T22:24:00Z")

</div>

We should add a checker in bazel to make sure the compiler supports 14.

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [March 29, 2021, 10:37pm UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390/8 "2021-03-29T22:37:17Z")

</div>

@yic do you mind creating a PR for that?

---

<div class="post-metadata">

**Author:** ![yic](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/yic/32/437_2.png) [@yic](https://discuss.ray.io/u/yic)\
**Post date:** [March 31, 2021, 6:18pm UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390/9 "2021-03-31T18:18:54Z")

</div>

Sure, I can put that.

---

<div class="post-metadata">

**Author:** ![yic](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/yic/32/437_2.png) [@yic](https://discuss.ray.io/u/yic)\
**Post date:** [April 5, 2021, 5:59am UTC](https://discuss.ray.io/t/what-is-the-minimum-gcc-g-version-required-to-build-ray-g-4-9-gives-me-some-compiling-error/1390/10 "2021-04-05T05:59:56Z")

</div>

@sangcho I searched around, but I didn’t find a good way to do this ☹
