Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Build failed on QNX7.1 x86_64 with -Vgcc/8.3.0,gcc_ntox86_64 -Y_gpp: (4 Items)
   
Build failed on QNX7.1 x86_64 with -Vgcc/8.3.0,gcc_ntox86_64 -Y_gpp  
When build the following C++ code:

// test.cpp
#include <map>
#include <string>
#include <iostream>

using namespace std;

int main()
{
    map<int, int> m = { {0, 0}, {1, 1} };
    cout << "Hello, stdc++17\n";
    return 0;
}

1. Build with C++17 and LLVM C++ library, work fine

   /root/qnx710/host/linux/x86_64/usr/bin/q++ -Vgcc/8.3.0,gcc_ntox86_64 -Y_cxx -lang-c++ -std=gnu++17 -o test test.cpp
   
2. Build with C++17 and GNU C++ library: can't work

    /root/qnx710/host/linux/x86_64/usr/bin/q++ -Vgcc/8.3.0,gcc_ntox86_64 -Y_gpp -lang-c++ -std=gnu++17 -o test test.cpp

    In file included from /root/qnx710/target/qnx7/usr/include/stddef.h:23,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/cxxabi_init_exception.h:38,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/exception_ptr.h:38,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/exception:143,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/new:40,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/ext/new_allocator.h:33,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/x86_64-pc-nto-qnx7.1.0/bits/c++allocator.h:33,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/allocator.h:46,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_tree.h:64,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/map:60,
                 from test.cpp:1:
/root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_map.h:638:25: error: expected nested-name-specifier before 
numeric constant
       template<typename _C2>
                         ^~~
/root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_map.h:638:25: error: expected '>' before numeric constant
In file included from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/map:61,
                 from test.cpp:1:
/root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_map.h:640:34: error: type/value mismatch at argument 3 in 
template parameter list for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  merge(map<_Key, _Tp, _C2, _Alloc>& __source)
                                  ^
/root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_map.h:640:34: note:   expected a type, got '1'
In file included from /root/qnx710/target/qnx7/usr/include/stddef.h:23,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/cxxabi_init_exception.h:38,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/exception_ptr.h:38,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/exception:143,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/new:40,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/ext/new_allocator.h:33,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/x86_64-pc-nto-qnx7.1.0/bits/c++allocator.h:33,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/allocator.h:46,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_tree.h:64,
                 from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/map:60,
                 from test.cpp:1:
/root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_map.h:646:25: error: expected nested-name-specifier before numeric constant
       template<typename _C2>
                         ^~~
/root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_map.h:646:25: error: expected '>' before numeric constant
In file included from /root/qnx710/target/qnx7/usr/include/c++/8.3.0/map:61,
                 from test.cpp:1:
/root/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_map.h:648:34: error: type/value mismatch at argument 3 in 
template parameter list for 'template<class _Key, class _Tp, class _Compare, class...
View Full Message
Re: Build failed on QNX7.1 x86_64 with -Vgcc/8.3.0,gcc_ntox86_64 -Y_gpp  
This is a long-standing bug in the QNX libc. I can't seem to be able to find the JIRA trail, but the workaround is to 
remove the #define of _C2 from <sys/target_nto.h> since it's not used anywhere but causes C++ compilations to break when
 using the GNU libstdc++ library.
Re: Build failed on QNX7.1 x86_64 with -Vgcc/8.3.0,gcc_ntox86_64 -Y_gpp  
That's not a bug in libc - a system header can declare a symbol that starts in an underscore and a capital letter. The 
fact that it collides with a symbol defined in a GNU header is not really our problem.
Nevertheless it is something we can solve by removing a symbol that's no longer used.

--Elad
Re: Build failed on QNX7.1 x86_64 with -Vgcc/8.3.0,gcc_ntox86_64 -Y_gpp  
Thanks! I found #define _C2 1 in yvals.h line 418 and don't know whoelse use the macro _C2. So I replace _C2 with __C2 
in bits/stl_multimap.h and bits/stl_map.h to solve the problem.