Skip to content

benchexe linking failure with recent libbenchmark #163

@WilliamTambellini

Description

@WilliamTambellini

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions