Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000416 [Yate - Yet Another Telephony Engine] module minor always 2017-04-29 13:11 2017-05-31 00:38
Reporter mnhauke View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version SVN
Summary 0000416: YateBTS does not build with recent gcc versions (6.x)
Description YateBTS does not build with recent gcc versions.
SVN-rev633 as well as stable version 5.5.1 are affected.
Actuals tests were done with gcc6-6.3.1+r245113.

Here's an small fraction from the compiler errors one get:
---snip---
...
   45s] Sgsn.cpp:256:2: note: in expansion of macro 'SGSNLOGF'
[ 45s] SGSNLOGF(INFO,GPRS_OK|GPRS_MSG,"SGSN","Removing gmm:"<<ss);
[ 45s] ^~~~~~~~
[ 45s] In file included from /usr/include/c++/6/string:52:0,
[ 45s] from /usr/include/c++/6/stdexcept:39,
[ 45s] from /usr/include/c++/6/array:39,
[ 45s] from /usr/include/c++/6/tuple:39,
[ 45s] from /usr/include/c++/6/bits/stl_map.h:63,
[ 45s] from /usr/include/c++/6/map:61,
[ 45s] from ./../CommonLibs/MemoryLeak.h:18,
[ 45s] from ./../GPRS/ByteVector.h:21,
[ 45s] from LLC.h:23,
[ 45s] from Sgsn.cpp:21:
[ 45s] /usr/include/c++/6/bits/basic_string.h:5340:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
[ 45s] operator<<(basic_ostream<_CharT, _Traits>& __os,
[ 45s] ^~~~~~~~
[ 45s] /usr/include/c++/6/bits/basic_string.h:5340:5: note: template argument deduction/substitution failed:
[ 45s] In file included from LLC.h:24:0,
[ 45s] from Sgsn.cpp:21:
[ 45s] Sgsn.cpp:256:57: note: 'std::ostringstream {aka std::__cxx11::basic_ostringstream<char>}' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
[ 45s] SGSNLOGF(INFO,GPRS_OK|GPRS_MSG,"SGSN","Removing gmm:"<<ss);
[ 45s] ^
[ 45s] SgsnBase.h:47:82: note: in definition of macro 'SGSNLOG'
[ 45s] #define SGSNLOG(level,bitmask,who,stuff) PS_LOG(level,bitmask) << who << ": " << stuff;
[ 45s] ^~~~~
[ 45s] Sgsn.cpp:256:2: note: in expansion of macro 'SGSNLOGF'
[ 45s] SGSNLOGF(INFO,GPRS_OK|GPRS_MSG,"SGSN","Removing gmm:"<<ss);
[ 45s] ^~~~~~~~
[ 45s] In file included from SgsnBase.h:20:0,
[ 45s] from LLC.h:24,
[ 45s] from Sgsn.cpp:21:
[ 45s] Sgsn.cpp:256:55: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and 'std::ostringstream {aka std::__cxx11::basic_ostringstream<char>}')
[ 45s] SGSNLOGF(INFO,GPRS_OK|GPRS_MSG,"SGSN","Removing gmm:"<<ss);
[ 45s]
[ 45s] miniggsn.h:94:50: note: in definition of macro 'MGLOG'
[ 45s] #define MGLOG(stuff) {std::ostringstream ss; ss<<stuff; MGLOGF("%s",ss.str().c_str());}
[ 45s] ^~~~~
[ 45s] Sgsn.cpp:256:2: note: in expansion of macro 'SGSNLOGF'
[ 45s] SGSNLOGF(INFO,GPRS_OK|GPRS_MSG,"SGSN","Removing gmm:"<<ss);
[ 45s] ^~~~~~~~
[ 45s] Sgsn.cpp:256:55: note: candidate: operator<<(int, int) <built-in>
[ 45s] SGSNLOGF(INFO,GPRS_OK|GPRS_MSG,"SGSN","Removing gmm:"<<ss);
---

I have attached a full buildlog from openSUSE Tumbleweed
Additional Information
Tags No tags attached.
Attached Files txt file icon YateBTS-gcc6x-compilation-error-buildlog-from-openSUSE-Tumbleweed-x68_64.txt [^] (286,983 bytes) 2017-04-29 13:11
? file icon yatebts-5.0.0-gcc6.patch [^] (1,125 bytes) 2017-05-28 07:43

- Relationships

-  Notes
(0000613)
PLevine (reporter)
2017-05-28 07:43
edited on: 2017-05-28 07:51

Previous to C++11, there existed `operator void*() const` for ostreams. Statements like:

    std::ostream test;
    test << "testing";
    std::cout << test;

would cause the address of `test` to be printed to stdout (eg., "0x7ffcbe760dd0") if its failbit wasn't set or NULL (eg., "0x000000000000") if it was. It seemed the intent of the operator was to allow the address to be casted to `bool` for error handling and/or logging. This, however, has been replaced in C++11 with `explicit operator bool() const`. The error is caused because there is no longer implicit conversion from an ostream object to anything that can be streamed to an ostream object. IMHO, the best measure would be to change ostream object `os` to `(!os.fail())` in a statement like:

    std::cout << os;

This would output 1 or 0 instead of a valid address or NULL address, respectively, and would be valid for all dialects of C++.

(0000614)
mnhauke (reporter)
2017-05-31 00:38

Thanks for providing this patch - the build issue is gone.
It would be nice to have this fix in SVN head too.

- Issue History
Date Modified Username Field Change
2017-04-29 13:11 mnhauke New Issue
2017-04-29 13:11 mnhauke File Added: YateBTS-gcc6x-compilation-error-buildlog-from-openSUSE-Tumbleweed-x68_64.txt
2017-05-28 07:43 PLevine Note Added: 0000613
2017-05-28 07:43 PLevine File Added: yatebts-5.0.0-gcc6.patch
2017-05-28 07:51 PLevine Note Edited: 0000613
2017-05-31 00:38 mnhauke Note Added: 0000614


Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker