[Bug 284344] lang/ldc: fix build with LLVM_DEFAULT=19

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 25 Jan 2025 16:44:56 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284344

            Bug ID: 284344
           Summary: lang/ldc: fix build with LLVM_DEFAULT=19
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: acm@FreeBSD.org
          Reporter: dim@FreeBSD.org
             Flags: maintainer-feedback?(acm@FreeBSD.org)
          Assignee: acm@FreeBSD.org

When building lang/ldc with LLVM_DEFAULT=19, linking ldc-profdata fails with:

  FAILED: bin/ldc-profdata
  : && /usr/local/llvm19/bin/clang++ -O2 -pipe -fPIC -fstack-protector-strong
-fno-strict-aliasing -DDMDV2 -O2 -pipe -fPIC -fstack-protector-strong
-fno-strict-aliasing   -DNDEBUG -fstack-protector-strong     -Xlinker
--dependency-file=tools/CMakeFiles/ldc-profdata.dir/link.d
tools/CMakeFiles/ldc-profdata.dir/ldc-profdata/llvm-profdata-19.1.cpp.o -o
bin/ldc-profdata  -lLLVM-19  -L/usr/local/llvm19/lib && :
  ld: error: undefined symbol: pthread_create
  >>> referenced by llvm-profdata-19.1.cpp
  >>>              
tools/CMakeFiles/ldc-profdata.dir/ldc-profdata/llvm-profdata-19.1.cpp.o:(std::__1::future<void>
std::__1::__make_async_assoc_state[abi:sn190107]<void,
std::__1::__async_func<std::__1::function<void
()>>>(std::__1::__async_func<std::__1::function<void ()>>&&))
  clang++: error: linker command failed with exit code 1 (use -v to see
invocation)

This is because the link command line is missing -lpthread. For the
tools/ subdirectory, use the CMAKE_THREAD_LIBS_INIT macro to fix the
target_link_libraries() directive.

-- 
You are receiving this mail because:
You are the assignee for the bug.