Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC12 support for Yocto Linux #487

Closed
thomas-roos opened this issue May 11, 2022 · 16 comments
Closed

GCC12 support for Yocto Linux #487

thomas-roos opened this issue May 11, 2022 · 16 comments

Comments

@thomas-roos
Copy link

Problem:

Yocto mainline switched from GCC11 to GCC12 and now aws-lc is not buildable anymore in meta-aws
Wondering if this is a real bug or just a false positive.
When are you planning to support GCC12?

Relevant details

AWS-LC commit: 0.0.2 to 1.1.0

System information: for linux, below info can be collected by running uname -srvmp

  • CPU architecture: x86-64

Build log:

| FAILED: crypto/CMakeFiles/crypto_objects.dir/x509v3/v3_utl.c.o
| /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc -DBORINGSSL_DISPATCH_TEST -DBORINGSSL_IMPLEMENTATION -DBORINGSSL_SHARED_LIBRARY -I/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/../include -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security  --sysroot=/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot  -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0=/usr/src/debug/aws-lc/1.1.0-r0                      -fdebug-prefix-map=/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0=/usr/src/debug/aws-lc/1.1.0-r0                      -fdebug-prefix-map=/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot=                      -fdebug-prefix-map=/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot-native=  -std=c99 -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Werror -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wwrite-strings -Wformat-security -Wunused-result -Wno-cast-function-type  -DAWS_LC_STDALIGN_AVAILABLE -DAWS_LC_BUILTIN_SWAP_SUPPORTED -Wvla -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -ggdb -Wall -fvisibility=hidden -fno-common -Wno-free-nonheap-object -Wimplicit-fallthrough -Wformat-signedness -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes -Wshadow -D_XOPEN_SOURCE=700 -fPIC -MD -MT crypto/CMakeFiles/crypto_objects.dir/x509v3/v3_utl.c.o -MF crypto/CMakeFiles/crypto_objects.dir/x509v3/v3_utl.c.o.d -o crypto/CMakeFiles/crypto_objects.dir/x509v3/v3_utl.c.o -c /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/x509v3/v3_utl.c
| In file included from /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot/usr/include/string.h:535,
|                  from /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/x509v3/v3_utl.c:63:
| In function 'memset',
|     inlined from 'OPENSSL_memset' at /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/x509v3/../internal.h:845:10,
|     inlined from 'ipv6_from_asc' at /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/x509v3/v3_utl.c:1282:9:
| /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot/usr/include/bits/string_fortified.h:59:10: error: '__builtin_memset' forming offset 16 is out of the bounds [0, 16] [-Werror=array-bounds]
|    59 |   return __builtin___memset_chk (__dest, __ch, __len,
|       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|    60 |                                  __glibc_objsize0 (__dest));
|       |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
| cc1: all warnings being treated as errors

@thomas-roos
Copy link
Author

thomas-roos commented May 11, 2022

if this warning ist suppressed this is the next:

