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 on Apple Silicon Mac #219

Merged
merged 8 commits into from
Feb 6, 2021
Merged

Conversation

sticnarf
Copy link

@sticnarf sticnarf commented Dec 10, 2020

  1. Backport Fix compilation on Apple Silicon facebook/rocksdb#7714 from upstream.
  2. uname -m on the new Apple Silicon Mac outputs arm64. The ARMv8 CRC check in the cmake file is changed.
  3. Do not treat arm darwin as iOS.

With this PR, cmake .. -DWITH_GFLAGS=OFF -DWITH_TESTS=OFF -DWITH_TOOLS=OFF outputs:

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is Clang
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Found Git: /usr/bin/git (found version "2.24.3 (Apple Git-128)") 
-- Performing Test HAVE_OMIT_LEAF_FRAME_POINTER
-- Performing Test HAVE_OMIT_LEAF_FRAME_POINTER - Success
-- Performing Test HAS_ARMV8_CRC
-- Performing Test HAS_ARMV8_CRC - Success
--  HAS_ARMV8_CRC yes
-- Performing Test HAVE_SSE42
-- Performing Test HAVE_SSE42 - Failed
-- Performing Test HAVE_THREAD_LOCAL
-- Performing Test HAVE_THREAD_LOCAL - Success
-- Enabling RTTI in Debug builds only (default)
-- Performing Test HAVE_FALLOCATE
-- Performing Test HAVE_FALLOCATE - Failed
-- Performing Test HAVE_SYNC_FILE_RANGE_WRITE
-- Performing Test HAVE_SYNC_FILE_RANGE_WRITE - Failed
-- Performing Test HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
-- Performing Test HAVE_PTHREAD_MUTEX_ADAPTIVE_NP - Failed
-- Looking for malloc_usable_size
-- Looking for malloc_usable_size - not found
-- Looking for sched_getcpu
-- Looking for sched_getcpu - not found
-- Looking for getauxval
-- Looking for getauxval - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- JNI library is disabled
-- Configuring done
-- Generating done

And then, make rocksdb -j4 succeeds.

Signed-off-by: Yilin Chen <sticnarf@gmail.com>
@sticnarf
Copy link
Author

PTAL @yiwu-arbug

@@ -217,14 +217,14 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
endif(HAS_ALTIVEC)
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")

if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64|arm64")
Copy link
Member

Choose a reason for hiding this comment

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

why the original PR of rocksdb doesn't have this problem?

Copy link
Author

Choose a reason for hiding this comment

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

The developer of that PR uses an early DTK. The CPU of the DTK is different from an M1.

I don't know if it's due to system or CPU updates, however.

yiwu-arbug added 3 commits December 13, 2020 15:01
Signed-off-by: yiwu-arbug <yiwu@pingcap.com>
Signed-off-by: yiwu-arbug <yiwu@pingcap.com>
Signed-off-by: yiwu-arbug <yiwu@pingcap.com>
@yiwu-arbug
Copy link
Collaborator

arm build fails, haven't check what's the cause.

@yiwu-arbug yiwu-arbug self-requested a review December 14, 2020 02:10
yiwu-arbug pushed a commit to tikv/titan that referenced this pull request Dec 14, 2020
Do the same cmake change in tikv/rocksdb#219

Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
@sticnarf
Copy link
Author

Backport facebook#5745 to fix the CI failure.

@sticnarf
Copy link
Author

db/db_wal_test.cc:1464: Failure

Expected: (GetAllocatedFileSize(dbname_ + file_before->PathName())) >= (preallocated_size), actual: 512 vs 18427904

terminate called after throwing an instance of 'testing::internal::GoogleTestFailureException'

  what():  db/db_wal_test.cc:1464: Failure

Expected: (GetAllocatedFileSize(dbname_ + file_before->PathName())) >= (preallocated_size), actual: 512 vs 18427904

This error still exists in upstream: facebook#6236. Can we ignore running platform-dependent tests on CI now like what upstream does? @yiwu-arbug

@BusyJay
Copy link
Member

BusyJay commented Dec 24, 2020

Friendly ping @yiwu-arbug @Connor1996

@dragonly
Copy link

dragonly commented Feb 5, 2021

Please merge this for Apple M1 🌚

Signed-off-by: Yilin CHen <sticnarf@gmail.com>
Signed-off-by: Yilin CHen <sticnarf@gmail.com>
@sticnarf
Copy link
Author

sticnarf commented Feb 6, 2021

The test failed on CI probably because Travis uses LXD for arm64 by default. Now I switch the arm64 tests to use virtual machine. The test should now pass.

@yiwu-arbug PTAL again, thanks!

@yiwu-arbug yiwu-arbug merged commit 0b76f87 into tikv:6.4.tikv Feb 6, 2021
Thegaram pushed a commit to Thegaram/rocksdb that referenced this pull request Apr 2, 2021
1. Backport facebook#7714 from upstream.
2. `uname -m` on the new Apple Silicon Mac outputs `arm64`. The ARMv8 CRC check in the cmake file is changed.
3. Do not treat arm darwin as iOS.

With this PR, ` cmake .. -DWITH_GFLAGS=OFF -DWITH_TESTS=OFF -DWITH_TOOLS=OFF` outputs:

```
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is Clang
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Found Git: /usr/bin/git (found version "2.24.3 (Apple Git-128)")
-- Performing Test HAVE_OMIT_LEAF_FRAME_POINTER
-- Performing Test HAVE_OMIT_LEAF_FRAME_POINTER - Success
-- Performing Test HAS_ARMV8_CRC
-- Performing Test HAS_ARMV8_CRC - Success
--  HAS_ARMV8_CRC yes
-- Performing Test HAVE_SSE42
-- Performing Test HAVE_SSE42 - Failed
-- Performing Test HAVE_THREAD_LOCAL
-- Performing Test HAVE_THREAD_LOCAL - Success
-- Enabling RTTI in Debug builds only (default)
-- Performing Test HAVE_FALLOCATE
-- Performing Test HAVE_FALLOCATE - Failed
-- Performing Test HAVE_SYNC_FILE_RANGE_WRITE
-- Performing Test HAVE_SYNC_FILE_RANGE_WRITE - Failed
-- Performing Test HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
-- Performing Test HAVE_PTHREAD_MUTEX_ADAPTIVE_NP - Failed
-- Looking for malloc_usable_size
-- Looking for malloc_usable_size - not found
-- Looking for sched_getcpu
-- Looking for sched_getcpu - not found
-- Looking for getauxval
-- Looking for getauxval - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- JNI library is disabled
-- Configuring done
-- Generating done
```

And then, `make rocksdb -j4` succeeds.

Signed-off-by: Yilin CHen <sticnarf@gmail.com>
Co-authored-by: yiwu-arbug <yiwu@pingcap.com>
Thegaram pushed a commit to Thegaram/titan that referenced this pull request Apr 2, 2021
Do the same cmake change in tikv/rocksdb#219

Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Thegaram pushed a commit to Conflux-Chain/rocksdb that referenced this pull request Apr 6, 2021
1. Backport facebook#7714 from upstream.
2. `uname -m` on the new Apple Silicon Mac outputs `arm64`. The ARMv8 CRC check in the cmake file is changed.
3. Do not treat arm darwin as iOS.

With this PR, ` cmake .. -DWITH_GFLAGS=OFF -DWITH_TESTS=OFF -DWITH_TOOLS=OFF` outputs:

```
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is Clang
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Found Git: /usr/bin/git (found version "2.24.3 (Apple Git-128)")
-- Performing Test HAVE_OMIT_LEAF_FRAME_POINTER
-- Performing Test HAVE_OMIT_LEAF_FRAME_POINTER - Success
-- Performing Test HAS_ARMV8_CRC
-- Performing Test HAS_ARMV8_CRC - Success
--  HAS_ARMV8_CRC yes
-- Performing Test HAVE_SSE42
-- Performing Test HAVE_SSE42 - Failed
-- Performing Test HAVE_THREAD_LOCAL
-- Performing Test HAVE_THREAD_LOCAL - Success
-- Enabling RTTI in Debug builds only (default)
-- Performing Test HAVE_FALLOCATE
-- Performing Test HAVE_FALLOCATE - Failed
-- Performing Test HAVE_SYNC_FILE_RANGE_WRITE
-- Performing Test HAVE_SYNC_FILE_RANGE_WRITE - Failed
-- Performing Test HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
-- Performing Test HAVE_PTHREAD_MUTEX_ADAPTIVE_NP - Failed
-- Looking for malloc_usable_size
-- Looking for malloc_usable_size - not found
-- Looking for sched_getcpu
-- Looking for sched_getcpu - not found
-- Looking for getauxval
-- Looking for getauxval - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- JNI library is disabled
-- Configuring done
-- Generating done
```

And then, `make rocksdb -j4` succeeds.

Signed-off-by: Yilin CHen <sticnarf@gmail.com>
Co-authored-by: yiwu-arbug <yiwu@pingcap.com>
@tabokie tabokie mentioned this pull request May 9, 2022
39 tasks
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.

None yet

5 participants