Skip to content

Conversation

ismaell
Copy link

@ismaell ismaell commented Sep 9, 2022

Description

Check for the libucontext package. The ucontext.h API may be implemented outside the libc.

Without this patch the build seems to succeed but results in under-linking.

  • - git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details)

Type of change

Add a respective label(s) to PR if you have permissions

  • bug fix - change that fixes an issue
  • new feature - change that adds functionality
  • tests - change in tests
  • infrastructure - change in infrastructure and CI
  • documentation - documentation update

Tests

  • added - required for new features and some bug fixes
  • not needed

Documentation

  • updated in # - add PR number
  • needs to be updated
  • not needed

Breaks backward compatibility

  • Yes
  • No
  • Unknown

Notify the following users

Other information

@ismaell ismaell changed the title Fix build against libucontext Fix build on systems with ucontext.h implemented outside the libc Sep 9, 2022
The ucontext.h API may be implemented outside the libc.
@pavelkumbrasev
Copy link

Hi @ismaell, we have thread-based implementation of resumable tasks. What do you think if we enable such implementation in case where ucontext is absented? (Use libc or thread-based)

https://github.com/oneapi-src/oneTBB/blob/f2af74732ba7b303f23a2f453051a52a63560a75/src/tbb/co_context.h#LL27C5-L27C38

@ismaell
Copy link
Author

ismaell commented Nov 16, 2022

Ah, that's even better.

@pavelkumbrasev
Copy link

Could I ask to do such change in your patch? You simply need to define this macro - __TBB_RESUMABLE_TASKS_USE_THREADS in cmake if ucontext not present.
Also, please add the copyright to cmake file you can copy it from our cmake files.

@pavelkumbrasev
Copy link

@ismaell do you have a chance to update PR with proposed changes or we should create separate PR for this?

@brad0
Copy link
Contributor

brad0 commented Jan 21, 2023

Could I ask to do such change in your patch? You simply need to define this macro - __TBB_RESUMABLE_TASKS_USE_THREADS in cmake if ucontext not present. Also, please add the copyright to cmake file you can copy it from our cmake files.

Please do. I ran into this trying to build TBB on OpenBSD, which does not have ucontext. Also I see Haiku does not as well.

I tried building mold which has TBB embedded with CFLAGS / CXXFLAGS with __TBB_RESUMABLE_TASKS_USE_THREADS defined and it now built Ok.

To me with how long ucontext has been removed from POSIX, I don't know why TBB doesn't just use the thread-based code path.

#795

@brad0
Copy link
Contributor

brad0 commented Feb 9, 2023

Could I ask to do such change in your patch? You simply need to define this macro - __TBB_RESUMABLE_TASKS_USE_THREADS in cmake if ucontext not present. Also, please add the copyright to cmake file you can copy it from our cmake files.

@pavelkumbrasev Can you please try to come up with a diff that checks for ucontext and enables the thread-based implementation if it does not exist? I can help test if you would like.

@pavelkumbrasev
Copy link

@brad0 Basically, you could submit a separate PR that implements proposed approach since there is no progress in this PR.
Are you ok with this?

@pavelkumbrasev
Copy link

Closing it since #1055 was merged.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants