Compiling devel/dub with gcc instead of clang

devel/dub does not compile good with clang on my pc.
I want to force the usage of the gcc compiler for the specific dub port.
What should I enter in make.conf in order to do so ?
 
Nothing. In theory, CC and/or CXX, but properly building with gcc requires more than that, because the resulting binaries link gcc runtime libs, and to find the correct version on a system with multiple gcc versions installed, rpath must be set correctly.

There's a helper to add to the port Makefile itself, USE_GCC. But just don't do that! Instead, solve the actual building problem. It seems to be related to your system, otherwise the official builders wouldn't be able to successfully build a package.
 
You'll also have to make sure that dependencies on both sides are compiled with GCC as well. Except for some cases it won't be enough to just compile one package with a different compiler due to ABI incompatibilities.
The only way (?) to avoid this is to ensure that all binary interfaces are fully "standard C" interfaces. i.e. the port(s) upstream needs to be written in a way to ensure that the resulting ABI is the same across different compilers. If any of the dependencies on either side doesn't do that you're gonna re-compile a lot of stuff with GCC. And all of this is on top of what zirias@ already mentioned.

And after all of this, you'll run into more problems down the road. More or less inevitably. So unless you know what you're doing: Fix the actual problem, don't create new ones.
 
Oh, it does seem to use LLVM, at least indirectly:
Code:
The LDC project aims to provide a portable D programming language compiler
with modern optimization and code generation capabilities.

The compiler uses the official DMD frontends to support the latest version of
D2, and relies on the LLVM Core libraries for code generation.
I don't think you can replace this with GCC. But I didn't know there was such a thing as a "D programming language" until a couple of minutes ago, so I could be mistaken ?
 
I compiled 3400 ports from source without any problem. Only dub fails in it's weirdness.
I have here a cross reference of the same problem i posted on the D-lang forum ,
 
I might have found a possible reason,

I have in make.conf
Code:
#10
DEFAULT_VERSIONS+= llvm=14
... Maybe it wants an older version eg 10.
On my PC "clang --version" returns 13.0.0.
 
Maybe it wants an older version.
It should pick the LLVM from the base. Which is 13.0.0 on 13.1
Code:
% clang -v
FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)
Target: x86_64-unknown-freebsd13.1
Thread model: posix
InstalledDir: /usr/bin

13-STABLE has 14.0.5:
Code:
% clang -v
FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)
Target: x86_64-unknown-freebsd13.1
Thread model: posix
InstalledDir: /usr/bin
 
I have really no idea what's going on there
Yes, that's very strange. It depends on LLVM 7.0 and 10.0 for some reason. But CC and friends seem to get set to LLVM 10, so why does it need 7.0?
 
For giggles, I removed those LLVM 7.0 dependencies and have a test build running now. But it has to build LLVM 10 first, so it's going to take a while.
 
I've tracked down the problem to the solution where i specify as linker to use gcc12 instead of a clang/llvm.
export CC=clang14
ldc2 --link-defaultlib-shared --gcc=gcc12 ...
 
For giggles, I removed those LLVM 7.0 dependencies and have a test build running now. But it has to build LLVM 10 first, so it's going to take a while.
I cloned github dub and patched build.sh, now i run dub version:
dub --version
DUB version 1.29.2-beta.1, built on Sep 2 2022
Note: Quarterly has dub version : 1.18.3 (which might? be old)
 
I have a host a jail and within the jail i perform poudriere-jails.
How can i check the versions of these 3 ?
If the jail is newer then the host or the poudriere jail is newer then the jail it's running in I can expect problems...
 
Back
Top