| FAILED: crypto/CMakeFiles/crypto_objects.dir/x509v3/v3_utl.c.o
| /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc -DBORINGSSL_DISPATCH_TEST -DBORINGSSL_IMPLEMENTATION -DBORINGSSL_SHARED_LIBRARY -I/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/../include -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security  --sysroot=/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot  -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0=/usr/src/debug/aws-lc/1.1.0-r0                      -fdebug-prefix-map=/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0=/usr/src/debug/aws-lc/1.1.0-r0                      -fdebug-prefix-map=/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot=                      -fdebug-prefix-map=/home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot-native=  -Wno-array-bounds -std=c99 -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Werror -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wwrite-strings -Wformat-security -Wunused-result -Wno-cast-function-type  -DAWS_LC_STDALIGN_AVAILABLE -DAWS_LC_BUILTIN_SWAP_SUPPORTED -Wvla -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -ggdb -Wall -fvisibility=hidden -fno-common -Wno-free-nonheap-object -Wimplicit-fallthrough -Wformat-signedness -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes -Wshadow -D_XOPEN_SOURCE=700 -fPIC -MD -MT crypto/CMakeFiles/crypto_objects.dir/x509v3/v3_utl.c.o -MF crypto/CMakeFiles/crypto_objects.dir/x509v3/v3_utl.c.o.d -o crypto/CMakeFiles/crypto_objects.dir/x509v3/v3_utl.c.o -c /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/x509v3/v3_utl.c
| In file included from /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot/usr/include/string.h:535,
|                  from /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/x509v3/v3_utl.c:63:
| In function 'memset',
|     inlined from 'OPENSSL_memset' at /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/x509v3/../internal.h:845:10,
|     inlined from 'ipv6_from_asc' at /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/x509v3/v3_utl.c:1282:9:
| /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/recipe-sysroot/usr/include/bits/string_fortified.h:59:10: error: '__builtin_memset' may write between 16 and 2147483647 bytes into a region of size 15 [-Werror=stringop-overflow=]
|    59 |   return __builtin___memset_chk (__dest, __ch, __len,
|       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|    60 |                                  __glibc_objsize0 (__dest));
|       |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
| /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/x509v3/v3_utl.c: In function 'ipv6_from_asc':
| /home/ubuntu/yocto/build/tmp/work/core2-64-poky-linux/aws-lc/1.1.0-r0/git/crypto/x509v3/v3_utl.c:1230:40: note: at offset [1, 16] into destination object 'v6' of size [0, 16]
|  1230 | static int ipv6_from_asc(unsigned char v6[16], const char *in)
|       |                          ~~~~~~~~~~~~~~^~~~~~
| cc1: all warnings being treated as errors

@thomas-roos
Copy link
Author

thomas-roos commented May 11, 2022

If this is also suppressed, it is building.

@bryce-shang
Copy link
Contributor

Thank you for reporting this issue.

Would you share the Docker image link? I spent some time installing gcc-12 but got Unable to locate package gcc-12.

@thomas-roos
Copy link
Author

Thank you for the quick response - here is all you need: Dockerfile

@bryce-shang
Copy link
Contributor

Thank you for the quick response - here is all you need: Dockerfile

Is the link correct? Only gcc-9 is found in the built Docker image. Besides, this Docker image does not have CMake installed. Would you include more specific reproduce steps?

yoctouser@3e02d4f75a3e:~$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

yoctouser@3e02d4f75a3e:~$ which gcc
/usr/bin/gcc
yoctouser@3e02d4f75a3e:~$ cd /usr/bin
yoctouser@3e02d4f75a3e:/usr/bin$ ls -lth | grep gcc
lrwxrwxrwx 1 root root     22 Mar  9 17:57 gcc-9 -> x86_64-linux-gnu-gcc-9
lrwxrwxrwx 1 root root     25 Mar  9 17:57 gcc-ar-9 -> x86_64-linux-gnu-gcc-ar-9
lrwxrwxrwx 1 root root     25 Mar  9 17:57 gcc-nm-9 -> x86_64-linux-gnu-gcc-nm-9
lrwxrwxrwx 1 root root     29 Mar  9 17:57 gcc-ranlib-9 -> x86_64-linux-gnu-gcc-ranlib-9
-rwxr-xr-x 1 root root   1.2M Mar  9 17:57 x86_64-linux-gnu-gcc-9
-rwxr-xr-x 1 root root    35K Mar  9 17:57 x86_64-linux-gnu-gcc-ar-9
-rwxr-xr-x 1 root root    35K Mar  9 17:57 x86_64-linux-gnu-gcc-nm-9
-rwxr-xr-x 1 root root    35K Mar  9 17:57 x86_64-linux-gnu-gcc-ranlib-9
lrwxrwxrwx 1 root root      5 Mar 20  2020 gcc -> gcc-9
lrwxrwxrwx 1 root root      8 Mar 20  2020 gcc-ar -> gcc-ar-9
lrwxrwxrwx 1 root root      8 Mar 20  2020 gcc-nm -> gcc-nm-9
lrwxrwxrwx 1 root root     12 Mar 20  2020 gcc-ranlib -> gcc-ranlib-9
lrwxrwxrwx 1 root root      5 Mar 20  2020 x86_64-linux-gnu-gcc -> gcc-9
lrwxrwxrwx 1 root root      8 Mar 20  2020 x86_64-linux-gnu-gcc-ar -> gcc-ar-9
lrwxrwxrwx 1 root root      8 Mar 20  2020 x86_64-linux-gnu-gcc-nm -> gcc-nm-9
lrwxrwxrwx 1 root root     12 Mar 20  2020 x86_64-linux-gnu-gcc-ranlib -> gcc-ranlib-9
-rwxr-xr-x 1 root root    454 Apr 11  2011 c99-gcc
-rwxr-xr-x 1 root root    428 May  7  2006 c89-gcc

