[MDEV-17103] tokudb doesn't build with gcc8 due to warning Created: 2018-08-31  Updated: 2021-01-09  Resolved: 2019-06-05

Status: Closed
Project: MariaDB Server
Component/s: Compiling, Storage Engine - TokuDB
Affects Version/s: 10.3
Fix Version/s: 10.2.25, 10.1.41, 10.3.16, 10.4.6

Type: Bug Priority: Major
Reporter: Noel Kuntze Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None
Environment:

Arch Linux, gcc8


Attachments: File CMakeError.log     File CMakeOutput.log    
Issue Links:
Duplicate
duplicates MDEV-18273 CMake Error at storage/tokudb/Percona... Closed
Relates
relates to MDEV-19690 Use different macros for C and C++ co... Closed

 Description   

The CMake code of the tokudb build files sets and checks the following cflags:

set_cflags_if_supported(
  -Wextra
  -Wbad-function-cast
  -Wno-missing-noreturn
  -Wstrict-prototypes
  -Wmissing-prototypes
  -Wmissing-declarations
  -Wpointer-arith
  #-Wshadow will fail with GCC-8
  ${OPTIONAL_CFLAGS}
  ## other flags to try:
  #-Wunsafe-loop-optimizations
  #-Wpointer-arith
  #-Wc++-compat
  #-Wc++11-compat
  #-Wwrite-strings
  #-Wzero-as-null-pointer-constant
  #-Wlogical-op
  #-Wvector-optimization-performance
  )

Of those, the following produce a warning with gcc8 with cause CMake to abort the compilation. Therefore they have to be removed. This pertains all versions. It probably does not trigger with old CMake versions or older gcc versions that do not print those warnings.

-Wbad-function-cast
-Wstrict-prototypes
-Wmissing-prototypes

Warnings:
cc1plus: warning: command line option '-Wbad-function-cast' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++



 Comments   
Comment by Noel Kuntze [ 2019-05-29 ]

More wrong cflags:
-fimplicit-templates
-std=c++11
-Wstrict-null-sentinel
-Wtautological-constant-out-of-range-compare
-Waddress-of-array-temporary

Comment by Noel Kuntze [ 2019-05-30 ]

I wrote a rather large patch that seperates the handling of CFLAGS and CXXFLAGS to make sure invalid options are never passed to the corresponding compiler. The patch is in total around 600 lines.

Comment by Noel Kuntze [ 2019-06-04 ]

PR 1318 on GH (https://github.com/MariaDB/server/pull/1318)

Comment by Sergei Golubchik [ 2019-06-05 ]

I don't get it. First, I have gcc8 and everything compiles fine. Second, MY_CHECK_AND_SET_COMPILER_FLAG macro checks C and C++ separately and does not enable C++ flags for C or vice versa.

Why one would need to separate options into C and C++ manually (which is error prone and, quite probably, depends on the compiler version) when currently cmake does all that automatically? Or at least is supposed to.

Comment by Vladislav Vaintroub [ 2019-06-05 ]

maybe thermi could attach build log to the bug so we get an idea. Also CMakeFiles/CMakeOutput.log and CMakeFiles/CMakeError.log, in tar.gz or zip

Comment by Noel Kuntze [ 2019-06-05 ]

I just figured out that the problem is only caused when LANG is not set to C.
CMakeOutput.log and CMakeError.log are attached. CMakeOutput.log CMakeError.log

Comment by Vladislav Vaintroub [ 2019-06-05 ]

SET(fail_patterns) in cmake/check_compiler_flag.cmake muß ein wenig Deutsch üben.

serg, was meinst Du dazu?

Comment by Vladislav Vaintroub [ 2019-06-05 ]

maybe

 
 set(ENV{LANG}  C)

in MY_CHECK_C_COMPILER_FLAG,MY_CHECK_CXX_COMPILER_FLAG helps

thermi, kannst Du ausprobieren ob es hilft?

Comment by Noel Kuntze [ 2019-06-05 ]

Yes, that works and makes all the CMake tests pass.

Comment by Sergei Golubchik [ 2019-06-05 ]

Great, that explains it. Thanks!

Generated at Thu Feb 08 08:33:56 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.