Opened 4 years ago

Closed 2 years ago

#61063 closed defect (fixed)

mariadb-10.5: Undefined symbols for architecture x86_64: "_crc32_pclmul", "_crc32_pclmul_enabled"

Reported by: chrstphrchvz (Christopher Chavez) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: Cc:
Port: mariadb-10.5

Description

10.6 (64-bit) build fails during linking (though it is unclear exactly where due to the build running with make -j7):

Undefined symbols for architecture x86_64:
  "_crc32_pclmul", referenced from:
      _my_checksum_init in libmysys.a(checksum.c.o)
  "_crc32_pclmul_enabled", referenced from:
      _my_checksum_init in libmysys.a(checksum.c.o)
ld: symbol(s) not found for architecture x86_64

(I personally do not need this port.)

Attachments (1)

patch-mariadb105-checksum-clmul.diff (509 bytes) - added by kencu (Ken) 4 years ago.

Download all attachments as: .zip

Change History (12)

comment:2 Changed 4 years ago by kencu (Ken)

i've built mariadb-10.5 on 10.6.8 64-bit, and don't see this error.

comment:3 Changed 4 years ago by kencu (Ken)

And yet the buildbot just tried to build and had this error again. Hmm... something.

comment:4 Changed 4 years ago by kencu (Ken)

This appears to have something to do with the processor that is building this. The missing function is defined in this file crc32/crc32_x86.c That file is only included if the system can support the pclmulqdq instruction, according to this bit in mysys/CMakeLists.txt

IF(NOT MSVC AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
  #Check for PCLMUL instruction (x86)
  CHECK_C_SOURCE_COMPILES("
  int main()
  {
    asm volatile (\"pclmulqdq \\$0x00, %%xmm1, %%xmm0\":::\"cc\");
    return 0;
  }" HAVE_CLMUL_INSTRUCTION)

  IF(HAVE_CLMUL_INSTRUCTION)
    SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c)
  ENDIF()

according to <https://en.wikipedia.org/wiki/Westmere_(microarchitecture)> that instruction is available on Nehalem and greater processors, which I am using. So presumably the 10.6 buildbot is on something less than a Nehalem, and therefore fails.

The whole thing is controlled from mysys/checksum.c and I think that with a bit of thought, we could come up with a way to use the fallbacks.

It seems though that this symbol should be weak linked, and fall through to the final catch-all automatically.

I suspect that something with the weak-linking is not 100% right here.

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:5 Changed 4 years ago by kencu (Ken)

comment:6 Changed 4 years ago by kencu (Ken)

So I can reproduce this on another SnowLeopard system I have with an older processor. I have a patch to fix this, and it looks likely to be upstreamable as well.

comment:7 Changed 4 years ago by kencu (Ken)

<https://github.com/MariaDB/server/pull/1660>

I can do a MacPorts patch as well -- attached.

Changed 4 years ago by kencu (Ken)

comment:8 Changed 4 years ago by michaelld (Michael Dickens)

@kencu: Given that this change impacts very few MP users, please finish up with MDB folks on the PR and then create a MP PR with the added patch that we can use in the interim until the next MDB 10.5 release is out. Thx for your sleuthing and work here, as always!

comment:9 Changed 4 years ago by kencu (Ken)

here's what upstream settled on; it works to fix this issue <https://github.com/MariaDB/server/commit/b47d61d04fe59368a4d2c2de1bd04d9a8b5a20e5>

comment:10 in reply to:  9 Changed 2 years ago by chrstphrchvz (Christopher Chavez)

Replying to kencu:

here's what upstream settled on; it works to fix this issue <https://github.com/MariaDB/server/commit/b47d61d04fe59368a4d2c2de1bd04d9a8b5a20e5>

This change was part of MariaDB 10.5.7, so the specific issue for this ticket has likely been resolved since [a38e5c63e325/macports-ports]. And as of [dcec72f4ab47/macports-ports] the build on 10.6 64-bit has been successful. I believe this ticket can be closed.

comment:11 Changed 2 years ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.