bees icon indicating copy to clipboard operation
bees copied to clipboard

In the future, can you migrate gcc to clang and then replace the static Makefile with cmake.

Open daiaji opened this issue 4 years ago • 10 comments

The static Makefile made me have to switch the compiler version using symbolic links.

daiaji avatar Oct 30 '19 13:10 daiaji

I don't see how it is static... Everything is passed in as variables. You could probably just use make CXX=clang to use clang as compiler (I'm not using clang so I don't now if that command is correct, in theory, tho, you can pass in LD, CC, CXX etc).

kakra avatar Oct 30 '19 14:10 kakra

@kakra Sorry, I always thought that the makefile is static.

But bees can't seem to compile with clang.

make CXX=clang
make PREFIX=/usr LIBEXEC_PREFIX=/usr/lib/bees ETC_PREFIX=/etc TAG="3ecf69a" -C lib
make[1]: Entering directory '/home/daiaji/bees/lib'
clang -Wall -Wextra -Werror -O3 -I../include -D_FILE_OFFSET_BITS=64 -std=c++11 -Wold-style-cast  -o chatter.o -c chatter.cc
In file included from chatter.cc:1:
../include/crucible/chatter.h:96:7: error: private field 'm_line' is not used [-Werror,-Wunused-private-field]
                int m_line;
                    ^
1 error generated.
make[1]: *** [Makefile:48: chatter.o] Error 1
make[1]: Leaving directory '/home/daiaji/bees/lib'
make: *** [Makefile:34: lib] Error 2

daiaji avatar Oct 30 '19 14:10 daiaji

I have little or no objection to porting the makefiles or compiler to some favorite tool or other in order to make downstream integration easier; however, this has been proposed before (e.g. #111) and I've seen zero PRs so far.

Changing the Makefiles doesn't help with bees performance or functionality--though it can hurt, e.g. dropping the -O3 flag, see c69a954d8f100a31a98bf627ef3235d7c9500be8. This puts Makefile changes all the way off the bottom of my own list of priorities.

clang could be interesting for the things it can catch that GCC can't...or it could be a massive time sink for weeding out inadvertent use of GCC extensions or STL implementation quirks.

Zygo avatar Oct 30 '19 15:10 Zygo

@Zygo, I'm probably going to work on a meson/ninja build system for bees, soon. But I'd prefer to do this after a v0.7 tag. I was also thinking about integrating the clang linter then.

That way (after a v0.7 tag) we can have a recent build of bees without forcing people to arrange with a new build system when running from git.

kakra avatar Oct 30 '19 17:10 kakra

FWIW it now builds on clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final).

Zygo avatar Dec 17 '20 23:12 Zygo

I'd rather migrate this to meson/ninja, it looks easier and more modern than cmake. @Zygo If you're fine with that, I'd be working on a PR.

kakra avatar Dec 18 '20 06:12 kakra

I'm fine with meson/ninja, mostly because I know nothing bad about them.

I've used cmake (and autoconf) on other projects...apparently, given the choice, I preferred to write plain Makefiles for bees instead.

Zygo avatar Dec 18 '20 21:12 Zygo

Yeah, I think cmake is quite a complex beast - but at least with nice output, parallel building and progress reports. Meson and ninja can do the same with less complexity / cryptic syntax.

kakra avatar Dec 18 '20 21:12 kakra

Well, we have parallel building now...

I'm hoping for build-time feature tests so we'd be able to do things like figure out whether the version of btrfs.h has members in structs. Currently it's very kludgey and fragile to do it all with just the C preprocessor.

Zygo avatar Dec 19 '20 00:12 Zygo

Yeah but parallel building is a feature I hacked into the makefiles by building dependency files. Meson has this by default. Build-type feature tests should be possible with meson.

kakra avatar Dec 19 '20 10:12 kakra