Build error

Build error

I was trying to build OpenMP on a SUSE Linux Enterprise Server distro. I kept getting error messages from a Perl program which was checking the GCC version and not liking the result. I copied the code for one of the other OSs for SLES, and that fixed it. I am not sure what it was trying to do (Perl is not my strong suit), but whatever it was it wasn't working. Attachments don't appear to work on this site, so here is the code (check-tools.pl)with changes marked JBB;

sub get_gnu_compiler_version($) {

    my ( $tool ) = @_;

    my ( @ret ) = ( $tool );

    my ( $rc, $stdout, $stderr, $version );

    $rc = run( [ $tool, "--version" ], $stdout, $stderr );

    if ( $rc >= 0 ) {
        my ( $ver, $bld );

        if ( $target_os eq "mac" ) {

            # i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367)

            # i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5484)

            # i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

            $stdout =~ m{^.*? \(GCC\) (\d+\.\d+\.\d+) \(.*Apple.*?Inc\. build (\d+)\)}m;

            ( $ver, $bld ) = ( $1, $2 );

        } else {

            if ( 0 ) {

            } elsif ( $stdout =~ m{^.*? \(GCC\) (\d+\.\d+\.\d+)(?: (\d+))?}m ) {

                # g++ (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-20)

                # GNU Fortran (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7)

                ( $ver, $bld ) = ( $1, $2 );

            } elsif ( $stdout =~ m{^.*? \(SUSE Linux\) (\d+\.\d+\.\d+)(?: (\d+))?}m ) {

#JBB            } elsif ( $stdout =~ m{^.*? \(SUSE Linux\) (\d+\.\d+\.\d+)\s+\[.*? (\d+)\]}m ) {

                # gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291]

#JBB                  gcc (SUSE Linux) 4.7.2 20130108 [gcc-4_7-branch revision 195014]

                ( $ver, $bld ) = ( $1, $2 );

            } elsif ( $stdout =~ m{^.*? \((Debian|Ubuntu).*?\) (\d+\.\d+\.\d+)}m ) {

                # gcc (Debian 4.7.2-22) 4.7.2

                # Debian support from Sylvestre Ledru
 
                # Thanks!

                $ver = $2;

            }; # if

        }; # if

 

 

 

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Thank you for this finding!

We should probably make conditions less strict when checking GCC version.

Just FYI - the fix will be available in the next release.

Login to leave a comment.