intel / x86-simd-sort

C++ template library for high performance SIMD based sorting algorithms
BSD 3-Clause "New" or "Revised" License
855 stars 57 forks source link

benchexe linking failure with recent libbenchmark #163

Closed WilliamTambellini closed 1 month ago

WilliamTambellini commented 2 months ago

Just a small linking failure for the benchmarker if using libbenchmark 1.7+ (at least on ubuntu + gcc7):

...
c++  -o benchexe  -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -Wl,--whole-archive -Wl,--start-group benchmarks/libbench_qsort.a -Wl,--no-whole-archive '-Wl,-rpath,$ORIGIN/' -Wl,-rpath-link,repos/x86-simd-sort/builddir/ libx86simdsortcpp.so.1 -lbenchmark_main /usr/local/lib/libbenchmark.a -Wl,--end-group
/usr/local/lib/libbenchmark.a(benchmark_runner.cc.o): 
In function `benchmark::internal::BenchmarkRunner::DoNIterations()':
benchmark_runner.cc:(.text+0x12ed): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
...

seems to link good by just adding a dep with 'threads':

  thread_dep = dependency('threads') # recent libbenchmark use pthread_create
  subdir('benchmarks')
  benchexe = executable('benchexe',
                      include_directories : [src, lib, utils, bench],
                      dependencies : [gbench_dep, thread_dep],
...

Would you mind if I push a fix ? Best WT

WilliamTambellini commented 2 months ago

PR https://github.com/intel/x86-simd-sort/pull/164