@thomas-roos
Copy link
Author

thomas-roos commented May 13, 2022

Sure - we are using Yocto to build your software. Yocto builds EVERYTHING from scratch - so GCC 12 as well.
To start the build process (was written in the Readme.md in the linked github folder)
You need to build the docker container, start it and run the build for your software with yocto.
build docker container:
build -t yocto-build
run docker container
docker run -it yocto-build
build yocto
cd yocto
source poky/oe-init-build-env
bitbake aws-lc
this will take some time, need space, need cpu... depending on your machine - finally you should get the error message.
After this you can go into the environment for your software by bitbake aws-lc -c devshell (there is GCC 12 available)

@bryce-shang
Copy link
Contributor

bryce-shang commented May 20, 2022

#495 was created to address some warnings reported by gcc-12.

The build from scratch on the Docker image takes time. So, gcc-12 on Ubuntu 2022 was used to reproduce these build issues and there maybe some different compile warnings.

Let me know if this change solves the issue.

@thomas-roos
Copy link
Author

thomas-roos commented May 31, 2022

thank you, can confirm those warnings are now gone when using 038628d
Still getting when building for arch arm those warnings.txt
They can be suppressed by -Wno-array-parameter

@mikelpr
Copy link

mikelpr commented Jun 7, 2022

this isn't limited to yocto. it doesn't build on fedora 36 with GCC 12 either

@DominicDams
Copy link
Contributor

Hi I made a change several days ago that should fix the problem @thomas-roos linked to. Are you still seeing these issues when you build with the latest commit?

@thomas-roos
Copy link
Author

I still see issues as decribed here: #487 (comment)
But I've tested against latest commit (eba80de) and still get: error.log (only with arch arm)

@thomas-roos
Copy link
Author

not with arch arm64!

@DominicDams
Copy link
Contributor

Oops looks like I forgot to merge my commit in...

I'll have that merged in by eod as long as the CI still passes

@thomas-roos
Copy link
Author

Hi, please tell me the commit id that should fix the warning when it is in main.

@DominicDams
Copy link
Contributor

01ae506

@thomas-roos
Copy link
Author

great - can confirm this fixes the warnings.
Thank you!

thomas-roos pushed a commit to thomas-roos/meta-aws that referenced this issue Jun 21, 2022
thomas-roos pushed a commit to aws4embeddedlinux/meta-aws that referenced this issue Jun 21, 2022
thomas-roos pushed a commit to thomas-roos/meta-aws that referenced this issue Jul 21, 2022
thomas-roos pushed a commit to thomas-roos/meta-aws that referenced this issue Jul 29, 2022
thomas-roos pushed a commit to aws4embeddedlinux/meta-aws that referenced this issue Aug 1, 2022
thomas-roos pushed a commit to thomas-roos/meta-aws that referenced this issue Aug 3, 2022
thomas-roos pushed a commit to aws4embeddedlinux/meta-aws that referenced this issue Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants