azurelinux icon indicating copy to clipboard operation
azurelinux copied to clipboard

Mariner 2.0 clang didn't work

Open hcoona opened this issue 3 years ago • 6 comments

Summary

I cannot build any c++ sources with clang++ in Mariner 2.0 Docker image.

I think it's because we upgrade clang to v12.0.1 but still leave libstdc++-devel v11.2.0.

How to reproduce

# image id: 9981cdf1c8ec
docker run --net=host --rm -it mcr.microsoft.com/cbl-mariner/base/core:2.0 /bin/bash
tdnf install -y clang
cat > a.cc << EOF
#include <iostream>
int main() {
  std::cout << "Hello!" << std::endl;
  return 0;
}
EOF
clang++ -std=c++17 -stdlib=libc++ -c a.cc

image

image

image

hcoona avatar Oct 08 '22 14:10 hcoona

I think it's introduced by https://github.com/microsoft/CBL-Mariner/pull/1428, @christopherco could you help to take a look?

hcoona avatar Oct 08 '22 14:10 hcoona

@hcoona I managed to get it working by installing build-essential

tdnf install build-essential image

Also, IMHO, libstdc++ 11.2.0-2 is shipped by gcc. Wondering if is related or not.

mfrw avatar Oct 10 '22 05:10 mfrw

@mfrw you are right, libstdc++ is not libc++, my fault.

But it still not works for me.

# image id: 9981cdf1c8ec
docker run --net=host --rm -it mcr.microsoft.com/cbl-mariner/base/core:2.0 /bin/bash
tdnf install -y build-essential clang
cat > a.cc << EOF
#include <iostream>
int main() {
  std::cout << "Hello!" << std::endl;
  return 0;
}
EOF
clang++ -std=c++17 -stdlib=libc++ -c a.cc

image

hcoona avatar Oct 10 '22 08:10 hcoona

libc++ is a new implementation of the C++ standard library, which to the best of my knowledge, we do not ship. In my opinion, installing clang should not mean we get libc++ also.

/cc @christopherco - Please add/correct me if I am mistaken.

mfrw avatar Oct 10 '22 13:10 mfrw

@mfrw is correct here - today we do not ship libc++ which is the new implementation of the C++ standard library from LLVM.org. In the future, when we do add support libc++, we will likely ship it in a separate package like libc++-<version>.rpm.

christopherco avatar Oct 10 '22 17:10 christopherco

OK, thanks for the information. Hope we can add it into schedule. The libc++ has been there at least for 12 years, it's not new. See https://github.com/llvm-mirror/libcxx/commit/bc8d3f97eb5c958007f2713238472e0c1c8fe02c

hcoona avatar Oct 11 '22 00:10 hcoona