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

Autoconf fails on CentOS7 #310

Open
spuck opened this issue Nov 16, 2023 · 5 comments
Open

Autoconf fails on CentOS7 #310

spuck opened this issue Nov 16, 2023 · 5 comments

Comments

@spuck
Copy link

spuck commented Nov 16, 2023

Yes, CentOS7 is old.

pkg-config version 0.27 on CentOS7 does not have PKG_CHECK_VAR and so autogen.sh will fail on line 84.

To fix it, I added the macro from varnish/libvmod-example@ad96d3b to line 21 in configure.ac.

See:

I'm happy to submit as a PR if someone thinks supporting versions from 2014 would be useful.

@atheik
Copy link
Member

atheik commented Nov 16, 2023

@spuck,

This was last discussed at #297. Here's what I posted as a solution verbatim:

Note that here the PKG_CHECK_VAR macro is only used for checking the systemd version. The systemd version determines whether the ksmbd.service unit file is installed automatically, i.e. when --with-systemdsystemunitdir is not given. Currently, the minimum systemd version is 245, released 2020-03-06. CentOS 7 has systemd 219 and as such the unit file would not be installed anyway. As such, in your case, it is sufficient to do the following:

sed -i~ '/PKG_CHECK_VAR/d' configure.ac
autoreconf -vif
./configure --with-rundir=/run --without-systemdsystemunitdir

@spuck
Copy link
Author

spuck commented Nov 16, 2023

Thanks @atheik. This workaround seems like it would work, as well. I should have searched more thoroughly through the closed issues.

In #297 you mentioned autoreconf "should have shown an error about this undefined macro". Yes, it does:

configure.ac:84: error: possibly undefined macro: PKG_CHECK_VAR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

That's fine, but it seems to me that if it's possible to avoid an error and succeed why not do that, without requiring an edit of the source files?

Or, maybe the pre-requisites should mention that pkg-config should be version 0.28 or greater.

@atheik
Copy link
Member

atheik commented Nov 16, 2023

@spuck,

That's fine, but it seems to me that if it's possible to avoid an error and succeed why not do that, without requiring an edit of the source files?

That's a good idea. I offered the workaround in case your interest was just getting ksmbd-tools to build without much hassle. Feel free to open a PR. However, since PKG_CHECK_VAR has such limited use here, you might consider doing the following instead of having ksmbd-tools vendor it from upstream:

diff --git a/configure.ac b/configure.ac
index de5158b..aaae49d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,7 +81,11 @@ AC_ARG_WITH([systemdsystemunitdir],
 
 AS_IF([test "x$with_systemdsystemunitdir" != xno], [
 	AS_IF([test "x$with_systemdsystemunitdir" = xyes], [
-		PKG_CHECK_VAR([systemdsystemunitdir], [systemd >= 245], [systemdsystemunitdir], [], [])
+		m4_ifdef([PKG_CHECK_VAR], [
+			PKG_CHECK_VAR([systemdsystemunitdir], [systemd >= 245], [systemdsystemunitdir], [], [])
+		], [
+			systemdsystemunitdir=$(pkg-config --variable=systemdsystemunitdir 'systemd >= 245')
+		])
 	], [
 		systemdsystemunitdir=$with_systemdsystemunitdir
 	])

Edit: Your suggestion to vendor PKG_CHECK_VAR seems to be far more portable.
Edit2: Striked out my suggestion above; getting support for PKG_CONFIG, PKG_CONFIG_PATH, and PKG_CONFIG_LIBDIR would require more changes, so it is better to vendor PKG_CHECK_VAR.

Either way, I am sure your PR will be accepted.

By the way, on your CentOS 7 system, what kernel version do you build the out-of-tree ksmbd against?
Or, do you build an upstream kernel yourself and use the in-tree ksmbd?

spuck pushed a commit to spuck/ksmbd-tools that referenced this issue Nov 16, 2023
…avoid error messages if file does not exist.
@spuck
Copy link
Author

spuck commented Nov 16, 2023

Hi @atheik,

I just opened a PR. I am attempting to build against the CentOS-provided kernel, currently 3.10.0-1160.102.1. No idea if it works or not yet, just getting started...

Edit: I see that the kernel module will not be compatible with a kernel this old. Oh well.

spuck added a commit to spuck/ksmbd-tools that referenced this issue Nov 16, 2023
Fixes cifsd-team#310. Add '-f' to 'rm' command in uninstall hooks to avoid error messages if file does not exist.
@atheik
Copy link
Member

atheik commented Nov 17, 2023

@spuck,

I just opened a PR.

Thank you. I left you some feedback.

I am attempting to build against the CentOS-provided kernel, currently 3.10.0-1160.102.1. No idea if it works or not yet, just getting started...

Edit: I see that the kernel module will not be compatible with a kernel this old. Oh well.

ELRepo seems to be a widely trusted third-party source for packages for RHEL and its clones.
If you trust them, and your situation allows, you might install a newer kernel from their repository:
https://elrepo.org/tiki/HomePage#Get_started
https://elrepo.org/tiki/kernel-ml

Their kernel in the kernel-ml package for CentOS 7 is currently 6.6.1-1.el7.elrepo.x86_64 and has the in-tree ksmbd built as a loadable module.

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

No branches or pull requests

2 participants