Skip to content

Undefined symbols when linking against (development) RcppParallel on windows #240

Closed

Description

@andrjohns

I'm seeing errors about missing symbols when linking against the current GitHub version of RcppParallel on windows (across release & devel, and both x64 & arm64):

...
g++ -std=gnu++17 -shared -s -static-libgcc -o StanEstimators.dll tmp.def StanEstimators.o init.o -LD:/a/_temp/Library/RcppParallel/libs/x64 -lRcppParallel -LC:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools45/x86_64-w64-mingw32.static.posix/lib -LC:/R/bin/x64 -lR
C:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: StanEstimators.o:StanEstimators:(.text$_ZZN4stan9callbacks17concurrent_writerINS0_20unique_stream_writerISt14basic_ofstreamIcSt11char_traitsIcEESt14default_deleteIS6_EEEEC4ERS9_ENKUlvE_clEv[_ZZN4stan9callbacks17concurrent_writerINS0_20unique_stream_writerISt14basic_ofstreamIcSt11char_traitsIcEESt14default_deleteIS6_EEEEC4ERS9_ENKUlvE_clEv]+0x1b9): undefined reference to `tbb::detail::r1::notify_bounded_queue_monitor(tbb::detail::r1::concurrent_monitor*, unsigned long long, unsigned long long)'
C:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: StanEstimators.o:StanEstimators:(.text$_ZN4stan9callbacks17concurrent_writerINS0_20unique_stream_writerISt14basic_ofstreamIcSt11char_traitsIcEESt14default_deleteIS6_EEEED1Ev[_ZN4stan9callbacks17concurrent_writerINS0_20unique_stream_writerISt14basic_ofstreamIcSt11char_traitsIcEESt14default_deleteIS6_EEEED1Ev]+0x24d): undefined reference to `tbb::detail::r1::deallocate_bounded_queue_rep(unsigned char*, unsigned long long)'
C:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: StanEstimators.o:StanEstimators:(.text$_ZN3tbb6detail2d224concurrent_bounded_queueIN5Eigen6MatrixIdLi1ELin1ELi1ELi1ELin1EEENS0_2d123cache_aligned_allocatorIS5_EEED1Ev[_ZN3tbb6detail2d224concurrent_bounded_queueIN5Eigen6MatrixIdLi1ELin1ELi1ELi1ELin1EEENS0_2d123cache_aligned_allocatorIS5_EEED1Ev]+0x20d): undefined reference to `tbb::detail::r1::deallocate_bounded_queue_rep(unsigned char*, unsigned long long)'
C:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: StanEstimators.o:StanEstimators:(.text$_ZN4stan9callbacks17concurrent_writerINS0_20unique_stream_writerISt14basic_ofstreamIcSt11char_traitsIcEESt14default_deleteIS6_EEEEC1ERS9_[_ZN4stan9callbacks17concurrent_writerINS0_20unique_stream_writerISt14basic_ofstreamIcSt11char_traitsIcEESt14default_deleteIS6_EEEEC1ERS9_]+0x2e): undefined reference to `tbb::detail::r1::allocate_bounded_queue_rep(unsigned long long)'
C:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: StanEstimators.o:StanEstimators:(.text$_ZN4stan9callbacks17concurrent_writerINS0_20unique_stream_writerISt14basic_ofstreamIcSt11char_traitsIcEESt14default_deleteIS6_EEEEclIRN5Eigen6MatrixIdLi1ELin1ELi1ELi1ELin1EEEEEvOT_[_ZN4stan9callbacks17concurrent_writerINS0_20unique_stream_writerISt14basic_ofstreamIcSt11char_traitsIcEESt14default_deleteIS6_EEEEclIRN5Eigen6MatrixIdLi1ELin1ELi1ELi1ELin1EEEEEvOT_]+0x26f): undefined reference to `tbb::detail::r1::notify_bounded_queue_monitor(tbb::detail::r1::concurrent_monitor*, unsigned long long, unsigned long long)'
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'StanEstimators'
* removing 'C:/Users/RUNNER~1/AppData/Local/Temp/RtmpIvglkx/Rinst183856ec6bda/StanEstimators'
      -----------------------------------
ERROR: package installation failed

Full CI run with failures for the various windows versions here if it helps: https://github.com/andrjohns/StanEstimators/actions/runs/18257064205

Thanks!

Activity

  1. kevinushey commented on Oct 6, 2025

    @kevinushey
    Contributor

    Given that StanEstimators is using TBB APIs directly (rather than just the wrappers exposed by RcppParallel), I think it'll need to explicitly link to TBB via -ltbb as well. Note that RcppParallel no longer links to TBB by default, as we want to avoid ABI breakage when RcppParallel is updated with newer versions of TBB.

  2. andrjohns commented on Oct 7, 2025

    @andrjohns
    ContributorAuthor

    Ahh makes sense, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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