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

Problem compiling under ppc64le #800

Closed
morvael opened this issue Jul 14, 2023 · 27 comments
Closed

Problem compiling under ppc64le #800

morvael opened this issue Jul 14, 2023 · 27 comments

Comments

@morvael
Copy link
Contributor

morvael commented Jul 14, 2023

For a long time I'm compiling each version of Netty (incl. tcnative) on my own, to create the missing epoll library for ppc64le. Upgraded from 4.1.86.Final to 4.1.94.Final (tcnative 2.0.61.Final) and it stopped compiling, because of Werror flag, which then breaks compilation after this warning:

     [exec] /usr/bin/cc -DBORINGSSL_IMPLEMENTATION -I../third_party/googletest/include -I../crypto/../include -I../crypto/fipsmodule/../../include -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wvla -Wshadow -ggdb -Wall -fvisibility=hidden -fno-common -Wno-free-nonheap-object -Wimplicit-fallthrough -Wformat-signedness -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes -D_XOPEN_SOURCE=700 -O3 -fno-omit-frame-pointer -DOPENSSL_C11_ATOMIC -fPIC -MD -MT crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.o -MF crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.o.d -o crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.o -c ../crypto/fipsmodule/bcm.c
     [exec] In file included from ../crypto/fipsmodule/bcm.c:31:
     [exec] In function ‘OPENSSL_memset’,
     [exec]     inlined from ‘bn_big_endian_to_words.constprop’ at ../crypto/fipsmodule/bn/bytes.c:76:7,
     [exec]     inlined from ‘BN_bin2bn.constprop’ at ../crypto/fipsmodule/bn/bytes.c:115:3:
     [exec] ../crypto/fipsmodule/../internal.h:857:10: error: ‘memset’ specified size 18446744073709551608 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
     [exec]    return memset(dst, c, n);
     [exec]           ^~~~~~~~~~~~~~~~~
     [exec] cc1: all warnings being treated as errors
     [exec] ninja: build stopped: subcommand failed.

OS:
CentOS Linux release 8.5.2111
Linux 4.18.0-348.7.1.el8_5.ppc64le #1 SMP Wed Dec 22 13:41:57 UTC 2021 ppc64le ppc64le ppc64le GNU/Linux

GCC:
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4)

@normanmaurer
Copy link
Member

Just ignore this warning via -W flag ? Seems like your compiler is too strict here to compile BoringSSL

@morvael
Copy link
Contributor Author

morvael commented Jul 17, 2023

Guess that requires editing build scripts, I'll try to find it. Thanks.

@morvael
Copy link
Contributor Author

morvael commented Jul 19, 2023

Deleted all Werror I have found in pom.xml of the boringssl-static project that fails to compile, yet the error above still appears. From where it does pull that Werror flag?

@normanmaurer
Copy link
Member

Maybe just add -Wno-error=stringop-overflow=

@morvael
Copy link
Contributor Author

morvael commented Jul 19, 2023

Cool, but where as it seems it ignored all my pom.xml changes.

@normanmaurer
Copy link
Member

Add to the pom.xml. Maybe your compiler set some defaults.

@morvael
Copy link
Contributor Author

morvael commented Jul 19, 2023

I think the problem is in the created build script that I have no control over in the pom:

    [mkdir] Created dir: /home/dderwi/netty/netty-tcnative/boringssl-static/target/boringssl-chromium-stable/build
     [exec] -- The C compiler identification is GNU 8.5.0
     [exec] -- Detecting C compiler ABI info
     [exec] -- Detecting C compiler ABI info - done
     [exec] -- Check for working C compiler: /usr/bin/cc - skipped
     [exec] -- Detecting C compile features
     [exec] -- Detecting C compile features - done
     [exec] -- The CXX compiler identification is GNU 8.5.0
     [exec] -- Detecting CXX compiler ABI info
     [exec] -- Detecting CXX compiler ABI info - done
     [exec] libunwind not found. Disabling unwind tests.
     [exec] -- Check for working CXX compiler: /usr/bin/c++ - skipped
     [exec] -- Detecting CXX compile features
     [exec] -- Detecting CXX compile features - done
     [exec] -- Found Perl: /usr/bin/perl (found version "5.26.3") 
     [exec] -- Checking for module 'libunwind-generic'
     [exec] --   Package 'libunwind-generic', required by 'virtual:world', not found
     [exec] -- The ASM compiler identification is GNU
     [exec] -- Found assembler: /usr/bin/cc
     [exec] -- Looking for pthread.h
     [exec] -- Looking for pthread.h - found
     [exec] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
     [exec] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
     [exec] -- Looking for pthread_create in pthreads
     [exec] -- Looking for pthread_create in pthreads - not found
     [exec] -- Looking for pthread_create in pthread
     [exec] -- Looking for pthread_create in pthread - found
     [exec] -- Found Threads: TRUE  
     [exec] -- Configuring done
     [exec] -- Generating done
     [exec] -- Build files have been written to: /home/dderwi/netty/netty-tcnative/boringssl-static/target/boringssl-chromium-stable/build
     [exec] [1/275] Generating ghashp8-ppc.S
     [exec] [2/275] Generating aesp8-ppc.S
     [exec] [3/275] Building ASM object crypto/fipsmodule/CMakeFiles/fipsmodule.dir/ghashp8-ppc.S.o
     [exec] [4/275] Building C object crypto/fipsmodule/CMakeFiles/fipsmodule.dir/fips_shared_support.c.o
     [exec] [5/275] Building ASM object crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesp8-ppc.S.o
     [exec] [6/275] Building C object crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.o
     [exec] FAILED: crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.o 
     [exec] /usr/bin/cc -DBORINGSSL_IMPLEMENTATION -I../third_party/googletest/include -I../crypto/../include -I../crypto/fipsmodule/../../include -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wvla -Wshadow -ggdb -Wall -fvisibility=hidden -fno-common -Wno-free-nonheap-object -Wimplicit-fallthrough -Wformat-signedness -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes -D_XOPEN_SOURCE=700 -O3 -fno-omit-frame-pointer -DOPENSSL_C11_ATOMIC -fPIC -MD -MT crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.o -MF crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.o.d -o crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.o -c ../crypto/fipsmodule/bcm.c
     [exec] In file included from ../crypto/fipsmodule/bcm.c:31:
     [exec] In function ‘OPENSSL_memset’,
     [exec]     inlined from ‘bn_big_endian_to_words.constprop’ at ../crypto/fipsmodule/bn/bytes.c:76:7,
     [exec]     inlined from ‘BN_bin2bn.constprop’ at ../crypto/fipsmodule/bn/bytes.c:115:3:
     [exec] ../crypto/fipsmodule/../internal.h:857:10: error: ‘memset’ specified size 18446744073709551608 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
     [exec]    return memset(dst, c, n);
     [exec]           ^~~~~~~~~~~~~~~~~
     [exec] cc1: all warnings being treated as errors
     [exec] ninja: build stopped: subcommand failed.

@morvael
Copy link
Contributor Author

morvael commented Jul 19, 2023

It's as if I should edit generate boringssl-static/target/boringssl-chromium-stable/build script in the middle of the build to add those flags there.

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

I think I need to raise this with boringssl project.

@normanmaurer
Copy link
Member

if you can provide a way for me to reproduce I might be able to help. I think it should be possible to fix this within our build scripts

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

I think that would require providing a machine with this architecture, OS, and software versions? Architecture is the most problematic, I once tried qemu ppc64le on my x86-64 and it was slowing down to a crawl... Or maybe it would trigger as well on x86-64, as only software/OS causes it?

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

Let's see first what boringssl people will say about it.

https://bugs.chromium.org/p/boringssl/issues/detail?id=632

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

Still it's puzzling, I understand the flags to compiler go via those *Flags variables but I can't see my added or removed flags affect the build:

                        <mkdir dir="${boringsslHome}" />
                        <exec executable="cmake" failonerror="true" dir="${boringsslHome}" resolveexecutable="true">
                          <arg value="-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE" />
                          <arg value="-DCMAKE_BUILD_TYPE=Release" />
                          <arg value="-DCMAKE_ASM_FLAGS=${cmakeAsmFlags}" />
                          <arg value="-DCMAKE_C_FLAGS_RELEASE=${cmakeCFlags}" />
                          <arg value="-DCMAKE_CXX_FLAGS_RELEASE=${cmakeCxxFlags}" />
                          <arg value="-DCMAKE_SYSTEM_PROCESSOR=x86_64" />
                          <arg value="-DCMAKE_OSX_ARCHITECTURES=x86_64" />
                          <arg value="${cmakeOsxDeploymentTarget}" />
                          <arg value="-GNinja" />
                          <arg value="${boringsslSourceDir}" />
                        </exec>
                        <if>
                          <!-- may be called ninja-build or ninja -->
                          <!-- See https://github.com/netty/netty-tcnative/issues/475 -->
                          <available file="ninja-build" filepath="${env.PATH}" />
                          <then>
                            <property name="ninjaExecutable" value="ninja-build" />
                          </then>
                          <else>
                            <property name="ninjaExecutable" value="ninja" />
                          </else>
                        </if>
                        <exec executable="${ninjaExecutable}" failonerror="true" dir="${boringsslHome}" resolveexecutable="true" />

@normanmaurer
Copy link
Member

Please show me the diff

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

I think I have found it by correct backtracking. It seems to compile. Will soon show my diff. Thank you for persevering with amateurish me.

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

So while removing Werror flags was easy (just search & replace), adding the no-error one in the right place was more tricky as it required finding the right place :) I have simply added it in wrong place yesterday (too many cflags variables all over the pom).

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

diff --git a/boringssl-static/pom.xml b/boringssl-static/pom.xml
index f013c97..0895cf7 100644
--- a/boringssl-static/pom.xml
+++ b/boringssl-static/pom.xml
@@ -200,7 +200,7 @@
                               <!-- On *nix, add ASM flags to disable executable stack -->
                               <property name="cmakeAsmFlags" value="-Wa,--noexecstack" />
                               <!-- Use -DOPENSSL_C11_ATOMIC so we replace most of the locking code with atomics-->
-                              <property name="cmakeCFlags" value="-O3 -fno-omit-frame-pointer -DOPENSSL_C11_ATOMIC" />
+                              <property name="cmakeCFlags" value="-O3 -fno-omit-frame-pointer -DOPENSSL_C11_ATOMIC -Wno-error=stringop-overflow" />
                               <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
                               <property name="cmakeCxxFlags" value="-O3 -fno-omit-frame-pointer -Wno-error=maybe-uninitialized -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" />
                             </then>

Can this be added to upstream tcnative? Maybe even make it tied to this specific architecture/OS?

@normanmaurer
Copy link
Member

I think we can just add it without tie to to a specific platform. Want to do a PR ?

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

I finally have to do it for the first time, never did, and always end up like a pleb who doesn't know how to make a PR :)

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

So give me a while please...

@normanmaurer
Copy link
Member

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

Yes, was reading through that. I understand I need the fork variant, as I'm not able to create my own branch here?

@normanmaurer
Copy link
Member

normanmaurer commented Jul 20, 2023 via email

@morvael
Copy link
Contributor Author

morvael commented Jul 20, 2023

#803

normanmaurer pushed a commit that referenced this issue Jul 20, 2023
Motivation:

We need ignore a warning when compiling on some platforms when building BoringSSL as otherwise the compilation fails.

Modifications:

Adds -Wno-error=stringop-overflow flag to BoringSSL compilation so that
it starts working again on specific OS/architecture configuration.

Result:

Fixes #800
@davidben
Copy link
Contributor

Note BoringSSL no longer supports ppcle64:
https://boringssl-review.googlesource.com/c/boringssl/+/56389

@normanmaurer
Copy link
Member

@davidben thanks for clarify.

@morvael
Copy link
Contributor Author

morvael commented Jul 21, 2023

I do not think I use it in any way, I just need tcnative project to compile, to later compile netty, and finally get epoll native jar with the linux-ppcle_64 classifier.

@normanmaurer can I delete the forked repo now?

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

3 participants