# Building v2.17.2 failed with fatal error: 'code.h' file not found

**URL:** https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078
**Category:** General
**Created:** [April 12, 2023, 8:02am UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078 "2023-04-12T08:02:16Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)
#### Post date: [April 12, 2023, 8:02am UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078/1 "2023-04-12T08:02:16Z")

</div>

Hi  
Excuse me.  
I executed the command `yb_build.sh release` to compile version v2.17.2 of yugabyteDB, but failed due to a fatal error. The error message is as follows:

```auto
DEPRECATION: typed-ast is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for typed-ast ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for typed-ast did not run successfully.
  │ exit code: 1
  ╰─> [28 lines of output]
      running install
      /Users/simon/Documents/yugabyte-db-2.17.2/build/venv-arm64/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-311
      creating build/lib.macosx-13-arm64-cpython-311/typed_ast
      copying typed_ast/conversions.py -> build/lib.macosx-13-arm64-cpython-311/typed_ast
      copying typed_ast/ __init__.py -> build/lib.macosx-13-arm64-cpython-311/typed_ast
      copying typed_ast/ast3.py -> build/lib.macosx-13-arm64-cpython-311/typed_ast
      copying typed_ast/ast27.py -> build/lib.macosx-13-arm64-cpython-311/typed_ast
      creating build/lib.macosx-13-arm64-cpython-311/typed_ast/tests
      copying ast3/tests/test_basics.py -> build/lib.macosx-13-arm64-cpython-311/typed_ast/tests
      running build_ext
      building '_ast27' extension
      creating build/temp.macosx-13-arm64-cpython-311
      creating build/temp.macosx-13-arm64-cpython-311/ast27
      creating build/temp.macosx-13-arm64-cpython-311/ast27/Custom
      creating build/temp.macosx-13-arm64-cpython-311/ast27/Parser
      creating build/temp.macosx-13-arm64-cpython-311/ast27/Python
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/opt/homebrew/opt/openjdk@11/include -Iast27/Include -I/Users/simon/Documents/yugabyte-db-2.17.2/build/venv-arm64/include -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c ast27/Custom/typed_ast.c -o build/temp.macosx-13-arm64-cpython-311/ast27/Custom/typed_ast.o
      In file included from ast27/Custom/typed_ast.c:3:
      ast27/Custom/../Include/compile.h:5:10: fatal error: 'code.h' file not found
      #include "code.h"
               ^ ~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

```

Maybe it was running setup.py install for typed-ast, but it did not run successfully.  
So far, I don’t know how to solve it.  
May I ask if you can provide a solution or suggestion?

---

<div class="post-metadata">

### Author: ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)
#### Post date: [April 12, 2023, 9:12am UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078/2 "2023-04-12T09:12:44Z")

</div>

Hi @ZhenNan2016

What version of OS and python are you using?  
Does it help if you install `wheel` package first?

cc @svarnau

---

<div class="post-metadata">

### Author: ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)
#### Post date: [April 12, 2023, 9:25am UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078/3 "2023-04-12T09:25:45Z")

</div>

Hi @dorian_yugabyte  
OS: macOS Ventura 13.1  
The Python version on my macOS is 3.9.6, but I see that when compiling yugabyteDB, there will be its own Python directory, which is yugabyte-db-2.17.2/build/venv-arm64/lib/python3.11.

Does it need to install wheel package first ?  
I installed the relevant package according to the following link, but it was not mentioned above that the wheel package needs to be installed

> **[Build from source code on macOS](https://docs.yugabyte.com/preview/contribute/core-database/build-from-src-macos/)**
>
> Build YugabyteDB from source code on macOS.

When I execute the command pip3 install wheel to prepare to install the wheel package, I am prompted that Requirement already satisfied. The details are as follows:

`Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: wheel in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (0.37.0)`

By the way, executing `pip3 install typed-ast` separately does not cause any exceptions and can be installed normally.

cc @svarnau

---

<div class="post-metadata">

### Author: ![svarnau](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/svarnau/32/326_2.png) [@svarnau](https://forum.yugabyte.com/u/svarnau)
#### Post date: [April 12, 2023, 4:45pm UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078/4 "2023-04-12T16:45:52Z")

</div>

I think this has something to do with which python gets picked up in the mac/M1 environment.  
cc: @mbautin @jason @Frits_Hoogland

---

<div class="post-metadata">

### Author: ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)
#### Post date: [April 18, 2023, 4:20am UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078/5 "2023-04-18T04:20:54Z")

</div>

> [@svarnau](#):
>
> I think this has something to do with which python gets picked up in the mac/M1 environment.

Hi @svarnau  
Excuse me.  
They (@mbautin @jason @Frits_Hoogland) haven’t answered this question.  
Is there anyone else who can consult and solve this problem?  
Thank you very much.

---

<div class="post-metadata">

### Author: ![Frits\_Hoogland](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/frits_hoogland/32/564_2.png) [@Frits\_Hoogland](https://forum.yugabyte.com/u/Frits_Hoogland)
#### Post date: [April 18, 2023, 12:29pm UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078/6 "2023-04-18T12:29:08Z")

</div>

To verify any issues with the source code tagged with v2.17.2.0, I checked out that tag and build it on my Mac M1 version: 13.3.1. It gets past the Python building, and now is compiling the c++ files.

I am a bit confused about what I see, because the messages with the error indicating python version 3.11 is used? On my machine it’s python 3.9.

(venv-arm64/lib/python3.11)

---

<div class="post-metadata">

### Author: ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)
#### Post date: [April 19, 2023, 2:32am UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078/7 "2023-04-19T02:32:39Z")

</div>

> [@Frits\_Hoogland](#):
>
> To verify any issues with the source code tagged with v2.17.2.0, I checked out that tag and build it on my Mac M1 version: 13.3.1. It gets past the Python building, and now is compiling the c++ files.

May I ask if the v2.17.2.0 you compiled have passed the compilation?

> [@Frits\_Hoogland](#):
>
> I am a bit confused about what I see, because the messages with the error indicating python version 3.11 is used? On my machine it’s python 3.9.

I just executed `yb_build.sh release`, and it generated the directory ‘build/venv-arm64/lib/python3.11’ in the ‘build’ directory. Do it need to set anything config?

---

<div class="post-metadata">

### Author: ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)
#### Post date: [April 19, 2023, 3:28am UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078/8 "2023-04-19T03:28:03Z")

</div>

> [@ZhenNan2016](#):
>
> The Python version on my macOS is 3.9.6

Hi @Frits_Hoogland  
I cleaned up Python in my macOS environment and kept it at only 3.9.6. It gets past the Python building, and it can compile the c++ files.

However, there are some C files that fail compilation and will prompt as follows:  
/-------------------------------------------------------------------------------

| COMPILATION FAILED |
| --- |
| build/release-clang-dynamic-arm64-ninja/src/yb/yql/cql/ql/parser/parser\_gram.y.cc:10916:9: error: variable ‘yynerrs\_’ set but not used [-Werror,-Wunused-but-set-variable] |

```
int yynerrs_ = 0;
    ^

```

1 error generated.

Actually, the yyners\_ is useful.  
Have you encountered this compilation error?

---

<div class="post-metadata">

### Author: ![Frits\_Hoogland](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/frits_hoogland/32/564_2.png) [@Frits\_Hoogland](https://forum.yugabyte.com/u/Frits_Hoogland)
#### Post date: [April 19, 2023, 6:24am UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078/9 "2023-04-19T06:24:08Z")

</div>

Great!  
That is a known issue that you’re seeing.  
Can you add —clang15 as argument to the yb\_build command, then it should work!

---

<div class="post-metadata">

### Author: ![ZhenNan2016](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/zhennan2016/32/623_2.png) [@ZhenNan2016](https://forum.yugabyte.com/u/ZhenNan2016)
#### Post date: [April 19, 2023, 6:38am UTC](https://forum.yugabyte.com/t/building-v2-17-2-failed-with-fatal-error-code-h-file-not-found/2078/10 "2023-04-19T06:38:21Z")

</div>

Yes, I use `yb_build.sh --clang15 release`, and it can compile and run normally now.  
Thank very much.
