Skip to content

Autotools: rework to simplify and fix recent issues#674

Merged
bradh352 merged 48 commits intoc-ares:mainfrom
bradh352:autotools_rework
Dec 28, 2023
Merged

Autotools: rework to simplify and fix recent issues#674
bradh352 merged 48 commits intoc-ares:mainfrom
bradh352:autotools_rework

Conversation

@bradh352
Copy link
Member

@bradh352 bradh352 commented Dec 23, 2023

Completely rework the autotools build system, issues have cropped up due to the complexity and could cause issues on even semi-modern Linux systems (Ubuntu 20.04 for example).

Changes include:

  • Remove all curl/xc/cares m4 helper files, they go overboard on detections of functions and datatypes. Go back to more plain autoconf macros as they've come a long way over the years.
  • Use known systems and heuristics to determine datatypes for functions like send() and recv(), rather than the error prone detection which required thousands of permutations and might still get it wrong.
  • Remove unneeded configure arguments like --enable-debug or --enable-optimize, its more common for people to simply pass their own CFLAGS on the command line.
  • Only require CARES_STATICLIB definition on Windows static builds, its not necessary ever for other systems, even when hiding non-public symbols.
  • Remove some function and definition detections that were never used in c-ares
  • The test framework is now embedded into the toplevel configure system, there was no need to chain build the test system as it is never built externally to c-ares.

As a side-effect of the changes, a configure run completes in about 25% of the original time.

This has been tested on various Linux distributions (of varying age), FreeBSD, MacOS, Windows (via MSYS2 with Mingw), and Solaris10/11 (by @dfandrich), AIX 7.3 (by @dfandrich). It is not unlikely that this may have broken more esoteric or legacy systems, and we'll likely need to be ready to accept bug reports and patches, but it has removed over 10k lines of build system code. It is very likely any issues that crop up will add far fewer lines of code to fix such systems.

Fix By: Brad House (@bradh352)

@bradh352 bradh352 marked this pull request as draft December 23, 2023 17:41
@bradh352
Copy link
Member Author

@dfandrich thanks for that, I've committed that fix

@bradh352
Copy link
Member Author

@dfandrich regarding the setsocknonblock issue, can you provide the output from the configure script? I want to see what headers, functions and definitions were detected.

@dfandrich
Copy link
Collaborator

@bradh352
Copy link
Member Author

@dfandrich I think my latest commit should fix this, I think fcntl.h was missing.

@dfandrich
Copy link
Collaborator

The updated PR compiles fine now on Solaris 11 and Solaris 10. The latter required --disable-dependency-tracking due to the complaint:

config.status: error: Something went wrong bootstrapping makefile fragments
    for automatic dependency tracking.  Try re-running configure with the
    '--disable-dependency-tracking' option to at least be able to build
    the package (albeit without support for automatic dependency tracking).

FWIW I used https://portal.cfarm.net/ machines to test on a number of less-common OSes, which is open for anyone to use.

@bradh352
Copy link
Member Author

Ah, I hadn't heard of cfarm, I'll definitely apply for an account. Any idea if they allow you to hook into say Github actions or Cirrus-ci, or if that's forbidden by ToS?

The --disable-dependency-tracking is odd, which compiler are you using, gcc or sunpro? Also, do you have gnu make as your default make program? I think autotools might not be happy with sun's native make on solaris 10.

@dfandrich
Copy link
Collaborator

dfandrich commented Dec 27, 2023 via email

@bradh352
Copy link
Member Author

@dfandrich awesome thanks for testing that! I don't suppose you have access to the cfarm AIX system and can test that too? :)

@dfandrich
Copy link
Collaborator

dfandrich commented Dec 27, 2023 via email

@bradh352
Copy link
Member Author

@dfandrich did you happen to build and run the test suite on solaris and aix ? Or just tested compilation of the library itself?

@bradh352 bradh352 merged commit 4f490b4 into c-ares:main Dec 28, 2023
@bradh352 bradh352 deleted the autotools_rework branch December 28, 2023 19:38
@dfandrich
Copy link
Collaborator

dfandrich commented Dec 28, 2023 via email

@pkropachev
Copy link

I faced with the same problem (gmock) during run configure on tag cares-1_24_0 on Ubuntu 20.04.

commit 972f456f2808b4e4b1730c90ab506f6af5f4c725 (HEAD, tag: cares-1_24_0)
checking for gmock... no
configure: error: Package requirements (gmock) were not met:

No package 'gmock' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GMOCK_CFLAGS
and GMOCK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
configure: error: ./configure failed for test

Should we wait for new release tag? I'd like to use officially release code.

@bradh352
Copy link
Member Author

bradh352 commented Dec 30, 2023

@pkropachev That particular error is expected as of 1.24.0 on all platforms if you don't have google test/gtest/gmock installed. Google changed their recommendation from bundling GoogleTest to instead use an external google test for any applications which use it for their test framework, so we unbundled it with the 1.24.0 release which a lot of package maintainers requested we do.

Either you need to --disable-tests, or install googletest (apt-get install libgmock-dev).

I'm not sure at this point when the next release will be out, if what's currently not released on main is sufficient or if we are going to wait for any additional feature drops.

@pkropachev
Copy link

@bradh352, Thanks for explanation! I will try both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants