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

Fix build error with cmake because of missing c++11/14 features. #2191

Merged
merged 2 commits into from
Dec 23, 2021
Merged

Fix build error with cmake because of missing c++11/14 features. #2191

merged 2 commits into from
Dec 23, 2021

Conversation

waterdropw
Copy link
Contributor

@waterdropw waterdropw commented Dec 22, 2021

[6/3615] Building CXX object CMakeFiles/jit.dir/src/jit/aarch32-assembler.cc.o
FAILED: CMakeFiles/jit.dir/src/jit/aarch32-assembler.cc.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DPTHREADPOOL_NO_DEPRECATED_API=1 -DXNN_ENABLE_ASSEMBLY=0 -DXNN_ENABLE_MEMOPT=1 -DXNN_ENABLE_SPARSE=1 -DXNN_LOG_LEVEL=0 -I../include -I../src -Iclog-source/deps/clog/include -Ipthreadpool-source/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -MD -MT CMakeFiles/jit.dir/src/jit/aarch32-assembler.cc.o -MF CMakeFiles/jit.dir/src/jit/aarch32-assembler.cc.o.d -o CMakeFiles/jit.dir/src/jit/aarch32-assembler.cc.o -c ../src/jit/aarch32-assembler.cc
In file included from ../src/jit/aarch32-assembler.cc:6:
../src/xnnpack/aarch32-assembler.h:16:1: error: unknown type name 'constexpr'
constexpr size_t kInstructionSizeInBytes = 4;
^
../src/xnnpack/aarch32-assembler.h:16:17: error: expected ';' after top level declarator
constexpr size_t kInstructionSizeInBytes = 4;
                ^
                ;
../src/xnnpack/aarch32-assembler.h:18:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
enum class SpecialFPRegister {
     ^
../src/xnnpack/aarch32-assembler.h:22:1: error: unknown type name 'constexpr'
constexpr SpecialFPRegister FPSCR = SpecialFPRegister::kFPSCR;
^
../src/xnnpack/aarch32-assembler.h:22:28: error: expected ';' after top level declarator
constexpr SpecialFPRegister FPSCR = SpecialFPRegister::kFPSCR;
                           ^
                           ;
../src/xnnpack/aarch32-assembler.h:28:1: error: unknown type name 'constexpr'
constexpr CoreRegister r0{0};
^
../src/xnnpack/aarch32-assembler.h:28:23: error: expected ';' after top level declarator
constexpr CoreRegister r0{0};
                      ^
                      ;
../src/xnnpack/aarch32-assembler.h:29:1: error: unknown type name 'constexpr'
constexpr CoreRegister r1{1};
^
../src/xnnpack/aarch32-assembler.h:29:23: error: expected ';' after top level declarator
constexpr CoreRegister r1{1};
                      ^
                      ;
../src/xnnpack/aarch32-assembler.h:30:1: error: unknown type name 'constexpr'
constexpr CoreRegister r2{2};
^
../src/xnnpack/aarch32-assembler.h:30:23: error: expected ';' after top level declarator
constexpr CoreRegister r2{2};
                      ^
                      ;
../src/xnnpack/aarch32-assembler.h:31:1: error: unknown type name 'constexpr'
constexpr CoreRegister r3{3};
^
../src/xnnpack/aarch32-assembler.h:31:23: error: expected ';' after top level declarator
constexpr CoreRegister r3{3};
                      ^
                      ;
../src/xnnpack/aarch32-assembler.h:32:1: error: unknown type name 'constexpr'
constexpr CoreRegister r4{4};
^
../src/xnnpack/aarch32-assembler.h:32:23: error: expected ';' after top level declarator
constexpr CoreRegister r4{4};
                      ^
                      ;
../src/xnnpack/aarch32-assembler.h:33:1: error: unknown type name 'constexpr'
constexpr CoreRegister r5{5};
^
../src/xnnpack/aarch32-assembler.h:33:23: error: expected ';' after top level declarator
constexpr CoreRegister r5{5};
                      ^
                      ;
../src/xnnpack/aarch32-assembler.h:34:1: error: unknown type name 'constexpr'
constexpr CoreRegister r6{6};
^
../src/xnnpack/aarch32-assembler.h:34:23: error: expected ';' after top level declarator
constexpr CoreRegister r6{6};
                      ^
                      ;
../src/xnnpack/aarch32-assembler.h:35:1: error: unknown type name 'constexpr'
constexpr CoreRegister r7{7};
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
[19/3615] Building CXX object CMakeFiles/qs8-igemm-minmax-fp32-test.dir/test/qs8-igemm-minmax-fp32.cc.o
ninja: build stopped: subcommand failed.

@waterdropw waterdropw changed the title Fix build error with cmake for jit, convert-bench, aarch32-assembler-test, because of missing dependency. Fix build error with cmake because of missing c++11/14 features. Dec 22, 2021
CMakeLists.txt Outdated
@@ -5570,7 +5570,10 @@ ADD_LIBRARY(all_microkernels OBJECT ${ALL_MICROKERNEL_SRCS} ${TABLE_SRCS})
ADD_LIBRARY(indirection OBJECT src/indirection.c)
ADD_LIBRARY(packing OBJECT src/packing.c)
ADD_LIBRARY(jit OBJECT ${JIT_SRCS})

SET_TARGET_PROPERTIES(jit PROPERTIES
CXX_STANDARD 14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is C++11 sufficient to make the build pass? If so, lower to C++11

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constexpr is in c++11, but still need c++14 to resolve errors like this:

[1/2] Building CXX object CMakeFiles/jit.dir/src/jit/aarch32-assembler.cc.o
FAILED: CMakeFiles/jit.dir/src/jit/aarch32-assembler.cc.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DPTHREADPOOL_NO_DEPRECATED_API=1 -DXNN_ENABLE_ASSEMBLY=0 -DXNN_ENABLE_MEMOPT=1 -DXNN_ENABLE_SPARSE=1 -DXNN_LOG_LEVEL=0 -I../include -I../src -Iclog-source/deps/clog/include -Ipthreadpool-source/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -std=c++11 -MD -MT CMakeFiles/jit.dir/src/jit/aarch32-assembler.cc.o -MF CMakeFiles/jit.dir/src/jit/aarch32-assembler.cc.o.d -o CMakeFiles/jit.dir/src/jit/aarch32-assembler.cc.o -c ../src/jit/aarch32-assembler.cc
../src/jit/aarch32-assembler.cc:492:23: warning: missing terminating ' character [-Winvalid-pp-token]
  return emit32(0xF400'0000 | encode(regs.start, 22, 12) | op.base().code << 16 | type << 8 | size << 6 | rm);
                      ^
../src/jit/aarch32-assembler.cc:492:23: error: expected ')'
../src/jit/aarch32-assembler.cc:492:16: note: to match this '('
  return emit32(0xF400'0000 | encode(regs.start, 22, 12) | op.base().code << 16 | type << 8 | size << 6 | rm);
               ^
../src/jit/aarch32-assembler.cc:507:23: warning: missing terminating ' character [-Winvalid-pp-token]
  return emit32(0xF400'0000 | encode(regs.start, 22, 12) | op.base().code << 16 | type << 8 | size << 6 | rm.code);
                      ^
../src/jit/aarch32-assembler.cc:507:23: error: expected ')'
../src/jit/aarch32-assembler.cc:507:16: note: to match this '('
  return emit32(0xF400'0000 | encode(regs.start, 22, 12) | op.base().code << 16 | type << 8 | size << 6 | rm.code);
               ^
../src/jit/aarch32-assembler.cc:518:23: warning: missing terminating ' character [-Winvalid-pp-token]
  return emit32(0xF480'0000 | encode(dd, 22, 12) | op.base().code << 16 | size << 10 | dd.lane << shift | rm);
                      ^
../src/jit/aarch32-assembler.cc:518:23: error: expected ')'
../src/jit/aarch32-assembler.cc:518:16: note: to match this '('
  return emit32(0xF480'0000 | encode(dd, 22, 12) | op.base().code << 16 | size << 10 | dd.lane << shift | rm);
               ^
3 warnings and 3 errors generated.
ninja: build stopped: subcommand failed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please lower the setting to C++11. The C++14 literals will be converted to C++11 in #2192.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, done~

@copybara-service copybara-service bot merged commit 7a03a0f into google:master Dec 23, 2021
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

Successfully merging this pull request may close these issues.

2 participants