Closed Bug 818836 Opened 12 years ago Closed 12 years ago

Build failure caused by netwerk/sctp/src/usrsctp.h defining __USE_GNU

Categories

(Core :: WebRTC: Networking, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: jseward, Assigned: jesup)

Details

(Whiteboard: [qa-])

Attachments

(1 file)

x86_64-linux, m-c, gcc-4.7.2, -g -O2, Ubuntu 10.04.4 LTS.  Build fails
as shown below (w/ apologies for ugly mess).  Kludging it thusly
allows the build to succeed.


diff --git a/netwerk/sctp/src/usrsctp.h b/netwerk/sctp/src/usrsctp.h
--- a/netwerk/sctp/src/usrsctp.h
+++ b/netwerk/sctp/src/usrsctp.h
@@ -39,19 +39,19 @@ extern "C" {
 #ifdef _WIN32
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #include <ws2ipdef.h>
 #include <ws2def.h>
 #else
 #include <sys/socket.h>
 /*  to make sure some OSs define in6_pktinfo */
-#define __USE_GNU
+//#define __USE_GNU
 #include <netinet/in.h>
-#undef __USE_GNU
+//#undef __USE_GNU
 #endif
 
 #ifndef MSG_NOTIFICATION
 /* This definition MUST be in sync with usrsctplib/user_socketvar.h */
 #define MSG_NOTIFICATION 0x2000
 #endif
 
 #ifndef IPPROTO_SCTP



    runnable_utils_unittest.cpp
    In file included from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/transportflow.h:18:0,
                     from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/transport_unittests.cpp:25:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/transportlayer.h: In member function ‘nsresult mozilla::TransportLayer::RunOnThread(nsIRunnable*)’:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/transportlayer.h:68:16: warning: unused variable ‘rv’ [-Wunused-variable]
    In file included from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/ice_unittest.cpp:30:0:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int]’:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1440:30:   required from ‘static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int; bool lhs_is_null_literal = false]’
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/ice_unittest.cpp:284:5:   required from here
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1403:3: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    sctp_unittest.cpp
    In file included from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/transport_unittests.cpp:37:0:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int]’:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1440:30:   required from ‘static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int; bool lhs_is_null_literal = false]’
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/transport_unittests.cpp:125:5:   required from here
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1403:3: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    In file included from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/sctp_unittest.cpp:28:0:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/usrsctp.h:47:0: warning: "__USE_GNU" redefined [enabled by default]
    In file included from ../../../dist/system_wrappers/features.h:3:0,
                     from /home/sewardj/Tools/InstGcc472/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/x86_64-unknown-linux-gnu/bits/os_defines.h:40,
                     from /home/sewardj/Tools/InstGcc472/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/x86_64-unknown-linux-gnu/bits/c++config.h:414,
                     from /home/sewardj/Tools/InstGcc472/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/new:41,
                     from ../../../dist/system_wrappers/new:3,
                     from ../../../dist/stl_wrappers/iostream:28,
                     from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/sctp_unittest.cpp:9:
    /usr/include/features.h:294:0: note: this is the location of the previous definition
    In file included from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/transportflow.h:18:0,
                     from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/sctp_unittest.cpp:21:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/transportlayer.h: In member function ‘nsresult mozilla::TransportLayer::RunOnThread(nsIRunnable*)’:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/transportlayer.h:68:16: warning: unused variable ‘rv’ [-Wunused-variable]
    In file included from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/sctp_unittest.cpp:28:0:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/usrsctp.h: At global scope:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/usrsctp.h:241:19: warning: ISO C++ forbids zero-size array ‘sac_info’ [-pedantic]
    /space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/usrsctp.h:350:32: warning: ISO C++ forbids zero-size array ‘strreset_stream_list’ [-pedantic]
    /space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/usrsctp.h:400:21: warning: ISO C++ forbids zero-size array ‘ssfe_data’ [-pedantic]
    /space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/usrsctp.h:615:27: warning: ISO C++ forbids zero-size array ‘srs_stream_list’ [-pedantic]
    /space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/usrsctp.h:626:24: warning: ISO C++ forbids zero-size array ‘shmac_idents’ [-pedantic]
    /space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/usrsctp.h:695:24: warning: ISO C++ forbids zero-size array ‘gauth_chunks’ [-pedantic]
    /space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/usrsctp.h:700:30: warning: ISO C++ forbids zero-size array ‘gaids_assoc_id’ [-pedantic]
    /space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/usrsctp.h:765:19: warning: ISO C++ forbids zero-size array ‘sca_key’ [-pedantic]
    In file included from ../../../dist/system_wrappers/getopt.h:3:0,
                     from /usr/include/unistd.h:887,
                     from ../../../dist/system_wrappers/unistd.h:3,
                     from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-port.h:284,
                     from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-internal.h:40,
                     from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:58,
                     from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/sctp_unittest.cpp:31:
    /usr/include/getopt.h:163:21: error: expected initializer before ‘throw’
    In file included from /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/sctp_unittest.cpp:31:0:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int]’:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1440:30:   required from ‘static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int; bool lhs_is_null_literal = false]’
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/sctp_unittest.cpp:184:5:   required from here
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1403:3: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     
    In the directory  /space2/sewardj/MOZ/MC-05-12-2012-MC/ff-opt/media/mtransport/test
    The following command failed to execute properly:
    c++ -o sctp_unittest.o -c -I../../../dist/stl_wrappers -I../../../dist/system_wrappers -include /space2/sewardj/MOZ/MC-05-12-2012-MC/config/gcc_hidden.h -DHAVE_STRDUP -DNR_SOCKET_IS_VOID_PTR -DSCTP_DEBUG -DINET -DINET6 -D__Userspace_os_Linux=1 -DMOZ_GLUE_IN_PROGRAM -DNO_NSPR_10_SUPPORT -I. -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/webrtc/trunk/testing/gtest/include/ -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/ -I/space2/sewardj/MOZ/MC-05-12-2012-MC/netwerk/sctp/src/ -I. -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/ -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/ -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nICEr/src/crypto -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nICEr/src/ice -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nICEr/src/net -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nICEr/src/stun -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nICEr/src/util -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nrappkit/src/share -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nrappkit/src/util/libekr -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nrappkit/src/log -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nrappkit/src/registry -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nrappkit/src/stats -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nrappkit/src/plugin -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nrappkit/src/event -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/third_party/nrappkit/src/port/linux/include -I/space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test -I. -I../../../dist/include -I/space2/sewardj/MOZ/MC-05-12-2012-MC/ff-opt/dist/include/nspr -I/space2/sewardj/MOZ/MC-05-12-2012-MC/ff-opt/dist/include/nss -I../../../dist/include/testing -fPIC -pedantic -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Wtype-limits -Wempty-body -Wno-ctor-dtor-privacy -Wno-overlength-strings -Wno-invalid-offsetof -Wno-variadic-macros -Wcast-align -Wno-long-long -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -std=gnu++0x -pthread -pipe -DNDEBUG -DTRIMMED -g -g -O2 -fomit-frame-pointer -DMOZILLA_CLIENT -include ../../../mozilla-config.h -MD -MF .deps/sctp_unittest.o.pp /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/sctp_unittest.cpp
    make[5]: *** [sctp_unittest.o] Error 1
    make[5]: *** Waiting for unfinished jobs....
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/transport_unittests.cpp: At global scope:
    /space2/sewardj/MOZ/MC-05-12-2012-MC/media/mtransport/test/transport_unittests.cpp:41:1: warning: ‘PRLogModuleInfo* getLogModule()’ defined but not used [-Wunused-function]
    make[4]: *** [libs_tier_platform] Error 2
    make[3]: *** [tier_platform] Error 2
    make[2]: *** [default] Error 2
    make[1]: *** [realbuild] Error 2
    make: *** [build] Error 2
(In reply to Julian Seward from comment #0)
> -#define __USE_GNU
> +//#define __USE_GNU
>  #include <netinet/in.h>
> -#undef __USE_GNU
> +//#undef __USE_GNU

So, AIUI you should never #define __USE_GNU directly. Instead you're supposed to #define _GNU_SOURCE. We certainly shouldn't be _#undef_ing it (this is probably what breaks getopt.h).
Switched to _GNU_SOURCE; hopefully it will work on all the systems we use.  Works on Fedora 17
Comment on attachment 690176 [details] [diff] [review]
Use _GNU_SOURCE instead of __USE_GNU

Mike seems like a good reviewer here
Attachment #690176 - Flags: review?(mh+mozilla)
Attachment #690176 - Flags: review?(mh+mozilla) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/d3d705c337a5
Assignee: nobody → rjesup
Target Milestone: --- → mozilla20
https://hg.mozilla.org/mozilla-central/rev/d3d705c337a5
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: