Building libwebsockets for OP-TEE - libwebsockets

I've been trying to build libwebsockets for OP-TEE running on a TI AM437x HS (an arm platform). I'm using Yocto to build; here's the version string for OP-TEE, which is displayed on boot:
I/TC: OP-TEE version: ti2019.05-rc1-dev (gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))) #1 Tue Nov 29 17:49:12 UTC 2022 arm
I'm using libwebsockets version 4.3.2.
OP-TEE support is documented for libwebsockets:
https://libwebsockets.org/lws-api-doc-main/html/md_READMEs_README_build.html#optee
I'm specifying -DLWS_PLAT_OPTEE=1 to CMake, but a number of libwebsockets source files include errno.h, which is not provided by OP-TEE's minimal libc. I have tried specifying an additional -I/-isystem option to pick up the errno.h that comes with the toolchain (gcc) but this causes further problems with headers included by it, and I think it should only by used with GNU's libc.
Is OP-TEE still a supported platform for libwebsockets? If so, how should I resolve the issue with errno.h?
Thank you for your help!

Related

Targetting an older version of libstdc++ with recent GCC when cross-copiling to an embedded-linux ARM device

We need to find a cross-compilation toolchain for an ARM embedded linux target that satisfies the following criteria:
Kernel 3.17
GLIBC 2.18
Recent version of GCC is required to compile some third-party code
Those requirements brought me to generate a custom cross-compilation toolchain using crosstool-ng. I selected the min kernel version, min glibc version and it seemed to work well until I tried to compile code containing C++.
Because the new GCC is using a more recent libstdc++ than what is available on the target, the executable won't run and we get an error like this:
/usr/lib/libstdc++.so.6: version `CXXABI_1.3.9' not found
The code compiled fine with an older version of GCC.
Looking at the configuration options for crosstool-ng I didn't find anything that would let me change the min libstdc++ version, like for glibc.
Is there a way to target an older libstdc++ version without downgrading GCC?
Can I use the headers and libstdc++.so files from the target to replace the ones GCC is using when cross-compiling?

GLIBCXX_3.4.26 not found on centos

I am facing this issue on centos:-
/lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found
Gcc version i have is :- gcc version 7.2.0 (GCC)
How can i install GLIBCXX_3.4.26 on centos 7.8?
You need to build your application using the system compiler or GCC from Developer Toolset. Developer Toolset uses a hybrid linkage model which avoids these errors. This functionality is likely missing from your custom build of GCC.

How to use make with C++14 with gcc 4.8.5 on RedHat 7.5

I have gcc 4.8.5 installed on a Red Hat 7.5 machine.
I wish to compile a software package on this machine.
In order to compile this package, I need to run "make".
However, when I run this, I see the following error message "error: ‘make_unique’ is not a member of ‘std’".
My understanding (possibly incorrect) is that this message originates from the fact that 4.8.5 uses C++11 and "make_unique" requires C++14. So I presume the way to compile this is to specify that C++14 should be used when I run "make".
How do I do this ?
I have tried to set the C++ to 14 as follows:
cmake -G "Unix Makefiles" -D CMAKE_CXX_STANDARD=14
And then I ran "make".
But this gave the same error message.
You are using compiler that does not support C++14. As stated in the documentation:
GCC supports the original ISO C++ standard (1998) and contains experimental support for the second ISO C++ standard (2011).
It is no surprise, since GCC 4.8 was originally released in 2013 so it would be weird if it implemented a standard introduced a year later.
To use C++14 or even C++17 you can compile it with RH Devtoolset 8. The built software would run on target OS w/o any additional effort due to the "nature" of DTS compiler: the symbols available in the OS-shipped libstdc++ gonna be resolved dynamically, while C++11 and above gonna be linked to you executable from the specially built static libstdc++.a provided by DTS.

gFortran and OpenACC support

According to the gFortran docs in order to enable OpenACC support it is necessary to use the -fopenacc switch. However, this does not seem to work.
gfortran: error: unrecognized command line option ‘-fopenacc’
gFortran version is GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28).
What is the correct way to compile Fortran code with OpenACC support?
Your version is WAY too old. The currently supported versions of GCC are 7, 8 and 9.
The version specific manuals are available at https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gfortran/OpenACC.html#OpenACC Change the version number in the address to see other versions.
The option appears to be added in version 5 but the support in more recent versions is likely to be much better.

How to install two GCC versions for cuda 5.0 on centos7

I need to install cuda 5.0 in centos7 x64. But, I have a problem with GCC, as the current version installed is (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11).
What is the supported version of GCC for Cuda 5.0 and how to install this older GCC version with my actual compiler ((GCC) 4.8.5).
Thanks in advance
#talonmies has provided a list of maximum GCC version supported by different versions of CUDA. Specifically: CUDA 5.0 supports GCC up to 4.6 - and that's what you should install.
There's an answer here on SO which explains how to get GCC 4.6(.3) installed by building from sources. Essentially you need to build some libraries with any C compiler before you can build GCC itself.
Good luck.

Resources