C extension fails to build on Solaris with newer GCC because of -std=c99
------------------------------------------------------------------------

                 Key: JRUBY-5601
                 URL: http://jira.codehaus.org/browse/JRUBY-5601
             Project: JRuby
          Issue Type: Bug
          Components: C Extensions
    Affects Versions: JRuby 1.6
         Environment: Solaris 10/x86, gcc 4.5.1
            Reporter: Clayton O'Neill
            Assignee: Thomas E Enebo
         Attachments: solaris-c99.patch

I get the error below when building the cext.  The problem appears to be the 
following:

* -std=c99 is added to CFLAGS for Solaris
* CFLAGS also contains -Werror
* CFLAGS is propagated to CXXFLAGS without change
* We're compiling C++ code.
* gcc considers compiling C++ with -std=c99 to be nonsensical, and throws a 
warning
* -Werror is on, so the warning becomes an error and compilation dies.

Attached is a patch that removes -std=c99 from the Makefile, since it *appears* 
to be unnecessary.

Output:
 [exec] gcc -m32  -DNDEBUG -fno-omit-frame-pointer -fno-strict-aliasing -W 
-Wall -Wno-unused -Wno-parentheses -Werror -Wundef 
-I"/sw/src/BUILD/jruby-1.6.0/cext/src/../..//build" 
-I"/sw/src/BUILD/jruby-1.6.0/cext/src" 
-I"/sw/src/BUILD/jruby-1.6.0/cext/src/../..//build"/jni 
-I"/sw/src/BUILD/jruby-1.6.0/cext/src"/include 
-I"/sw/src/BUILD/jruby-1.6.0/cext/src"/include/ruby -fPIC 
-I"/sw/jdk/jdk-1.6/include" -I"/sw/jdk/jdk-1.6/include/solaris"  -D_REENTRANT 
-D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D__EXTENSIONS__ -std=c99 -c 
/sw/src/BUILD/jruby-1.6.0/cext/src/st.c -o 
/sw/src/BUILD/jruby-1.6.0/cext/src/../..//build/st.o
     [exec] cc1plus: warnings being treated as errors
     [exec] cc1plus: error: command line option "-std=c99" is valid for C/ObjC 
but not for C++




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to