Skip to content

Function 'gettid' does not exist on MacOS, dcc use in Mac terminal results in "dcc: Internal error" #106

@timo-wilson24

Description

@timo-wilson24

Using MacOS 15.6. I have installed dcc on mac using the installation script as recommended by dcc documentation. When using dcc in the terminal, I get an internal error due to the function 'gettid':

dcc about_me.c -o about_mee
dcc: Internal error
<stdin>:1290:86: error: call to undeclared function 'gettid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    snprintf(threadid_buffer, sizeof threadid_buffer, "DCC_SIGNAL_THREAD=%ld", (long)gettid());
                                                                                     ^
1 error generated.

It looks like in wrapper_c/dcc_util.c, on line 254, there is a call to "(long)gettid());".

As far as my research shows, gettid is not a function on macOS, but a similar function is pthread_threadid_np().

Wondering if there is a workaround for me or any way that I can compile dcc with altered source code on my mac so that it uses the above function.

An idea for a long-term solution could be to have an #ifdef __APPLE__ pthread_threadid_np(); #else gettid() (pseudo-code).

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