Giter Club home page Giter Club logo

Comments (4)

kinke avatar kinke commented on June 25, 2024

So IIUC, you are hitting build issues with libc++, for the compiler/bundled tools itself. #3711 concerns user programs being able to use core.stdcpp.* for libc++, with a prebuilt druntime expecting libstdc++ on Linux; this doesn't affect the compiler build itself (the compiler itself isn't using core.stdcpp).

I've never tried libc++ on Linux; but if both LLVM and the compiler are built against it, I'd expect it to work. As you're getting linker errors for C++-only tools like ldmd2, it looks like there's a mismatch between LLVM and the C++ parts of LDC. What's your exact CMake command-line?

Btw, why libc++? The official LDC binaries link libstdc++ fully statically:

-DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++

And libstdc++ is apparently an option with musl, as Alpine's ldc package uses it (https://pkgs.alpinelinux.org/package/edge/community/x86_64/ldc).

from ldc.

kassane avatar kassane commented on June 25, 2024

What's your exact CMake command-line?

cmake "$ROOTDIR/ldc" \
  -DLLVM_ROOT_DIR="$ROOTDIR/out/llvm-cross-$TARGET-$MCPU" \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_CROSSCOMPILING=True \
  -DCMAKE_C_COMPILER=clang \
  -DCMAKE_CXX_COMPILER=clang++ \
  -DCMAKE_INSTALL_PREFIX="$ROOTDIR/out/$TARGET-$MCPU" \
  -DCMAKE_PREFIX_PATH="$ROOTDIR/out/$TARGET-$MCPU" \
  -DCMAKE_SYSTEM_NAME="$TARGET_OS_CMAKE" \
  -DLLVM_IS_SHARED=OFF \
  -DD_COMPILER_FLAGS="-gcc=clang -Xcc=-static -Xcc=-stdlib=libc++ -linker=lld"

cmake --build . --target install --parallel 5

I have had problems building using ldc for musl-abi target (mainly cross-compiling) since issue #4520. However, I use this libc for embedded devices and software portability.

Usually I get into the bad habit of linking libstdc++ with glibc. I do not know what the limitations of this libc are when cross compiling. Because there are custom llvm builds that don't use libstdc++ to cross compile (similar to the zig toolchain).
The biggest deadlock for me is this error in switching C++ABI. Also, the dependency on llvm-config makes it difficult to redirect custom llvm root (libs & include only).

from ldc.

kinke avatar kinke commented on June 25, 2024

The biggest deadlock for me is this bug in switching C++ABI

What bug? AFAICT, you don't pass any -stdlib=libc++ when compiling the LDC C++ parts. From the various logs that you've added, I only see relevant failures when linking C++ executables (ldmd2 and vendored LLVM tools - no D involved anywhere), so if you thought -DD_COMPILER_FLAGS="-gcc=clang -Xcc=-stdlib=libc++ would somehow be enough to switch compiler and tools to libc++, then that's definitely not the case. You'll most likely need to set CMAKE_CXX_FLAGS or so, as you would for any other C++ project.

from ldc.

kassane avatar kassane commented on June 25, 2024

What bug?

No, error build only!

AFAICT, you don't pass any -stdlib=libc++ when compiling the LDC C++ parts.

Yeah! There's not much choice from what I've seen. Hopefully I can at least build it with musl static.

so if you thought -DD_COMPILER_FLAGS="-gcc=clang -Xcc=-stdlib=libc++"

This flag was needed because the D Compiler failed to follow the default linker. This may be -DLDC_LINK_MANUALLY related.

You'll most likely need to set CMAKE_CXX_FLAGS or so, as you would for any other C++ project.

Ok.

from ldc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.