Code generation problem with g++ 7 and g++ 8 on Red Hat Enterprise Linux (RHEL) 7

Solution Verified - Updated -

Issue

  • Compilation with g++ 4.8 works, while version 7.3 and 8.3 throw error messages like the following:

    $ g++ --version
    g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
    
    $ g++ '-Wno-deprecated' '-Wno-write-strings' '-Wno-int-to-pointer-cast' '-m64' '-g' '-fno-inline' '-fno-omit-frame-pointer' '-fno-builtin' '-std=gnu++11' '-fpermissive' '-fPIC' '-fsanitize=address' '-Wdelete-non-virtual-dtor' '-Wreturn-type' '-Wconversion-null' '-Wuninitialized' '-Wdiv-by-zero' '-Wenum-compare' '-Woverflow' '-Wpointer-arith' '-Wno-narrowing' '-Wno-main' '-Wno-deprecated-declarations' '-Wno-attributes' '-Wno-maybe-uninitialized' -c test.cpp
    
    $ g++ --version
    g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
    
    $ /opt/rh/devtoolset-7/root/usr/bin/g++ '-Wno-deprecated' '-Wno-write-strings' '-Wno-int-to-pointer-cast' '-m64' '-g' '-fno-inline' '-fno-omit-frame-pointer' '-fno-builtin' '-std=gnu++11' '-fpermissive' '-fPIC' '-fsanitize=address' '-Wdelete-non-virtual-dtor' '-Wreturn-type' '-Wconversion-null' '-Wuninitialized' '-Wdiv-by-zero' '-Wenum-compare' '-Woverflow' '-Wpointer-arith' '-Wno-narrowing' '-Wno-main' '-Wno-deprecated-declarations' '-Wno-attributes' '-Wno-maybe-uninitialized' -c test.cpp
    
    /tmp/ccYKBy02.s: Assembler messages:
    
    /tmp/ccYKBy02.s:10900: Error: symbol `_ZZZN4mage12NetworkModel10modelQueryERKNS_6ioid_tERK7QStringbS6_PiS6_Ed_NKUlvE_clEvE15qstring_literal' is already defined
    
    /tmp/ccYKBy02.s:10916: Error: symbol `_ZZN4mage12NetworkModel10modelQueryERKNS_6ioid_tERK7QStringbS6_PiS6_Ed_NKUlvE_clEv' is already defined
    
    
    $ /opt/rh/devtoolset-8/root/usr/bin/g++ --version
    g++ (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
    
    $ /opt/rh/devtoolset-8/root/usr/bin/g++ '-Wno-deprecated' '-Wno-write-strings' '-Wno-int-to-pointer-cast' '-m64' '-g' '-fno-inline' '-fno-omit-frame-pointer' '-fno-builtin' '-std=gnu++11' '-fpermissive' '-fPIC' '-fsanitize=address' '-Wdelete-non-virtual-dtor' '-Wreturn-type' '-Wconversion-null' '-Wuninitialized' '-Wdiv-by-zero' '-Wenum-compare' '-Woverflow' '-Wpointer-arith' '-Wno-narrowing' '-Wno-main' '-Wno-deprecated-declarations' '-Wno-attributes' '-Wno-maybe-uninitialized' -c test.cpp
    
    /tmp/cccyLgEo.s: Assembler messages:
    
    /tmp/cccyLgEo.s:11389: Error: symbol `_ZZZN4mage12NetworkModel10modelQueryERKNS_6ioid_tERK7QStringbS6_PiS6_Ed_NKUlvE_clEvE15qstring_literal' is already defined
    
    /tmp/cccyLgEo.s:11405: Error: symbol `_ZZN4mage12NetworkModel10modelQueryERKNS_6ioid_tERK7QStringbS6_PiS6_Ed_NKUlvE_clEv' is already defined
    

Environment

  • Red Hat Enterprise Linux (RHEL) 7
  • gcc 7.x/8.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content