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

pipe2 not available on macOS/__APPLE__ #6495

Merged
merged 3 commits into from
Jun 26, 2024
Merged

pipe2 not available on macOS/__APPLE__ #6495

merged 3 commits into from
Jun 26, 2024

Conversation

kimim
Copy link
Contributor

@kimim kimim commented May 23, 2024

fix the problem on macOS Sonoma 14.5/Apple M3

[  3%] Building C object open62541/CMakeFiles/open62541-plugins.dir/arch/eventloop_posix/eventloop_posix.c.o
/Users/kimim/workspace/opcua-examples/common/c/open62541/arch/eventloop_posix/eventloop_posix.c:171:15: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    int err = UA_EventLoopPOSIX_pipe(el->selfpipe);
              ^
/Users/kimim/workspace/opcua-examples/common/c/open62541/arch/eventloop_posix/eventloop_posix.h:322:38: note: expanded from macro 'UA_EventLoopPOSIX_pipe'
# define UA_EventLoopPOSIX_pipe(fds) pipe2(fds, O_NONBLOCK)
                                     ^
/Users/kimim/workspace/opcua-examples/common/c/open62541/arch/eventloop_posix/eventloop_posix.c:171:15: note: did you mean 'pipe'?
/Users/kimim/workspace/opcua-examples/common/c/open62541/arch/eventloop_posix/eventloop_posix.h:322:38: note: expanded from macro 'UA_EventLoopPOSIX_pipe'
# define UA_EventLoopPOSIX_pipe(fds) pipe2(fds, O_NONBLOCK)
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/unistd.h:470:6: note: 'pipe' declared here
int      pipe(int [2]);
         ^
1 error generated.

@jpfr
Copy link
Member

jpfr commented May 23, 2024

It is also not available on windows.
You can add the macro #ifdef to use the windows workaround also for MacOS.

@kimim
Copy link
Contributor Author

kimim commented Jun 7, 2024

@jpfr I tried, but not work.

@jpfr
Copy link
Member

jpfr commented Jun 7, 2024

I don't have a Mac available right now.
But it should work - it is just opening a UDP socket instead of a UNIX socket pair...

@kimim
Copy link
Contributor Author

kimim commented Jun 8, 2024

OK, Let me try again.

@kimim
Copy link
Contributor Author

kimim commented Jun 9, 2024

@jpfr now, socket is used for APPLE also.

@jpfr jpfr merged commit a0ef78b into open62541:master Jun 26, 2024
66 checks passed
@jpfr
Copy link
Member

jpfr commented Jun 26, 2024

Nice, merged.

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

Successfully merging this pull request may close these issues.

None yet

2 participants