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

Sigwait system call on Solaris needs to pass C compile-time-option #19039

Closed
BarrOff opened this issue Oct 22, 2021 · 1 comment
Closed

Sigwait system call on Solaris needs to pass C compile-time-option #19039

BarrOff opened this issue Oct 22, 2021 · 1 comment

Comments

@BarrOff
Copy link
Contributor

BarrOff commented Oct 22, 2021

Hello,

there are two sigwait system calls on Solaris/Illumos systems. One is the Solaris 2.5 version and the other a POSIX 1.c compatible version. The first one has just one argument and is incompatible to the second. However, in the current state the first gets imported by Nim and causes compilation errors.

Example

Trying to compile nimble or testament on OpenIndiana fails.

Current Output

Compilation aborts with

/export/home/user/.cache/nim/nimble_r/stdlib_net.nim.c:1813:39: error: too many arguments to function 'sigwait'                                                                                                 
 1813 |        errX60gensym116X60gensym119_ = sigwait((&watchSetX60gensym116_), (&signalX60gensym116X60gensym119_));

Expected Output

Compilation succeeds.

Possible Solution

adding the following to the nimble.nim.cfg and testament.nim.cfg files solved the problem for these two programs:

when defined(sunos) or defined(solaris):
  --passC:"-D_POSIX_PTHREAD_SEMANTIC"

This is however no general solution. One would have to enable the _POSIX_PTHREAD_SEMANTIC compile time option in lib/posix/posix.nim for Illumos/Solaris. However I don't know how to do that

Additional Information

The above has been tested on a recent OpenIndiana machine. If you can provide a possible fix, I can test and report back.

$ nim -v
Nim Compiler Version 1.6.0 [Solaris: amd64]
Compiled at 2021-10-22
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 727c6378d2464090564dbcd9bc8b9ac648467e38
active boot switches: -d:release
@Clyybber
Copy link
Contributor

Fixed in #19296

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

No branches or pull requests

3 participants