Opened 4 years ago

Closed 2 years ago

#16965 closed bug (fixed)

__STDC_NO_THREADS__ is not defined in Haiku

Reported by: Begasus Owned by: nobody
Priority: normal Milestone: R1/beta4
Component: - General Version: R1/beta2
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by pulkomandy)

When trying to build scipy I getting an error that the script wants to include "threads.h". This however isn't availabe in Haiku and the check for that is due to __STDC_NO_THREADS__ not being defined.

The source of the issue is with numpy. See a PR at https://github.com/numpy/numpy/pull/18180

__STDC_VERSION__ = 201710
__STDC_NO_THREADS__ not defined
__GLIBC__ not defined

Attachments (1)

RDYQ.txt (10.7 KB ) - added by begasus 2 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 by korli, 4 years ago

__STDC_NO_THREADS__ is theorically set by the compiler, based on its knowledge of the C library. Practically gcc seems to include the header stdc-prereqs.h, which would eventually define such a macro.

Last edited 3 years ago by pulkomandy (previous) (diff)

comment:2 by Begasus, 4 years ago

Yeah, came across that also earlier, looked for that header but we don't include it in Haiku atm

comment:3 by korli, 4 years ago

I added a stdc-prereqs.h with https://review.haiku-os.org/c/haiku/+/4097 When it's accepted, GCC and Clang can be adjusted.

comment:4 by Begasus, 3 years ago

This has been accepted, I should check if it has been resolved, but I'm not sure if it also applied to R1B2?

comment:5 by pulkomandy, 3 years ago

It has been applied to nightlies, but not to the stable beta2 branch.

comment:6 by Begasus, 3 years ago

I think this could be closed, header is included in R1B3, building scipy without the patch for numpy seems to work (checked on x86_gcc2)

comment:7 by Begasus, 3 years ago

Ok, no problem reported by numpy, but scipy still fails to find it, so I'm guessing that clang/gcc aren't adjusted to use it, so best to leave it open until then

comment:8 by pulkomandy, 3 years ago

Description: modified (diff)

comment:9 by begasus, 2 years ago

Ran a check with the script mentioned at the issue at numpy, seems __STDC_NO_THREADS__ is still not defined, maybe we could use a simular work-around like OpenBSD?

https://github.com/numpy/numpy/commit/5ffe257a19c5125ad981a5de018e5d492797d2e4

EDIT created a upstream PR until this is settled on Haiku side: https://github.com/numpy/numpy/pull/22272

Last edited 2 years ago by begasus (previous) (diff)

comment:10 by waddlesplash, 2 years ago

We don't define __STDC_NO_THREADS__ because we do actually support STDC threads now.

in reply to:  10 comment:11 by begasus, 2 years ago

Replying to waddlesplash:

We don't define __STDC_NO_THREADS__ because we do actually support STDC threads now.

Building scipy without patching still errors out, this is one of the errors I encountered:

build/src.haiku-1-BePC-3.8/scipy/integrate/vodemodule.c:98:32: error: unknown type name 'thread_local

comment:12 by waddlesplash, 2 years ago

Are you using GCC8? You can't use gcc2 for the new-style thread-local storage.

comment:13 by begasus, 2 years ago

scipy is using secondary architecture, so yes using gcc11 for it Added Terminal output from the errors in RDQY.txt

Last edited 2 years ago by begasus (previous) (diff)

by begasus, 2 years ago

Attachment: RDYQ.txt added

comment:14 by korli, 2 years ago

Support for C11 thread isn't complete: only the Threads section is implemented.

comment:15 by korli, 2 years ago

proposed the tss support in https://review.haiku-os.org/c/haiku/+/5675

Version 0, edited 2 years ago by korli (next)

comment:16 by korli, 2 years ago

Merged in hrev56459

comment:17 by begasus, 2 years ago

Build for numpy without patching works to get scipy build now, thanks korli!

comment:18 by korli, 2 years ago

Milestone: UnscheduledR1/beta4
Resolution: fixed
Status: newclosed

Thanks for the feedback, begasus.

Note: See TracTickets for help on using tickets.