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

Profiler (server) linker error (tbb) #950

Open
Langwedocjusz opened this issue Dec 25, 2024 · 3 comments
Open

Profiler (server) linker error (tbb) #950

Langwedocjusz opened this issue Dec 25, 2024 · 3 comments

Comments

@Langwedocjusz
Copy link

When compiling the profiler on manjaro linux, using gcc I get linker error "undefined reference to tbb::detail::r1::execution_slot". It can be fixed by linking against tbb in the profiler cmake:

find_package(TBB REQUIRED COMPONENTS tbb)
target_link_libraries(${PROJECT_NAME} PRIVATE tbb)

I could open a pull request which does this, but I'm not certain if this should also be applied to other platforms.

@wolfpld
Copy link
Owner

wolfpld commented Dec 25, 2024

tbb is no longer used.

@Langwedocjusz
Copy link
Author

Huh, so in that case should I assume the linker error stems from some environment misconfiguration on my part?

@wolfpld
Copy link
Owner

wolfpld commented Dec 26, 2024

For starters, please see #810 for more discussion on this topic.

To be precise, tbb was never a dependency of Tracy. It's just an artifact of how the <execution> header (and the parallel STL) is implemented on the gcc / stdc++ side. And it's implemented in such a way that if you use the header, you have to link in the tbb library, because gcc is too inept to be able to do this on its own. Now, given that this is just an internal implementation detail of gcc, it can change at any moment, and the applications should just, somehow, in some way, be able to predict what will be needed in future, and handle it properly. Every time it changes. There are some parallels with how -lpthread is sometimes maybe needed when you decide to use a different part of the standard library.

As you probably have guessed, I'm not particularly fond of the situation, so I just replaced all use of the parallel STL with a library that was explicitly designed to avoid the tbb dependency (1c1faef).

In short, I don't depend on tbb, and I don't really want to know what fresh bullshit gcc has invented about it.

I run Arch, so that's basically the same as Manjaro. I checked the gcc build and I can see the errors you reference:

/usr/bin/ld: CMakeFiles/tracy-profiler.dir/src/main.cpp.o: in function `tbb::detail::d1::execution_slot(tbb::detail::d1::execution_data const&)':
/usr/include/oneapi/tbb/detail/_task.h:238:(.text._ZN3tbb6detail2d114execution_slotERKNS1_14execution_dataE[_ZN3tbb6detail2d114execution_slotERKNS1_14execution_dataE]+0x14): undefined reference to `tbb::detail::r1::execution_slot(tbb::detail::d1::execution_data const*)'
/usr/bin/ld: CMakeFiles/tracy-profiler.dir/src/main.cpp.o: in function `tbb::detail::d1::current_thread_index()':
/usr/include/oneapi/tbb/task_arena.h:451:(.text._ZN3tbb6detail2d120current_thread_indexEv[_ZN3tbb6detail2d120current_thread_indexEv]+0xe): undefined reference to `tbb::detail::r1::execution_slot(tbb::detail::d1::execution_data const*)'
collect2: error: ld returned 1 exit status

...when I have onetbb installed. Which I have to have installed, as it's a dependency of some packages. When I remove it, everything builds correctly. Sigh.

I have clang as my default compiler, and I recommend doing the same. It works as intended.

If someone wants to get gcc working back again, the above should be a good starting point.

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

No branches or pull requests

2 participants