stoneatom / stonedb

StoneDB is an Open-Source MySQL HTAP and MySQL-Native DataBase for OLTP, Real-Time Analytics, a counterpart of MySQLHeatWave. (https://stonedb.io)
https://stonedb.io/
GNU General Public License v2.0
861 stars 139 forks source link

bug(tianmu): engine tianmu make error: "Unsupported system." on Apple M1. #696

Open zhouji1993 opened 1 year ago

zhouji1993 commented 1 year ago

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

Describe the problem

/Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/core/bin_tools.h:65:11: warning: dereference of type 'int64_t ' (aka 'long long ') that was reinterpret_cast from type 'const double ' has undefined behavior [-Wundefined-reinterpret-cast] return reinterpret_cast<int64_t >(const_cast<double >(&d)) == common::NULL_VALUE_64; ^~~~~~~~~~~~~ /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/core/bin_tools.h:75:2: error: "Unsupported system."

error "Unsupported system."

^ /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/core/bin_tools.h:68:28: warning: unused parameter 'x' [-Wunused-parameter] inline uint GetBitLen(uint x) { ^ /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/core/bin_tools.h:86:2: error: "Unsupported system."

error "Unsupported system."

^ /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/core/bin_tools.h:79:32: warning: unused parameter 'x' [-Wunused-parameter] inline uint GetBitLen(uint64_t x) { ^ In file included from /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/common/txt_data_format.cpp:20: In file included from /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/exporter/data_exporter.h:23: In file included from /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/system/channel_out.h:24: /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/types/rc_data_types.h:200:3: warning: '~BString' overrides a destructor but is not marked 'override' [-Winconsistent-missing-destructor-override] ~BString(); ^ /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/types/rc_data_types.h:170:7: note: overridden virtual function is here class ValueBasic : public RCDataType { ^ /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/types/rc_data_types.h:301:3: warning: '~RCDateTime' overrides a destructor but is not marked 'override' [-Winconsistent-missing-destructor-override] ~RCDateTime(); ^ /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/types/rc_data_types.h:170:7: note: overridden virtual function is here class ValueBasic : public RCDataType { ^ In file included from /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/common/txt_data_format.cpp:20: In file included from /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/exporter/data_exporter.h:24: In file included from /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/system/large_buffer.h:26: In file included from /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/mm/traceable_object.h:24: /Users/zhouji/Desktop/Opensouce/stonedb/stonedb/storage/tianmu/core/tools.h:169:3: error: defaulted definition of copy assignment operator is not constexpr constexpr TOCoordinate &operator=(const TOCoordinate &) = default; ^

Expected behavior

No response

How To Reproduce

No response

Environment

m1 macos 12.6. rocksdb v7.5.3 make error

Are you interested in submitting a PR to solve the problem?

hustjieke commented 1 year ago

@zhouji1993 Thanks for reporting this problem, we look forward to your pr!

RingsC commented 1 year ago

@zhouji1993 , which c++ compiler do you use? g++ or clang or something else. and the version of that?

RingsC commented 1 year ago

These lines issue the errors in compiling.

 68 inline uint GetBitLen(uint x) {
 69 #ifdef __x86_64__
 70   uint position;
 71   if (!x) return 0;
 72   asm("bsrl %1, %0" : "=r"(position) : "r"(x));
 73   return position + 1;
 74 #else
 75 #error "Unsupported system."
 76 #endif
 77 }
 78 
 79 inline uint GetBitLen(uint64_t x) {
 80 #ifdef __x86_64__
 81   uint64_t position;
 82   if (!x) return 0;
 83   asm("bsr %1, %0" : "=r"(position) : "r"(x));
 84   return (uint)position + 1;
 85 #else
 86 #error "Unsupported system."
 87 #endif
 88 }
RingsC commented 1 year ago

Ref to page 131 at apple mac assembler The doc describe as following: |bsr | bsr | r/m16,r16| Bit Scan Reverse|

and the identifier of ISA (instruction set architecture). @ (here)[https://sourceforge.net/p/predef/wiki/Architectures/]

ref: https://opensource.apple.com/source/WTF/WTF-7601.1.46.42/wtf/Platform.h.auto.html

zhouji1993 commented 1 year ago

gcc version Apple clang version 14.0.0 (clang-1400.0.29.102)