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

Add check whether pkg-config was installed #13

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

Watson1978
Copy link
Contributor

@Watson1978 Watson1978 commented Mar 5, 2025

We can build and install capng_c even if pkg-config is not installed.
However, it does not work because it does not link to libcap-ng properly.

Actually, the install log indicates that libcap-ng can't be found.
Ref. checking for pkg-config for libcap-ng... not found line with following install log.

So, this patch will abort install process if pkg-config is not installed.

# rake
mkdir -p tmp/x86_64-linux/capng/3.4.2
cd tmp/x86_64-linux/capng/3.4.2
/root/.rbenv/versions/3.4.2/bin/ruby -I. ../../../../ext/capng/extconf.rb
checking for pkg-config for libcap-ng... not found
checking for CAPNG_SELECT_AMBIENT in cap-ng.h... no
checking for CAPNG_SELECT_ALL in cap-ng.h... no
checking for CAPNG_AMBIENT in cap-ng.h... no
checking for CAPNG_INIT_SUPP_GRP in cap-ng.h... yes
checking for rb_sym2str() in ruby.h... yes
checking for rb_io_descriptor() in ruby.h... yes
checking for capng_get_caps_fd() in cap-ng.h... no
creating Makefile
cd -
cd tmp/x86_64-linux/capng/3.4.2
/usr/bin/gmake
compiling ../../../../ext/capng/capability.c
compiling ../../../../ext/capng/capability_info.c
compiling ../../../../ext/capng/capng.c
compiling ../../../../ext/capng/enum-action.c
compiling ../../../../ext/capng/enum-flags.c
compiling ../../../../ext/capng/enum-result.c
compiling ../../../../ext/capng/enum-select.c
compiling ../../../../ext/capng/enum-type.c
compiling ../../../../ext/capng/enum.c
compiling ../../../../ext/capng/print.c
compiling ../../../../ext/capng/state.c
compiling ../../../../ext/capng/utils.c
linking shared-object capng/capng.so
cd -
mkdir -p tmp/x86_64-linux/stage/lib/capng
/usr/bin/gmake install sitearchdir=../../../../lib/capng sitelibdir=../../../../lib/capng target_prefix=
/usr/bin/install -c -m 0755 capng.so ../../../../lib/capng
cp tmp/x86_64-linux/capng/3.4.2/capng.so tmp/x86_64-linux/stage/lib/capng/capng.so
Loaded suite /root/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/rake-13.2.1/lib/rake/rake_test_loader
Started
/root/.rbenv/versions/3.4.2/bin/ruby: symbol lookup error: /root/capng_c/lib/capng/capng.so: undefined symbol: capng_clear
rake aborted!
Command failed with status (127)

@Watson1978
Copy link
Contributor Author

If pkg-config was not installed, this patch will abort with following message:

# rake
mkdir -p tmp/x86_64-linux/capng/3.4.2
cd tmp/x86_64-linux/capng/3.4.2
/root/.rbenv/versions/3.4.2/bin/ruby -I. ../../../../ext/capng/extconf.rb
checking for pkg-config... no
*** ../../../../ext/capng/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include=${opt-dir}/include
	--without-opt-include
	--with-opt-lib=${opt-dir}/lib
	--without-opt-lib
	--with-make-prog
	--without-make-prog
	--srcdir=../../../../ext/capng
	--curdir
	--ruby=/root/.rbenv/versions/3.4.2/bin/$(RUBY_BASE_NAME)
	--with-capng-dir
	--without-capng-dir
	--with-capng-include=${capng-dir}/include
	--without-capng-include
	--with-capng-lib=${capng-dir}/lib
	--without-capng-lib
../../../../ext/capng/extconf.rb:24:in '<main>': Require pkg-config due to install capng_c gem. Please install pkg-config. (RuntimeError)
rake aborted!
Command failed with status (1): [/root/.rbenv/versions/3.4.2/bin/ruby -I. ../../../../ext/capng/extconf.rb]

Tasks: TOP => default => compile => compile:x86_64-linux => compile:capng:x86_64-linux => copy:capng:x86_64-linux:3.4.2 => tmp/x86_64-linux/capng/3.4.2/capng.so => tmp/x86_64-linux/capng/3.4.2/Makefile
(See full trace by running task with --trace)

@daipom daipom self-requested a review March 5, 2025 07:54
Copy link

@daipom daipom left a comment

Choose a reason for hiding this comment

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

Thanks!

@daipom daipom merged commit 02f853a into fluent-plugins-nursery:main Mar 5, 2025
15 checks passed
@Watson1978 Watson1978 deleted the pkg-config branch March 5, 2025 09:10
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.

2 participants