Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error due to ambiguous ostrstream while running bfc.C in ROOT6 #126

Closed
plexoos opened this issue Aug 27, 2021 · 8 comments · Fixed by #150
Closed

Error due to ambiguous ostrstream while running bfc.C in ROOT6 #126

plexoos opened this issue Aug 27, 2021 · 8 comments · Fixed by #150
Labels
ROOT6 Issues and changes related to transition from ROOT5 to ROOT6

Comments

@plexoos
Copy link
Member

plexoos commented Aug 27, 2021

When I try to run one of our tests in ROOT6 environment I get the following error:

Processing bfc.C(10, "pp2017,StiCA,btof,mtd,pp2pp,fmsDat,fmsPoint,fpsDat,BEmcChkStat,QAalltrigs,CorrX,OSpaceZ2,OGridLeak3D,-hitfilt", "/star-test-data/quick/st_physics_18069061_raw_2000021.daq")...
In file included from input_line_37:1:
In file included from /star-sw/StRoot/macros/bfc.C:19:
In file included from /star-sw/.sl88_gcc789/include/StBFChain.h:22:
In file included from /star-sw/.sl88_gcc789/include/StChain.h:22:
In file included from /star-sw/.sl88_gcc789/include/StMaker.h:26:
/star-sw/.sl88_gcc789/include/StMessMgr.h:108:26: error: reference to 'ostrstream' is ambiguous
class StMessMgr : public ostrstream {
                         ^
/star-sw/.sl88_gcc789/include/Stsstream.h:15:7: note: candidate found by name lookup is 'ostrstream'
class ostrstream : public std::ostringstream {
      ^
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward/strstream:143:9: note: candidate found by name lookup is 'std::ostrstream'
  class ostrstream : public basic_ostream<char>

Any suggestions how to fix this? @perevbnlgov @klendathu2k

@klendathu2k
Copy link
Contributor

klendathu2k commented Aug 27, 2021 via email

@plexoos
Copy link
Member Author

plexoos commented Aug 27, 2021

A possible solution would be to delete everything in Stsstream.h and replace with #include <strstream>

So, basically you are proposing to drop our local implementation of ostrstream https://github.com/star-bnl/star-sw/blob/main/StRoot/St_base/Stsstream.h#L15-L27 and rely on the deprecated one in <strstream>
Hm... I believe the local ostrstream was introduced because it has been deprecated relatively long time ago and probably already missing in some releases.

Anyway, for now I just renamed our 'ostrstream' to something different so it does not collide with the std:: one from wherever it is coming from. Enclosing it in a star:: namespace would probably be a better solution... Fortunately, we don't have many instances where ostrstream is used in the code.

@plexoos plexoos added the ROOT6 Issues and changes related to transition from ROOT5 to ROOT6 label Aug 27, 2021
@perevbnlgov
Copy link
Contributor

perevbnlgov commented Aug 27, 2021 via email

@klendathu2k
Copy link
Contributor

klendathu2k commented Aug 27, 2021 via email

@perevbnlgov
Copy link
Contributor

perevbnlgov commented Aug 27, 2021 via email

@plexoos
Copy link
Member Author

plexoos commented Aug 27, 2021

Why not move to something that replaced ostrstream? https://stackoverflow.com/questions/10849656/what-should-i-use-instead-of-stdostrstream Specifically...

It was exactly what i did and lost , basic_stringstream

Is there anything wrong with renaming the redefined ostrstream to something else in order to avoid collision with std::ostrstream?

@klendathu2k
Copy link
Contributor

klendathu2k commented Aug 27, 2021 via email

@klendathu2k
Copy link
Contributor

klendathu2k commented Aug 28, 2021 via email

plexoos added a commit that referenced this issue Sep 2, 2021
Fixes #126 Error due to ambiguous ostrstream while running bfc.C in ROOT6
plexoos added a commit that referenced this issue Sep 2, 2021
Fixes #126 Error due to ambiguous ostrstream while running bfc.C in ROOT6
plexoos added a commit that referenced this issue Sep 17, 2021
Triggered by #126 (Error due to ambiguous ostrstream while running bfc.C in
ROOT6)

Since the STAR's `ostrstream` inherits from `std::ostringstream` with only minor
modifications to its API, it should be safe to remote this local implementation
of `ostrstream` and use `ostringstream` from the standard library.
plexoos added a commit that referenced this issue Sep 30, 2021
Triggered by #126 (Error due to ambiguous ostrstream while running bfc.C in
ROOT6)

Since the STAR's `ostrstream` inherits from `std::ostringstream` with only minor
modifications to its API, it should be safe to remote this local implementation
of `ostrstream` and use `ostringstream` from the standard library.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ROOT6 Issues and changes related to transition from ROOT5 to ROOT6
Projects
None yet
3 participants