Summary: | ASTERISK-20366: Build errors on OpenSolaris | ||
Reporter: | Ben Klang (bklang) | Labels: | |
Date Opened: | 2012-09-06 10:40:30 | Date Closed: | 2012-10-08 08:03:37 |
Priority: | Major | Regression? | Yes |
Status: | Closed/Complete | Components: | Resources/res_rtp_asterisk |
Versions: | 11.0.0-beta1 | Frequency of Occurrence | Constant |
Related Issues: | |||
Environment: | OpenSolaris | Attachments: | ( 0) 0001-RFC-pjproject-Fix-for-Solaris-builds.-Do-not-undef-s.patch ( 1) 0002-main-acl.c-Trivial.-best_score-should-be-defined-for.patch |
Description: | While building Asterisk 11 on OpenSolaris I get this error: {noformat} [CC] res_rtp_asterisk.c -> res_rtp_asterisk.o In file included from /export/home/admin/asterisk-11-svn/include/asterisk/stun.h:29, from res_rtp_asterisk.c:51: /export/home/admin/asterisk-11-svn/include/asterisk/network.h: In function `inaddrcmp': /export/home/admin/asterisk-11-svn/include/asterisk/network.h:92: error: structure has no member named `s_addr' /export/home/admin/asterisk-11-svn/include/asterisk/network.h:92: error: structure has no member named `s_addr' res_rtp_asterisk.c: In function `ast_rtp_on_ice_tx_pkt': res_rtp_asterisk.c:706: warning: dereferencing type-punned pointer will break strict-aliasing rules res_rtp_asterisk.c:710: warning: dereferencing type-punned pointer will break strict-aliasing rules res_rtp_asterisk.c: In function `rtp_add_candidates_to_ice': res_rtp_asterisk.c:1085: error: structure has no member named `s_addr' make[2]: *** [res_rtp_asterisk.o] Error 1 make[1]: *** [res] Error 2 make[1]: Leaving directory `/export/home/admin/asterisk-11-svn' gmake: *** [_cleantest_all] Error 2 {noformat} I'm marking as a regression because Asterisk 10 builds and runs fine on this platform. Please correct me if this should not be a regression. | ||
Comments: | By: Ben Klang (bklang) 2012-09-06 11:08:11.219-0500 Extracts from netinet/in.h which define sockaddr_in and in_addr can be found here: https://gist.github.com/3657442 By: Shaun Ruffell (sruffell) 2012-09-06 14:56:48.652-0500 FYI: The "res_rtp_asterisk.c:706: warning: dereferencing type-punned pointer will break strict-aliasing rules" warnings are addressed in patch on ASTERISK-20368. By: Rusty Newton (rnewton) 2012-09-07 09:43:42.014-0500 Ben, acknowledged this issue. Since it's an unsupported platform it'll be up to the community to look into it. MJordan suggested you may post the structure definition on the issue. Might help point another developer towards a solution. By: Ben Klang (bklang) 2012-09-07 09:51:03.038-0500 Thanks for the acknowledgement Rusty. The structure definitions are in the gist link above, but I'll paste them here as well: {noformat} /* * IPv4 Socket address. */ struct sockaddr_in { sa_family_t sin_family; in_port_t sin_port; struct in_addr sin_addr; #if !defined(_XPG4_2) || defined(__EXTENSIONS__) char sin_zero[8]; #else unsigned char sin_zero[8]; #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ }; struct in_addr { union { struct { uint8_t s_b1, s_b2, s_b3, s_b4; } _S_un_b; struct { uint16_t s_w1, s_w2; } _S_un_w; #if !defined(_XPG4_2) || defined(__EXTENSIONS__) uint32_t _S_addr; #else in_addr_t _S_addr; #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ } _S_un; #define s_addr _S_un._S_addr /* should be used for all code */ #define s_host _S_un._S_un_b.s_b2 /* OBSOLETE: host on imp */ #define s_net _S_un._S_un_b.s_b1 /* OBSOLETE: network */ #define s_imp _S_un._S_un_w.s_w2 /* OBSOLETE: imp */ #define s_impno _S_un._S_un_b.s_b4 /* OBSOLETE: imp # */ #define s_lh _S_un._S_un_b.s_b3 /* OBSOLETE: logical host */ }; {noformat} By: Matt Jordan (mjordan) 2012-09-07 12:25:34.025-0500 Okay, that's just plain weird. {noformat} #define s_addr _S_un._S_addr /* should be used for all code */ {noformat} And yet the error is: {noformat} /export/home/admin/asterisk-11-svn/include/asterisk/network.h:92: error: structure has no member named `s_addr' {noformat} Maybe something redef'd s_addr somewhere in the pj* code? By: Shaun Ruffell (sruffell) 2012-09-07 12:42:16.707-0500 [Line 475 of res/pjproject/pjlib/include/pj/sock.h|http://svnview.digium.com/svn/asterisk/trunk/res/pjproject/pjlib/include/pj/sock.h?revision=369517&view=markup], which is included by "pjlib.h" in res_rtp_asterisk.c undefined s_addr. hmm.... By: Shaun Ruffell (sruffell) 2012-09-07 13:09:27.054-0500 -Attaching- [0001-res_rtp_asterisk-Save-s_addr-definition-for-building.patch|https://issues.asterisk.org/jira/secure/attachment/44532/0001-res_rtp_asterisk-Save-s_addr-definition-for-building.patch]. -I can't test this since I don't have a Solaris system setup, but it's worth a try.- I removed this patch. I didn't work. By: Ben Klang (bklang) 2012-09-07 17:05:44.863-0500 Thanks to @sruffell I've tested a patch on Solaris and have a working build. I don't think it was this patch, but I'll let Shaun point to the correct one. By: Shaun Ruffell (sruffell) 2012-09-08 00:38:24.836-0500 The patches that Ben are referring to are: 0001-RFC-pjproject-Fix-for-Solaris-builds.-Do-not-undef-s.patch and 0002-main-acl.c-Trivial.-best_score-should-be-defined-for.patch which are now attached. By: Shaun Ruffell (sruffell) 2012-09-08 01:07:40.852-0500 A note in case the eventual committer wants to test / review / and commit all the patches (in this case two so far) together as a unit. {code} git svn clone -r HEAD https://origsvn.digium.com/svn/asterisk/branches/11 asterisk-11-to-commit cd asterisk-11-to-commit/ git svn rebase wget "https://issues.asterisk.org/jira/secure/attachment/44536/0001-RFC-pjproject-Fix-for-Solaris-builds.-Do-not-undef-s.patch" -O - | git am wget "https://issues.asterisk.org/jira/secure/attachment/44537/0002-main-acl.c-Trivial.-best_score-should-be-defined-for.patch" -O - | git am # Add menuselect temporarily so that you can build / test / do whatever you need to do to convince yourself the patches are good svn export http://svn.asterisk.org/svn/menuselect/trunk menuselect git add menuselect/ git commit -m "DELETE: menuselect" ./configure && make ## Now you can rebase the entire patch set to add any notes to the commit messages and delete menuselect before commiting git rebase -i git-svn {code} When you run rebase you'll see something like the following: {noformat} pick 8fb011a pjproject: Fix for Solaris builds. Do not undef s_addr. pick e11acfd main/acl.c: Trivial. 'best_score' should be defined for all architectures. pick c928497 DELETE: adding menuselect # Rebase fb21af1..c928497 onto fb21af1 # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom. # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # # Note that empty commits are commented out {noformat} Which you should just change to the following in order to reword the two real commits and drop menuselect (so you don't commit it to the 11-branch since it's an external) before committing to subversion: {noformat} r 3bb5a77 pjproject: Fix for Solaris builds. Do not undef s_addr. r 921eaf4 main/acl.c: Trivial. 'best_score' should be defined for all architectures. {noformat} Only after everything looks good do you need to commit with: {noformat} git svn dcommit {noformat} |