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

freeswitch: fix build error for undeclared identifier 'NSIG' #77004

Merged
merged 1 commit into from
May 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Formula/freeswitch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ class Freeswitch < Formula
end

def install
# Fix build error "use of undeclared identifier 'NSIG'"
# Remove when fixed upstream: https://github.com/signalwire/freeswitch/issues/1145
on_macos do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a comment here explaining what this is for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would something like the headline message along with related upstream issue (signalwire/freeswitch#1145) be sufficient?


I'm actually not sure of exact reason why this is required yet.

If I had to guess, I think it is due to _XOPEN_SOURCE being set by freeswitch in certain places, which changes value of _POSIX_C_SOURCE.

Perhaps due to order of includes, we hit the odd behavior where the same condition to set NSIG and access NSIG are not equal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, macro voodoo. very nice. I guess at minimum a comment should give some indication of when a workaround can be removed, so a link to the upstream issue would help.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay for the comment.

For actual fix, another alternative may be to set _XOPEN_SOURCE, which would do the opposite of _DARWIN_C_SOURCE, i.e. darwin macro would probably allow platform-specific behavior while open-source macro would use portable functions instead.

ENV.append_to_cflags "-D_DARWIN_C_SOURCE"
end

resource("spandsp").stage do
system "./bootstrap.sh"
system "./configure", "--disable-debug",
Expand Down