tools-make icon indicating copy to clipboard operation
tools-make copied to clipboard

Add support for OpenBSD to build with clang,

Open buzzdeee opened this issue 1 year ago • 3 comments

basically link against -lc++abi when using clang. I don't know if checking the value of CLANG_CC variable is the most optimal route, but it was the best/most natural I could find. Open for suggestions otherwise.

I had it in a ugly way hardcoded in the GNUstep ports tree for years, since that doesn't support building with gcc ;)

Tested on amd64, with gcc 11 from packages, and linking against gcc libobjc, as well as using base clang, and building against libobjc2 from packages.

buzzdeee avatar Nov 11 '24 21:11 buzzdeee

@buzzdeee We've got a similar config embedded in the MSYS2 packages for GNUstep: https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-gnustep-make/PKGBUILD#L34 .

I suspect the -lc++ dependency comes from using libobjc2, which uses C++ exception handling mechanisms? I just wonder whether the -lc++ dependency should depend on linking with libobjc2, rather than using clang as the compiler?

qmfrederik avatar Nov 12 '24 09:11 qmfrederik

Yeah, the -lc++abi is because of CLANG internals, when using clang, and not linking against then got a unknown symbol, something exception handling related. I don't know if gnustep-make has enough knowledge to distinguish between libobjc2 and libobjc, and how it's build.

It might indeed be related how the libobjc or libobjc2 was built before that we're going to link to. However, assuming that when using clang, it might be a supported clang archictecture also for libobjc2, and that libobjc2 was built with all its funky features.

Don't know if there's a variable in gnustep-make I could check otherwise, the CLANG one was the best I could find.

buzzdeee avatar Nov 12 '24 14:11 buzzdeee

The way it's supposed to work is that clang and libobjc2 go together, and this is indicated by the use of 'ng' rather than 'gnu' in the library combo, so I guess that the addition of this flag opught to be made conditional on that.

rfm avatar Mar 10 '25 20:03 rfm