#67212 closed defect (fixed)

spdlog @1.11.0: error: 'pthread_threadid_np' was not declared in this scope

Reported by: barracuda156 Owned by: XNephila (X Nephila)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: tiger, leopard, haspatch Cc: judaew (Vadym-Valdis Yudaiev)
Port: spdlog

Description

In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_spdlog/spdlog/work/spdlog-1.11.0/src/spdlog.cpp:12:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_spdlog/spdlog/work/spdlog-1.11.0/include/spdlog/details/os-inl.h: In function 'size_t spdlog::details::os::_thread_id()':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_spdlog/spdlog/work/spdlog-1.11.0/include/spdlog/details/os-inl.h:356:5: error: 'pthread_threadid_np' was not declared in this scope; did you mean 'pthread_is_threaded_np'?
  356 |     pthread_threadid_np(nullptr, &tid);
      |     ^~~~~~~~~~~~~~~~~~~
      |     pthread_is_threaded_np

Attachments (1)

pthread_threadid_np.patch (698 bytes) - added by ryandesign (Ryan Carsten Schmidt) 13 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 13 months ago by ryandesign (Ryan Carsten Schmidt)

Keywords: tiger added; snowleopard removed
Summary: spdlog: error: 'pthread_threadid_np' was not declared in this scopespdlog @1.11.0: error: 'pthread_threadid_np' was not declared in this scope

The buildbot shows successful builds of this port on Snow Leopard and later, and according to the pthread.h header, pthread_threadid_np was introduced in 10.6, so this should only affect 10.5 and earlier.

pthread_threadid_np doesn't appear to be available in legacy support.

Changed 13 months ago by ryandesign (Ryan Carsten Schmidt)

Attachment: pthread_threadid_np.patch added

comment:2 Changed 13 months ago by ryandesign (Ryan Carsten Schmidt)

Does this patch work for you on 10.5? It should have no effect on 10.6 or later.

comment:3 Changed 13 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: judaew added
Keywords: haspatch added
Owner: changed from judaew to XNephila

comment:4 Changed 13 months ago by kencu (Ken)

see also:

https://github.com/macports/macports-ports/blob/master/lang/python38/files/patch-threadid-older-systems.diff

for one we've been using for a few years for this in the python ports.

I guess this should make it into legacysupport at some point.

comment:5 Changed 13 months ago by ryandesign (Ryan Carsten Schmidt)

Thanks Ken, that patch looks like a better solution.

My patch makes 10.5 and earlier use a generic fallback method but they go to some effort in spdlog to use platform-specific alternatives when available because a comment in the code says the generic version is slow.

comment:6 in reply to:  5 Changed 13 months ago by barracuda156

Replying to ryandesign:

Thanks Ken, that patch looks like a better solution.

My patch makes 10.5 and earlier use a generic fallback method but they go to some effort in spdlog to use platform-specific alternatives when available because a comment in the code says the generic version is slow.

Ken, Ryan, thank you, I will try these.

  1. S. Offtopic, but since Python was mentioned, could someone try helping with this issue? #67046

It affects 10.5 (not just 10.6 for ppc) and leaves a number of Python ports completely defunct. (My primary concern is that rarian does not work.)

Last edited 13 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:7 in reply to:  2 ; Changed 13 months ago by barracuda156

Replying to ryandesign:

Does this patch work for you on 10.5? It should have no effect on 10.6 or later.

Rosetta does not have that symbol either, so perhaps a patch from Ruby or Python gonna work better. Ruby has this: https://github.com/macports/macports-ports/blob/master/lang/ruby31/files/patch-thread_pthread.diff

Last edited 13 months ago by barracuda156 (previous) (diff)

comment:8 in reply to:  7 ; Changed 13 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to barracuda156:

Rosetta does not have that symbol either

I don't know what that means. Rosetta is a PowerPC emulator for Intel. Since 10.5 is the newest macOS that works on PowerPC, obviously any PowerPC software being emulated by Rosetta on Intel will have been built for 10.5 or earlier.

comment:9 in reply to:  8 Changed 13 months ago by barracuda156

Replying to ryandesign:

Replying to barracuda156:

Rosetta does not have that symbol either

I don't know what that means. Rosetta is a PowerPC emulator for Intel. Since 10.5 is the newest macOS that works on PowerPC, obviously any PowerPC software being emulated by Rosetta on Intel will have been built for 10.5 or earlier.

Yeah, I get you, but in practice it is not 100% that way. However with pthread_threadid_np it is indeed, discovered that when been fixing upstream Ruby with Iain.

comment:10 Changed 12 months ago by barracuda156

Resolution: fixed
Status: assignedclosed

In 0379c87280faa1a14758cb61a52fb4e6d5922a97/macports-ports (master):

spdlog: fix for systems without pthread_threadid_np

Fixes: #67212

Note: See TracTickets for help on using tickets.