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

Apple M1 编译报错 #393

Open
xiaodp opened this issue May 9, 2024 · 3 comments
Open

Apple M1 编译报错 #393

xiaodp opened this issue May 9, 2024 · 3 comments
Labels
good first issue Good for newcomers question Further information is requested

Comments

@xiaodp
Copy link

xiaodp commented May 9, 2024

Question

环境信息( 工具版本均符合文档要求):

➜  miniob git:(main) uname -a
Darwin MacBook-Pro-3.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:15:52 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8112 arm64
➜  miniob git:(main) cmake --version
cmake version 3.25.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
➜  miniob git:(main) clang --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
➜  miniob git:(main) g++ --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

➜  miniob git:(main) flex --version
flex 2.6.4 Apple(flex-34)
➜  miniob git:(main) bison --version
bison (GNU Bison) 3.8.2
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

编译步骤:

  1. git clone https://github.com/oceanbase/miniob.git
  2. cd miniob
  3. sudo bash build.sh init --这一步ok
  4. bash build.sh --这一步报错
  5. 查看已经生成了 二进制文件
➜  build_debug git:(main) ✗ tree bin
bin
├── arithmetic_expression_test
├── bitmap_test
├── bp_manager_test
├── bplus_tree_log_entry_test
├── bplus_tree_log_test
├── bplus_tree_test
├── client_performance_test
├── clog_dump
├── miniob
│   └── db
│       └── sys
│           ├── dblwr.db
│           └── sys.db
├── obclient
├── observer
└── observer.log.20240509
  1. 启动observer ./observer
➜  bin git:(main) ✗ ./observer

Welcome to the OceanBase database implementation course.

Copyright (c) 2021 OceanBase and/or its affiliates.

Learn more about OceanBase at https://github.com/oceanbase/oceanbase
Learn more about MiniOB at https://github.com/oceanbase/miniob

Successfully load ../etc/observer.ini
Not set log file name, use default observer.log
Output configuration
Begin dump configuration
[]

Finish dump configuration

Db already exists: sys
Extend one pool, this->size:128, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:256, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:384, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:512, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:640, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:768, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:896, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:1024, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:1152, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:1280, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:1408, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:1536, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:1664, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:1792, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:1920, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:2048, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:2176, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:2304, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:2432, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:2560, item_num_per_pool:128, this->name:BufPool.
Extend one pool, this->size:2560, item_num_per_pool:128, this->name:BufPool.
buffer pool manager init with memory size 20971520, page num: 2560, pool num: 20
double write buffer load pages done. page num=0
Successfully read db meta file. db=sys, file=miniob/db/sys/sys.db, check_point_lsn=0
All table have been opened. num=0
Successfully recover db. db=sys checkpoint_lsn=0
Default handler init with miniob success
Successfully init utility
Listen on port 6789
Observer start success
  1. 启动客户端 ./obclient, 执行基本的show/select报错,不确定是否为编译的问题
➜  bin git:(main) ✗ ./obclient

Welcome to the OceanBase database implementation course.

Copyright (c) 2021 OceanBase and/or its affiliates.

Learn more about OceanBase at https://github.com/oceanbase/oceanbase
Learn more about MiniOB at https://github.com/oceanbase/miniob

miniob > show databases;
SQL_SYNTAX > Failed to parse sql
miniob > show tables;
Tables_in_SYS
miniob > select * from Tables_in_SYS
FAILURE
miniob >

编译过程中打印信息如下:

执行sudo bash build.sh init 的输出(看起来没有error):
output.md

执行bash build.sh报fatal error: too many errors emitted, stopping now [-ferror-limit=]
image

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [unittest/CMakeFiles/buffer_pool_log_test.dir/buffer_pool_log_test.cpp.o] Error 1
make[1]: *** [unittest/CMakeFiles/buffer_pool_log_test.dir/all] Error 2
make: *** [all] Error 2
@xiaodp xiaodp added the question Further information is requested label May 9, 2024
@hnwyllmm
Copy link
Collaborator

hnwyllmm commented May 9, 2024

observer和obclient编译都成功了,执行SQL错误是因为你的SQL确实有问题,比如当前不支持show databases命令。
编译出问题的这个是一个单测。我本地也是apple m1+clang 14,但是无法重现你的问题。

@hnwyllmm
Copy link
Collaborator

hnwyllmm commented May 9, 2024

看报错信息是由于lambda中某些变量没有捕获导致的,可以把 ranges::for_each 改成 for 写法,或者把lambda的参数捕获改成 &,比如

ranges::for_each(buffer_pools, [](DiskBufferPool *buffer_pool) {
        Frame *frame = nullptr;
        ASSERT_EQ(RC::SUCCESS, buffer_pool->allocate_page(&frame));
        ASSERT_EQ(RC::SUCCESS, buffer_pool->unpin_page(frame));
      });

改成:

ranges::for_each(buffer_pools, [&](DiskBufferPool *buffer_pool) { // [] 变成了 [&]
        Frame *frame = nullptr;
        ASSERT_EQ(RC::SUCCESS, buffer_pool->allocate_page(&frame));
        ASSERT_EQ(RC::SUCCESS, buffer_pool->unpin_page(frame));
      });

@hnwyllmm hnwyllmm added the good first issue Good for newcomers label May 10, 2024
@xiaodp
Copy link
Author

xiaodp commented May 11, 2024

再另外的一台m1 电脑上编译,也没有此问题,忽略掉好了。感谢回复~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants