Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bare configure build #4412

Merged
merged 4 commits into from
Mar 1, 2023

Conversation

elliefm
Copy link
Contributor

@elliefm elliefm commented Feb 20, 2023

This re-enables Cyrus builds configured with just ./configure, mostly by detangling some header mess and adding some judicious #ifdefs where necessary.

Also annotates a bunch of Cassandane tests with their dependencies so that they won't try to run if the feature they need wasn't compiled in. I did this in the simplest way possible because my goal right now is something backportable to 3.8, but I don't really like it. (For example, lots of tests needed to be individually annotated ":needs_component_httpd", even though that test doesn't need it, just because the suite itself starts the httpd service. In the future it would be nice to handle this better, but that's a non-trivial refactor.)

Fixes #4409

Reviewers: please build and test this with both:

  • your usual configure arguments, to make sure I haven't broken anything any of us rely on
  • a minimal configure (I used ./configure --enable-silent-rules --prefix=/my/cass/prefix), to make sure the fixes are adequate with your compiler/environment and not just mine

If you run Cassandane on the minimal build, you'll (probably) find a bunch of Foo.relocate_* and RelocateByID.* tests have errors. I don't know why, but I've put details in #4409. Since this PR is a prerequisite for even building like that at all, it seems sensible to get the build problem fixed first, and then investigate the relocate failures.

@elliefm elliefm added the backport-to-3.8 for PRs that are to be backported to 3.8 label Feb 20, 2023
@elliefm elliefm force-pushed the v39/4409-fix-bare-configure-build branch 3 times, most recently from e7e5a11 to 5555e65 Compare February 21, 2023 23:59
@elliefm elliefm requested review from ksmurchison and rsto and removed request for ksmurchison February 22, 2023 00:09
@elliefm elliefm marked this pull request as ready for review February 22, 2023 00:09
@ksmurchison
Copy link
Contributor

ksmurchison commented Feb 24, 2023

@elliefm My normal build still works fine.

I tried a bare build, but mbpath.c failed to compile due to an unused function complaint. I fixed this on master.

The next problem is that master.c uses pow() and therefore needs to link with libm. We should probably just add this to LIBS unconditionally and be done with it.

The RelocateById failures can be fixed by removing the #ifdef WITH_DAV from mboxname.c:mboxname_metapath()

The Sieve.date_iana_tzid failure (when rebased on master) can probably be fixed by adding :needs_component_httpd since since this test requires libical

Copy link
Contributor

@ksmurchison ksmurchison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good after the pow() compile issue is fixed.

@elliefm
Copy link
Contributor Author

elliefm commented Feb 26, 2023

For my future reference: the mbpath fix Ken mentioned was 9034a59 -- I'll need to grab this when I backport to 3.8

@elliefm
Copy link
Contributor Author

elliefm commented Feb 26, 2023

@ksmurchison

The next problem is that master.c uses pow() and therefore needs to link with libm. We should probably just add this to LIBS unconditionally and be done with it.

It already links with libm if required, thanks to 4830785, using LT_LIB_M...

But LT_LIB_M fails when compiling with CFLAGS=-Werror, and as a result doesn't detect/set LIBM='-lm'.

The HTTPD section handles this differently, with a comment describing a similar problem. So I guess your minimal build still has CFLAGS=-Werror, and that's why it fails to detect LIBM, and fails to build master. Whereas my minimal build doesn't have CFLAGS set, because that's usually set by my wrapper script, which I'm not running.

But that means in both of our usual builds, we don't get LIBM, and yet master builds fine in that case. That's weird.

I have an idea for making this work (save CFLAGS, set CFLAGS=$CFLAGS -Wno-error, run LT_LIB_M, restore CFLAGS) which I'll tinker with in a bit. If that works, we can clean up the HTTPD section too

@elliefm elliefm force-pushed the v39/4409-fix-bare-configure-build branch from 5555e65 to ed888fd Compare February 27, 2023 00:28
@elliefm
Copy link
Contributor Author

elliefm commented Feb 27, 2023

@ksmurchison: I've rebased on master, added your suggested fixes for the RelocateById and Sieve test failures, and tidied up our libm handling in the way I proposed in my previous comment. Seems to work properly for me now, in both full builds and minimal, and with and without -Werror. Can you try it out again please, and confirm whether it's fixed on your system now too? Especially the pow() bit. Thanks

@ksmurchison
Copy link
Contributor

@elliefm The LIBM hack didn't work for me with -Werror in either config. If I remove -Werror, its good in both.

Copy link
Contributor

@ksmurchison ksmurchison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LIBM still not linked in for me with -Werror.

@elliefm In my script, I set CPPFLAGS rather than CFLAGS. If I do the same save/set/restore magic with CPPFLAGS, everything works fine. I suggest we do the magic with both variables.

Copy link
Contributor

@ksmurchison ksmurchison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve once we add save/set/restore magic for CPPFLAGS around LT_LIB_M

@elliefm
Copy link
Contributor Author

elliefm commented Mar 1, 2023

Ahh yeah, right!

@elliefm elliefm force-pushed the v39/4409-fix-bare-configure-build branch from ed888fd to 7e0fc0a Compare March 1, 2023 02:14
@elliefm elliefm merged commit fc8494f into cyrusimap:master Mar 1, 2023
@elliefm elliefm deleted the v39/4409-fix-bare-configure-build branch March 1, 2023 02:53
@elliefm elliefm removed the backport-to-3.8 for PRs that are to be backported to 3.8 label Mar 1, 2023
@elliefm elliefm added the backport-to-3.6 for PRs that are to be backported to 3.6 label Mar 21, 2024
@elliefm
Copy link
Contributor Author

elliefm commented Mar 21, 2024

@elliefm 3.6 needs at least 7b8c76f, which will fix #4848. Also check the other commits on this PR

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-3.6 for PRs that are to be backported to 3.6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bare ./configure doesn't build
2 participants