# Build fails due to missing file (stdalign.h)

**URL:** <https://forums.swift.org/t/build-fails-due-to-missing-file-stdalign-h/60143>\
**Category:** Using Swift\
**Tags:** linux, build-script, help-needed, buildin-the-compiler\
**Created:** [September 7, 2022, 1:53am UTC](https://forums.swift.org/t/build-fails-due-to-missing-file-stdalign-h/60143 "2022-09-07T01:53:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtennes](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mtennes/32/25124_2.png) [@mtennes](https://forums.swift.org/u/mtennes)\
**Post date:** [September 7, 2022, 1:53am UTC](https://forums.swift.org/t/build-fails-due-to-missing-file-stdalign-h/60143/1 "2022-09-07T01:53:56Z")

</div>

Hello,

Real newbie here, since I haven't even successfully built Swift. After executing the build script for about 9 hours, it fails because it can't find `stdalign.h` I am trying to build swift on the following. Any help would be greatly appreciated.

```swift
Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-47-generic x86_64)

```

**Checked out from**

```swift
> git clone https://github.com/apple/swift.git
> ./swift/utils/update-checkout --clone

```

**Built using:**  
`> ./swift/utils/build-script -- \ preset=buildbot_swiftpm_linux_platform,tools=RA,stdlib=RA`

.....Building for production...  
In file included from /home/mtennes/swift-source/swift-crypto/Sources/CCryptoBoringSSL/crypto/fipsmodule/bn/exponentiation.c:119:  
In file included from /home/mtennes/swift-source/swift-crypto/Sources/CCryptoBoringSSL/crypto/fipsmodule/bn/internal.h:135:  
/home/mtennes/swift-source/swift-crypto/Sources/CCryptoBoringSSL/crypto/fipsmodule/bn/../../internal.h:128:10: fatal error: 'stdalign.h' file not found  
#include \<stdalign.h\>  
^ ~~~~~~~~~~~  
1 error generated.

```swift

```

---

<div class="post-metadata">

**Author:** ![mtennes](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mtennes/32/25124_2.png) [@mtennes](https://forums.swift.org/u/mtennes)\
**Post date:** [September 7, 2022, 2:40am UTC](https://forums.swift.org/t/build-fails-due-to-missing-file-stdalign-h/60143/2 "2022-09-07T02:40:11Z")

</div>

and yet the file exists

```swift
./build/buildbot_incremental/llvm-linux-x86_64/lib/clang/13.0.0/include/stdalign.h
./build/buildbot_incremental/toolchain-linux-x86_64/usr/lib/clang/13.0.0/include/stdalign.h
./llvm-project/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/deprecated-headers/stdalign.h
./llvm-project/clang/lib/Headers/stdalign.h

```

---

<div class="post-metadata">

**Author:** ![Finagolfin](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/finagolfin/32/34388_2.png) [@Finagolfin](https://forums.swift.org/u/Finagolfin)\
**Post date:** [September 8, 2022, 7:09am UTC](https://forums.swift.org/t/build-fails-due-to-missing-file-stdalign-h/60143/3 "2022-09-08T07:09:30Z")

</div>

> preset=buildbot\_swiftpm\_linux\_platform

Any particular reason you're building this SPM preset and not simply [the main linux preset](https://github.com/apple/swift/blob/67b23d7d45f12aec288ec80a9ddc6a91b68123ac/utils/build-presets.ini#L856)?

That error doesn't tell us much, you'd need to include the compiler invocation and other lines above that.

It should be using the second of your list of locations for that header, so something has gone wrong. What does this command show?

```swift
ls -l build/buildbot_incremental/toolchain-linux-x86_64/usr/lib/swift/clang

```

That should point at the second directory, you can [download a prebuilt trunk snapshot toolchain here](https://www.swift.org/download/#snapshots) and compare.

---

<div class="post-metadata">

**Author:** ![mtennes](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mtennes/32/25124_2.png) [@mtennes](https://forums.swift.org/u/mtennes)\
**Post date:** [September 9, 2022, 4:04am UTC](https://forums.swift.org/t/build-fails-due-to-missing-file-stdalign-h/60143/4 "2022-09-09T04:04:52Z")

</div>

> [@Finagolfin](#):
>
> Any particular reason you're building this SPM preset and not simply [the main linux preset](https://github.com/apple/swift/blob/67b23d7d45f12aec288ec80a9ddc6a91b68123ac/utils/build-presets.ini#L856)?

It's what the book said.

```swift
“Building Swift 
    Before you begin building Swift, you will need to understand that this will take hours to build depending on your system or virtual machine setup. If you are using a virtual machine, like VirtualBox, I would strongly recommend that you allocate multiple cores to your virtual machine; it will dramatically shorten the build time. The following command will build Swift, its toolchain, and the package manager:
    ./swift/utils/build-script --preset=buildbot_swiftpm_linux_platform,tools=RA,stdlib=RA

    Once this has built everything, we need to install it somewhere and put the binaries in our path.”

Excerpt From
Mastering Swift 5.3
Jon Hoffman

```
