swift-nio-ssl: fatal error: 'memory' file not found
I was trying to test out the new nio-http-client on Ubuntu 18.04 and I’m getting the following error when it is building this framework:
In file included from ~/TestHTTPClient/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/ssl/t1_enc.cc:136:
~/TestHTTPClient/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/include/openssl/ssl.h:145:
~/TestHTTPClient/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/include/openssl/base.h:463:10: fatal error: 'memory' file not found
#include <memory>
I’ve verified that there is a memory.h file in /usr/include
. I couldn’t find any references to this issue elsewhere. Would anyone have any tips for where to go next to figure out why this error is happening?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (8 by maintainers)
Try installing
libstdc++-12-dev
. Your clang has selected a newer gcc, so you need the associated libstdc++.Thanks. On Fedora (38) the fix is:
sudo dnf install libstdc++-devel
Thank you @Lukasa. Installing
libstdc++-12-dev
has likely solved the problem.If anybody reads this today, if you see a similar error, it’s likely that you’re on Linux and you haven’t got the
libstdc++-9-dev
package installed. That’s the name of this package on Ubuntu/Debian, will be slightly different for Fedora/CentOS.To debug this, please send the output of
clang -v
(be sure to use the clang from the error message) andfind /usr/include -name memory
.This should look something like
@Ponyboy47 Thanks for posting the issue.
#include <memory>
is a C++ thing that does not includememory.h
but rather a C++ header, for example/usr/include/c++/7/memory
.It seems like you don’t have libstdc++ installed on your system. The easiest way to fix this is probably
which contains all the essential build tools. You could also just install
libstdc++-7-dev
.Thanks!
sudo apt install libstdc++-12-dev
solved the issue.Awesome, glad this worked. In the end, Swift should just always use its own clang, otherwise things like this will continue to happen. I did file a bug about this earlier so I hope in the future, this won’t be an issue.
So I figured it out! I remove cpp-8 (and all the clang packages since the clang executable was included with swiftenv). Now it is building just fine. I only have cpp and cpp-7 packages now