Re: gcc 4.9

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 01 Aug 2016 17:23:43 -0700, stan wrote:

> On Mon, 1 Aug 2016 22:21:58 +0000 (UTC)
> "Amadeus W.M." <amadeus84@xxxxxxxxxxx> wrote:
> 
>> On Mon, 01 Aug 2016 09:34:51 -0700, stan wrote:
>> 
>> > On Mon, 1 Aug 2016 04:30:03 +0000 (UTC)
>> > "Amadeus W.M." <amadeus84@xxxxxxxxxxx> wrote:
>> > [snip]
>> >> Unfortunately nothing worked.
>> >> 
>> >> 
>> >> In the cuda distribution there is a host_config.h file which
>> >> contains the following lines:
>> >> 
>> >> #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9)
>> >> 
>> >> #error -- unsupported GNU version! gcc versions later than 4.9 are
>> >> not supported!
>> >> 
>> >> #endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) */
>> >> 
>> >> 
>> >> This checks the version of the compiler and triggers an error with
>> >> gcc-6.1 even if I pass --std=gnu89 which was the default C standard
>> >> in gcc-4.9.
>> > 
>> > You don't have write access to that file?  If you do, you could just
>> > comment out that check.
>> >   
>> >   
>> I do have write access to that file, but I imagine that compiler check
>> is there for a reason, so I would rather use the right compiler than
>> not check for it. Chances are the cuda code won't compile (correctly)
>> if I skip the check. Still, maybe worth a shot.
> 
> But that's why you put in the --std=gnu89 flag.  You're telling gcc to
> pretend that it is gcc 4.9, even though it's 6.1, so you are manually
> doing the check.  That is, even though the compiler is 6.1, it's going
> to emulate 4.9.


That's what I thought too, but try this: 

// Compile as 
// g++ -o gnuc gnuc.cpp                      
// then as 
// g++ --std=gnu++11 -o gnuc gnuc.cpp

#include <iostream>
#include <cstdlib>

using namespace std;

int main(int argc, char * argv[])
{
    cout << __GNUC__ << "." << __GNUC_MINOR__ << endl;
    return 0;
}


It always outputs 6.1, whether or not you compile it with the --std flag. 
And if you think about it, __GNUC__ is probably a macro defined in the 
compiler at compile time, so it can't possibly change at run time. Haven't 
checked, but it's a good guess.

--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://lists.fedoraproject.org/admin/lists/users@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux