Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 675404

Summary: sci-mathematics/octave-4.4.1 - liboctave/util/lo-utils.cc: In function 'double octave_read_fp_value(std::istream&)': liboctave/util/lo-utils.cc:264:13: error: 'streampos' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
Product: Gentoo Linux Reporter: Helmut Jarausch <jarausch>
Component: Current packagesAssignee: Gentoo Science Mathematics related packages <sci-mathematics>
Status: RESOLVED UPSTREAM    
Severity: normal CC: hydrapolic, rossi.f
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Helmut Jarausch 2019-01-14 14:55:23 UTC
octaveoctave-4.4.1  needs a fix

add
sed -i -e's/ios::streampos/streampos/' liboctave/util/lo-utils.cc
to src_prepare.

This fixes

liboctave/util/lo-utils.cc: In function 'double octave_read_fp_value(std::istream&)':
liboctave/util/lo-utils.cc:264:13: error: 'streampos' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
Comment 1 Tomáš Mózes 2019-01-14 15:00:16 UTC
Are you hitting an error during compilation? Please attach the full build log and the output of emerge --info.
Comment 2 Helmut Jarausch 2019-04-03 08:36:37 UTC
(In reply to Tomáš Mózes from comment #1)
> Are you hitting an error during compilation? Please attach the full build
> log and the output of emerge --info.

I get liboctave/util/lo-utils.cc: In function 'double octave_read_fp_value(std::istream&)':
liboctave/util/lo-utils.cc:264:13: error: 'streampos' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
   std::ios::streampos pos = is.tellg ();


This error is only flagged if one uses  -std=c++17 as I do.
You can try to compile
#include <fstream>

int main() {
  std::ifstream is("T.c");
//  std::streampos pos = is.tellg ();  //OK
  std::ios::streampos pos = is.tellg ();  // NOT OK
}

with g++ -c -std=c++17 

According to http://www.cplusplus.com/reference/ios/streampos/
streampos is now a member of the namespace std but not of std::ios any more.

It is safe to use std::streampos even if -std=c++14.
Comment 3 Fabio Rossi 2019-04-03 09:28:41 UTC
Thanks for investigating about the root cause of the problem. 

IMHO the problem is in your CXXFLAGS, why are you specifying globally -std=c++17? Usually if a package needs particular flags like that than they are specified in the package build configuration system.

Until the minimum required c++ standard version used by gcc is 2017 I am not sure if it makes sense to add a specific patch to portage, currently gcc-8 defines

$ g++ -dM -E -x c++  /dev/null | grep -F __cplusplus
#define __cplusplus 201402L

The package maintainer should choose about fixing the issue or not.

Anyway I have sent upstream a patch as in the code they are already using std::streampos everywhere else, here is reference: https://savannah.gnu.org/patch/index.php?9782
Comment 4 Benda Xu gentoo-dev 2019-08-25 00:38:28 UTC
Thank you Helmut and Fabio!