facebook / folly

An open-source C++ library developed and used at Facebook.
https://groups.google.com/forum/?fromgroups#!forum/facebook-folly
Apache License 2.0
28.14k stars 5.54k forks source link

Undefined symbols for architecture x86_64: "folly::f14::detail::F14LinkCheck<(folly::f14::detail::F14IntrinsicsMode)1>::check() #1939

Closed panghaibo closed 2 weeks ago

panghaibo commented 1 year ago

Hi anybody who can help me with this , I try to use folly in my project, but when compiling project, occurs errors as follow:

Undefined symbols for architecture x86_64: "folly::f14::detail::F14LinkCheck<(folly::f14::detail::F14IntrinsicsMode)1>::check()", referenced from: folly::f14::detail::F14Table<folly::f14::detail::NodeContainerPolicy<folly::dynamic, folly::dynamic, folly::detail::DynamicHasher, folly::detail::DynamicKeyEqual, void> >::rehashImpl(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)::'lambda'()::operator()() const in server-89b8a6.o

btw, I use MacOS

Orvid commented 1 year ago

This is an intentional safety check that you're triggering. If Folly is built with SSE4.2 available then your project also needs to have SSE4.2 enabled, or else one side will be expecting F14 maps to be structured slightly differently than the other.

xxr5566833 commented 10 months ago

SSE4.2 how to make my project have SSE4.2 enabled?

guyuqi commented 9 months ago

This is an intentional safety check that you're triggering. If Folly is built with SSE4.2 available then your project also needs to have SSE4.2 enabled, or else one side will be expecting F14 maps to be structured slightly differently than the other.

I also met this issue when build Velox on Arm64 Ubuntu-22.04. I'm lucky to find your comments here. That's informative. Thanks, @Orvid

In Velox, I set CXX flags: -march=armv8-a+crc+crypto to enable simd. In Folly, I also enabled the SIMD:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ddfdc766e..8055fd27b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,6 +90,10 @@ else()
   endif()
 endif()

+if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64|AARCH64|ARM64|arm64")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a+crc+crypto")
+endif()
+

But it doesn't work. Could you please help to give some further info? Thank you very much.

guyuqi commented 9 months ago

This is an intentional safety check that you're triggering. If Folly is built with SSE4.2 available then your project also needs to have SSE4.2 enabled, or else one side will be expecting F14 maps to be structured slightly differently than the other.

That's informative.

versusvoid commented 8 months ago

I think there is some problem with check mechanism.

I build folly on my machine with CXXFLAGS='-march=native', install it, then try to build edencommon with same CXXFLAGS and it fails, meaning there is some difference in SSE availability detection when building folly itself and another code which includes folly's headers.

gcc 13.2.1 20230801 Ryzen 7 5800U (has sse4_2 in /proc/cpuinfo flags)

kinmioliu commented 8 months ago

I encountered this issue when integrating Velox into my project. My env is an aarch64-ubuntu20.4 container hosted in M1-MAC. I fixed that by adding '-mcpu=neoverse-n1' cxxflags at the top level CMakeLists.txt. You should add '-msse4.2' if the env is X8664-arch.

weimingdiit commented 5 months ago

@guyuqi @versusvoid @kinmioliu I also met this issue when build Velox, is there a final solution to this problem?
`presto version:0.286 velox version: https://github.com/facebookincubator/velox/tree/a3f4dcbecd134b52bcc95b921f96ac7b9efd87ba proxygen version:v2023.12.04.00 c++ version: c++ (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6) OS:CentOS Stream 8 (container hosted in centOS 7)

cpu: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 40 On-line CPU(s) list: 0-39 Thread(s) per core: 2 Core(s) per socket: 10 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 79 Model name: Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz Stepping: 1 CPU MHz: 2200.023 BogoMIPS: 4400.04 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 25600K NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38 NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch arat epb pln pts dtherm intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local`