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

Open source builds fail for some Arm CPUs #1265

Open
mdcallag opened this issue Jan 26, 2023 · 1 comment
Open

Open source builds fail for some Arm CPUs #1265

mdcallag opened this issue Jan 26, 2023 · 1 comment

Comments

@mdcallag
Copy link
Contributor

On Ubuntu 22.04 using the t2a machine series on Google cloud (Arm Neoverse N1 CPU) the compile fails because ha_rocksdb.h includes my_checksum.h and this code in my_checksum.h uses PunnedCrc32 and PunnedCrc32 uses memcpy, but my_checksum.h doesn't include <string.h> prior to using my_checksum.

Upstream builds don't have a problem from this, at least not yet, because they appear to include string.h prior to including my_checksum.h in files that use my_checksum.

My workaround is to include string.h:

diff --git a/include/my_checksum.h b/include/my_checksum.h
index c35bf0aac1e..6d7f1878fdf 100644
--- a/include/my_checksum.h
+++ b/include/my_checksum.h
@@ -34,6 +34,7 @@
 #include <type_traits>  // std::is_convertible

 #include <zlib.h>  // crc32_z
+#include <string.h>

 #include "my_base.h"      // ha_checksum
 #include "my_compiler.h"  // My_ATTRIBUTE
@mdcallag
Copy link
Contributor Author

The error:

In file included from /home/mcallaghan/fbmysql-56/storage/rocksdb/./ha_rocksdb.h:32,
                 from /home/mcallaghan/fbmysql-56/storage/rocksdb/ha_rocksdb.cc:24:
/home/mcallaghan/fbmysql-56/include/my_checksum.h: In instantiation of ‘uint32_t mycrc32::PunnedCrc32(uint32_t, const unsigned char*, size_t) [with PT = long unsigned int; uint32
_t = unsigned int; size_t = long unsigned int]’:
/home/mcallaghan/fbmysql-56/include/my_checksum.h:118:47:   required from here
/home/mcallaghan/fbmysql-56/include/my_checksum.h:93:11: error: ‘memcpy’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
   93 |     memcpy(&pv, buf, sizeof(PT));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/features.h:486,
                 from /usr/include/aarch64-linux-gnu/c++/11/bits/os_defines.h:39,
                 from /usr/include/aarch64-linux-gnu/c++/11/bits/c++config.h:586,
                 from /usr/include/c++/11/bits/stl_algobase.h:59,
                 from /usr/include/c++/11/deque:60,
                 from /home/mcallaghan/fbmysql-56/storage/rocksdb/./ha_rocksdb.h:23,
                 from /home/mcallaghan/fbmysql-56/storage/rocksdb/ha_rocksdb.cc:24:
/usr/include/aarch64-linux-gnu/bits/string_fortified.h:26:1: note: ‘void* memcpy(void*, const void*, size_t)’ declared here, later in the translation unit
   26 | __NTH (memcpy (void *__restrict __dest, const void *__restrict __src,
      | ^~~~~
In file included from /home/mcallaghan/fbmysql-56/include/m_string.h:43,
                 from /home/mcallaghan/fbmysql-56/sql/debug_sync.h:35,
                 from /home/mcallaghan/fbmysql-56/storage/rocksdb/./rdb_iterator.h:22,
                 from /home/mcallaghan/fbmysql-56/storage/rocksdb/rdb_iterator.cc:17:

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

No branches or pull requests

1 participant