...
When compiling Mongo core components on a Power9 with GCC 7 (Advance Toolchain 11.02) Got following error, opt/at11.0/bin/gcc -o build/opt/third_party/wiredtiger/src/block/block_compact.o -c -std=c11 -fno-omit-frame-pointer -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O2 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-const-variable -Wno-unused-but-set-variable -Wno-missing-braces -fstack-protector-strong -fno-builtin-memcmp -fPIE -DPCRE_STATIC -DNDEBUG -D_FORTIFY_SOURCE=2 -DBOOST_THREAD_VERSION=4 -DBOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS -DBOOST_THREAD_HAS_NO_EINTR_BUG -DHAVE_VERBOSE -DHAVE_FALLOCATE -DHAVE_SYNC_FILE_RANGE -DHAVE_X86INTRIN_H -D_GNU_SOURCE -DHAVE_BUILTIN_EXTENSION_ZLIB -DHAVE_BUILTIN_EXTENSION_SNAPPY -DHAVE_CRC32_HARDWARE -Isrc/third_party/snappy-1.1.3 -Isrc/third_party/zlib-1.2.8 -Ibuild/opt/third_party/wiredtiger -Isrc/third_party/wiredtiger -Ibuild/opt/third_party/wiredtiger/src/include -Isrc/third_party/wiredtiger/src/include -Ibuild/opt/third_party/wiredtiger/build_linux -Isrc/third_party/wiredtiger/build_linux src/third_party/wiredtiger/src/block/block_compact.c In file included from src/third_party/wiredtiger/src/include/wt_internal.h:384:0, from src/third_party/wiredtiger/src/async/async_api.c:9: src/third_party/wiredtiger/src/include/cursor.i: In function '__cursor_func_init': src/third_party/wiredtiger/src/include/cursor.i:234:6: error: used vector type where scalar is required if (reenter) { ^~~~~~~ In file included from src/third_party/wiredtiger/src/include/btree_cmp.i:11:0, from src/third_party/wiredtiger/src/include/wt_internal.h:382, from src/third_party/wiredtiger/src/async/async_op.c:9: The reason of this is that gcc used -DHAVE_X86INTRIN_H which was generated by ==================================================================================== ./src/third_party/wiredtiger/SConscript if conf.CheckCHeader('x86intrin.h'): conf.env.Append(CPPDEFINES=[ "HAVE_X86INTRIN_H" ]) ===================================================================================== I was told GCC 7 and later version will have the file, x86intrin.h, included, is there a way we could avoid it if the target platform is not x86? Thanks
calvins@us.ibm.com commented on Thu, 11 Jan 2018 22:07:47 +0000: Yes, I compiled with --disable-warnings-as-errors, since I encountered the same issue as, https://jira.mongodb.org/browse/SERVER-30711 mark.benvenuto commented on Thu, 11 Jan 2018 21:45:02 +0000: Are you compiling with "--disable-warnings-as-errors"? The other issue is a known issue: SERVER-32161 When I tried this locally, we did not pick up "x86intrin.h" because of the warning: /opt/at11.0/bin/gcc -o build/scons/opt/sconf_temp/conftest_67.o -c -std=c11 -fno-omit-frame-pointer -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -O2 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-const-variable -Wno-unused-but-set-variable -Wno-missing-braces -fstack-protector-strong -fno-builtin-memcmp -fPIE -DPCRE_STATIC -DNDEBUG -D_FORTIFY_SOURCE=2 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -DHAVE_VERBOSE -DHAVE_FALLOCATE -DHAVE_SYNC_FILE_RANGE -Isrc/third_party/snappy-1.1.3 -Isrc/third_party/zlib-1.2.8 -Ibuild/opt/third_party/wiredtiger -Isrc/third_party/wiredtiger -I/data2/mark/opt/at11.0/lib/gcc/powerpc64le-linux-gnu/7.2.1/include -Ibuild/opt/third_party/wiredtiger/src/include -Isrc/third_party/wiredtiger/src/include build/scons/opt/sconf_temp/conftest_67.c In file included from build/scons/opt/sconf_temp/conftest_67.c:2:0: /data2/mark/opt/at11.0/lib/gcc/powerpc64le-linux-gnu/7.2.1/include/x86intrin.h:32:2: error: #warning "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this warning." [-Werror=cpp] #warning "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this warning." ^~~~~~~ In file included from /data2/mark/opt/at11.0/lib/gcc/powerpc64le-linux-gnu/7.2.1/include/x86intrin.h:39:0, from build/scons/opt/sconf_temp/conftest_67.c:2: /data2/mark/opt/at11.0/lib/gcc/powerpc64le-linux-gnu/7.2.1/include/mmintrin.h:52:2: error: #warning "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this warning." [-Werror=cpp] bergner commented on Thu, 11 Jan 2018 17:42:56 +0000: Ok, I have verified the fix above does allow both the AT10 and AT11 builds to succeed. bergner commented on Thu, 11 Jan 2018 17:15:59 +0000: Ok, using AT11 to build mongodb git sources, I need an additional patch to fix a problem wrt ucontext usage in mongodb caused by a recent glibc change. That glibc change is described here: https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27struct_ucontext.27 With the following patch, I get a successful build. I do want to rerun the AT10 build to make sure the ucontext change doesn't affect that build. diff --git a/src/third_party/gperftools-2.5/src/stacktrace_powerpc-linux-inl.h b/src/third_party/gperftools-2.5/src/stacktrace_powerpc-linux-inl.h index 5d16fa1..7654c53 100644 — a/src/third_party/gperftools-2.5/src/stacktrace_powerpc-linux-inl.h +++ b/src/third_party/gperftools-2.5/src/stacktrace_powerpc-linux-inl.h @@ -51,8 +51,9 @@ #include #elif defined(HAVE_UCONTEXT_H) #include // for ucontext_t -#endif +#else typedef ucontext ucontext_t; +#endif // PowerPC64 Little Endian follows BE wrt. backchain, condition register, // and LR save area, so no need to adjust the reading struct. diff --git a/src/third_party/wiredtiger/SConscript b/src/third_party/wiredtiger/SConscript index 1e07852..9f8df66 100644 — a/src/third_party/wiredtiger/SConscript +++ b/src/third_party/wiredtiger/SConscript @@ -36,7 +36,7 @@ if conf.CheckFunc("sync_file_range"): "HAVE_SYNC_FILE_RANGE" ]) -if conf.CheckCHeader('x86intrin.h'): +if (env['TARGET_ARCH'] == 'x86_64' and conf.CheckCHeader('x86intrin.h')): conf.env.Append(CPPDEFINES=[ "HAVE_X86INTRIN_H" ]) calvins@us.ibm.com commented on Thu, 11 Jan 2018 16:42:34 +0000: Hi Mark, I tried both 3.4.4 and 3.6.1 Mongodb, both have this issue. The AT version I used is 11.0.2, You are right, the 11.0 does not have the x86intrin.h file mark.benvenuto commented on Thu, 11 Jan 2018 16:29:56 +0000: What version of MongoDB are you building? After I make the fix, I want to make sure I backport it the right release. bergner commented on Thu, 11 Jan 2018 15:41:24 +0000: Slight typo (missing ')') on the patch which I'm testing now. diff --git a/src/third_party/wiredtiger/SConscript b/src/third_party/wiredtiger/SConscript index 5d36706..529bd9f 100644 — a/src/third_party/wiredtiger/SConscript +++ b/src/third_party/wiredtiger/SConscript @@ -41,7 +41,7 @@ if conf.CheckFunc("sync_file_range"): "HAVE_SYNC_FILE_RANGE" ]) -if conf.CheckCHeader('x86intrin.h'): +if (env['TARGET_ARCH'] == 'x86_64' and conf.CheckCHeader('x86intrin.h')): conf.env.Append(CPPDEFINES=[ "HAVE_X86INTRIN_H" ]) bergner commented on Thu, 11 Jan 2018 01:48:56 +0000: Please note that this is NOT an AT 11 issue. Current GCC trunk (soon to be GCC 8) will also have the x86intrin.h file added as Bill mentions, so future distro compilers will also hit this issue. This is noticed in AT 11, because the x86 intrinsic compat support was back ported to AT 11. That said, I had a look at SConscript, and maybe we can solve this problem with the following patch? — src/third_party/wiredtiger/SConscript.orig 2018-01-10 19:35:50.532058937 -0600 +++ src/third_party/wiredtiger/SConscript 2018-01-10 19:37:23.992631076 -0600 @@ -41,7 +41,7 @@ "HAVE_SYNC_FILE_RANGE" ]) -if conf.CheckCHeader('x86intrin.h'): +if (env['TARGET_ARCH'] == 'x86_64' and conf.CheckCHeader('x86intrin.h'): conf.env.Append(CPPDEFINES=[ "HAVE_X86INTRIN_H" ]) wschmidt commented on Wed, 10 Jan 2018 23:08:43 +0000: The most recent version of AT 11.0 added this file as an aid to help people port x86 vector intrinsics to Power VSX intrinsics. It should only be used when building an application if neither generic code nor Power-specific code is available. It contains a #warning (soon to be changed to an #error) that including the file should only be done under control of a specific -D define. Using an #error would have caught this problem sooner. Usual configury practice is to test whether a function provided by an include file succeeds. Would this be possible? mark.benvenuto commented on Wed, 10 Jan 2018 22:47:55 +0000: What version of MongoDB are you compiling? Are you cross-compiling? The header file should only exist on x86 and so scons should not have defined that flag. I cannot find it in AT 11.0 for instance on my RHEL 7 PPC64LE box.