Author Topic: Which c++ standard should we compile YateBTS with ?  (Read 9631 times)

spina

  • Newbie
  • *
  • Posts: 6
    • View Profile
Which c++ standard should we compile YateBTS with ?
« on: October 02, 2018, 05:30:18 PM »
As you might already know, YateBTS trunk does not compile with recent versions of GCC, due to a few errors related to iostream manipulations.

These errors are easy to fix in yate-bts source code (see https://forum.yate.ro/index.php?topic=1966.0).

Though, I was confused why they were not an issue for you, I mean upstream. Which version of GCC do you use ? GCC 4.x, right ?

AFAIK, without otherwise specified:
Quote
By default, g++ is equivalent to g++ -std=gnu++14 since GCC 6, and g++ -std=gnu++98 for older releases.

And actually, if I set -std=gnu++98 in the appropriate Makefile, yate-bts compiles just fine.
My concern is that -std=gnu++98 and -std=gnu++14 may be somewhat different languages, and hence, depending on the C++ features and the GNU extensions the yate-bts source code actually use, and combine, building as -std=gnu++98 or -std=gnu++14 may not generate semantically identical object code.
Which makes me think that setting -std=gnu++98 might be a more consistent fix than (just) patching MSInfo.cpp and Sgsn.cpp to remove the compilation errors. Can someone confirm this ?

IMHO, if it's somewhat important to build the source code as 1998 ISO C++ with GNU extensions, it might be a good idea to enforce this through the Makefiles: -std=gnu++14 is the default for Ubuntu since Artful 17.10 (and thus for Bionic 18.04 LTS), for Debian since stretch, and obviously for Arch, which sum to a huge Linux users base. BTW, none of these users would be able to build YateBTS out of the box.   

The same question may also apply to C code (should we enforce -std=gnu99 or something else ?).
And may be also when building yate (server) itself: it compiles fine, but should we also enforce standards there ?

Thanks in advance for your answers.

[EDIT]
  • I've attached the patches I use to consistently set -std=gnu++98 as C++ standard, and -std=gnu99 as C standard for both yate and yate-bts build files. I'm not sure it's the simplest/best fix, but yate and yate-bts build with GCC 8.2 without the need to otherwise patch the source code. 
    The diff are against versions 6.1.0-1, and may apply to any 6.x.
  • May be it still would not hurt to fix MSInfo.cpp and Sgsn.cpp, though ?
[/EDIT]

Kind regards,
spina.
 
« Last Edit: October 04, 2018, 08:29:54 PM by spina »

el_dorado

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Which c++ standard should we compile YateBTS with ?
« Reply #1 on: October 28, 2018, 10:45:15 AM »
A very interesting finding! Does it work stable for you after you changed the standard, instead of patches?

goodboytower

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Which c++ standard should we compile YateBTS with ?
« Reply #2 on: November 19, 2018, 05:21:54 PM »
Will this patch function with Yate 5,x? I'm working with the BladeRF and was told there are specific versions of Yate, YBTS and BladeRF firmware/FPGA that "play well" together, do you know what versions of BladeRF are compatible with Yate 6.x?
If you're reading my troubleshooting posts, just know that: I got it to work! I'm calling it "GoodBTS", here's a Github guide that you can find here! I hope to make it a thorough guide and keep it active for you!