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

1.0.1 fails to build on FreeBSD #946

Closed
jbeich opened this issue Aug 24, 2022 · 4 comments · Fixed by #951
Closed

1.0.1 fails to build on FreeBSD #946

jbeich opened this issue Aug 24, 2022 · 4 comments · Fixed by #951

Comments

@jbeich
Copy link

jbeich commented Aug 24, 2022

Regressed by 7438638. Found downstream. On FreeBSD libatomic is not present because the default toolchain is LLVM-based (Clang, LLD, libc++, compiler-rt).

$ cmake -DBUILD_TESTING=off -G Ninja -B /tmp/highway_build
-- The C compiler identification is Clang 14.0.5
-- The CXX compiler identification is Clang 14.0.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /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: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HWY_EMSCRIPTEN
-- Performing Test HWY_EMSCRIPTEN - Failed
-- Performing Test HWY_RISCV
-- Performing Test HWY_RISCV - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/highway_build

$ cmake --build /tmp/highway_build
[22/35] Linking CXX executable hwy_list_targets
ld: error: unable to find library -latomic
c++: error: linker command failed with exit code 1 (use -v to see invocation)
[30/35] Linking CXX executable examples/hwy_benchmark
FAILED: examples/hwy_benchmark
: && /usr/bin/c++ -O2 -g -DNDEBUG -fPIE -pie CMakeFiles/hwy_benchmark.dir/hwy/examples/benchmark.cc.o -o examples/hwy_benchmark  libhwy.a  -latomic && :
ld: error: unable to find library -latomic
c++: error: linker command failed with exit code 1 (use -v to see invocation)
[34/35] Building CXX object CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_u16d.cc.o
ninja: build stopped: subcommand failed.
@jan-wassenberg
Copy link
Member

Thanks @jbeich for letting us know. Because the previous fix was targeted at GCC, we could skip it if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")?

FYI I will be away on Thu/Fri.

@jbeich
Copy link
Author

jbeich commented Aug 24, 2022

If it's targeted at GCC shouldn't the conditional be if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ?

@malaterre
Copy link
Contributor

In cmake world "GNU" indeed designate GCC:

@jan-wassenberg
Copy link
Member

Makes sense, thanks. So how about I change it to:

if(UNIX AND NOT APPLE)
  # For GCC __atomic_store_8, see #887
  if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT HWY_EMSCRIPTEN)
    target_link_libraries(hwy atomic)
  endif()

?

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 a pull request may close this issue.

3 participants