bloomberg / bde

Basic Development Environment - a set of foundational C++ libraries used at Bloomberg.
Apache License 2.0
1.68k stars 318 forks source link

Compilation error on latest master #279

Closed tcanabrava closed 1 year ago

tcanabrava commented 2 years ago
/home/tcanabrava/Projects/bde/groups/bal/balb/balb_controlmanager.cpp: In member function ‘void BloombergLP::balb::ControlManager::printUsage(std::ostream&, const std::string_view&) const’:
/home/tcanabrava/Projects/bde/groups/bal/balb/balb_controlmanager.cpp:142:32: error: ‘endl’ is not a member of ‘bsl’; did you mean ‘end’?
  142 |     stream << preamble << bsl::endl;
      |                                ^~~~
      |                                end
osubboo commented 2 years ago

Cannot reproduce. compiler and ufid to see the build failure?

osubboo commented 2 years ago

hard to believe the error as bsl_iostream.h was there for last 7 years.

tcanabrava commented 2 years ago

I don't know what to say to you...

➜  bde git:(master) /home/tcanabrava/Projects/bde-tools/bin/bde_build_env.py list  
Available compilers:
 0: gcc-12.1.0 (default)
     CXX: /usr/bin/g++
     CC : /usr/bin/gcc
     Toolchain: gcc-default
 1: clang-13.0.1 
     CXX: /usr/bin/clang++
     CC : /usr/bin/clang
     Toolchain: clang-default

➜  bde git:(master) ✗ eval `bde_build_env.py --build-type=Release 
--cpp-std=17`
➜  bde git:(master) ✗ cmake_build.py configure
➜  bde git:(master) ✗ cmake_build.py build
...

/home/tcanabrava/Projects/bde/groups/bal/balb/balb_controlmanager.cpp: 
In member function 'void 
BloombergLP::balb::ControlManager::printUsage(std::ostream&, const 
std::string_view&) const':
/home/tcanabrava/Projects/bde/groups/bal/balb/balb_controlmanager.cpp:142:32: 
error: 'endl' is not a member of 'bsl'; did you mean 'end'?
   142 |     stream << preamble << bsl::endl;
       |                                ^~~~
       |                                end
/home/tcanabrava/Projects/bde/groups/bal/balb/balb_controlmanager.cpp:149:23: 
error: 'endl' is not a member of 'bsl'; did you mean 'end'?
   149 |               << bsl::endl;
       |                       ^~~~
       |                       end

It could be a compiler bug, I manually removed bsd::endl to std::endl to make things work.

RMGiroux commented 2 years ago

Github's emailed version of your last comment only included the first line, @tcanabrava, which sounds like a bad bug on github's part. The message sounds much better when you read the rest of it :)

What platform are you on? I see it would have picked gcc-12.1.0 there, but what OS and version and/or Linux distro and version are you using?

Thanks!

mversche commented 2 years ago

I would wager this is the issue: https://github.com/bloomberg/bde/blob/master/groups/bsl/bsl%2Bbslhdrs/bsl_iostream.h#L43

I.e., this file is relying on an include of bsl_iostream.h to make bsl::endl available, and that is dependent in some way on language version. I'm not sure what in the environment is causing the difference between our internal c++17 builds -- but we also haven't tested with gcc-12.

mversche commented 2 years ago

Actually, that should still be available through the transitive include of bsl_ostream.h, so I'm back to being confused....

Think we'll need more information to try and reproduce.

tcanabrava commented 2 years ago

My current system:

Arch Linux 
➜  build git:(master) uname -a
Linux tcanabrava-laptop 5.17.8-arch1-1 #1 SMP PREEMPT Mon, 16 May 2022 20:45:27 +0000 x86_64 GNU/Linux
➜  build git:(master) ccache --version
ccache version 4.6

I have not invested too much time trying to solve this issue properly, but I have managed to get the build working in another system with the same compiler. So it could be a small difference in my system because of the different compilers installed (gcc, clang - from - package, self-compiled clang).

now, for my system I have included bsl_ostream.h directly and that seemed to solve the issue.

All the best.