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

libpcap: expose the with-snf option for recipes #23361

Merged
merged 10 commits into from
Apr 30, 2024

Conversation

darakelian
Copy link
Contributor

Specify library name and version: libpcap/*

Some of the build agents we use have myricom support. This causes libpcap to try and link against the myricom snf libraries (since with-snf=yes is the default) which causes problems when we use our internal libpcap pre-built package on a host that does not have myricom snf support. We had an internal fork of this recipe for conan 1 with this functionality supported but as we are migrating to conan 2, it would be easier if this could be mainlined and we can decom the fork of the recipe.


@CLAassistant
Copy link

CLAassistant commented Apr 3, 2024

CLA assistant check
All committers have signed the CLA.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

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

@darakelian Thank you for your PR. It's an authentic case for adding this option. Let's simplify a bit, the default value is known, so adding auto would complicated more.

@@ -29,11 +29,13 @@ class LibPcapConan(ConanFile):
"shared": [True, False],
"fPIC": [True, False],
"enable_libusb": [True, False],
"with_snf": [None, True, False],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"with_snf": [None, True, False],
"with_snf": [True, False],

Let's keep binary decision, no auto values. We can sure about its default value: https://github.com/the-tcpdump-group/libpcap/blob/master/configure.ac#L1515

}
default_options = {
"shared": False,
"fPIC": True,
"enable_libusb": False,
"with_snf": None,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"with_snf": None,
"with_snf": True,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After reading through the configure file, I think this should default to False (though maybe None still makes sense) since I believe the "yes, if present" means that --with-snf=yes and --with-snf are equivalent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, I was reading through the libpcap stuff more and I do believe None is a valid option here, when --with-snf is not present, the autoconfigure stuff will attempt to see if the snf library is present at /opt/snf and if so link against it. This is different behavior than explicitly passing yes/no

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure how to best model this with conan2, if it is even possible? Maybe defaulting to false/true is sufficient for this use case?

recipes/libpcap/all/conanfile.py Outdated Show resolved Hide resolved
@ghost
Copy link

ghost commented Apr 5, 2024

I detected other pull requests that are modifying libpcap/all recipe:

This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there.

@valgur
Copy link
Contributor

valgur commented Apr 5, 2024

You should also export a dependency on libsnf in package_info(). Otherwise static builds will not work without additional linker flags on the consumer side.

if self.options.get_safe("with_snf"):
    self.cpp_info.system_libs.append("snf")  # the library name might be incorrect

@darakelian
Copy link
Contributor Author

You should also export a dependency on libsnf in package_info(). Otherwise static builds will not work without additional linker flags on the consumer side.

if self.options.get_safe("with_snf"):
    self.cpp_info.system_libs.append("snf")  # the library name might be incorrect

How would I go about confirming the correct name? I don't see a recipe for libsnf either.

@conan-center-bot

This comment has been minimized.

@valgur
Copy link
Contributor

valgur commented Apr 6, 2024

@darakelian snf is the correct library name to add to system_libs: https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.10.4/configure.ac#L1612-L1614

You need to add it as a "system library" because it is not provided by this package or other Conan packages, but it's still required for linking.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Comment on lines 121 to 123
snf = self.options.get_safe("with_snf")
if snf is not None:
tc.configure_args.append(f"--with-snf={yes_no(snf)}")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
snf = self.options.get_safe("with_snf")
if snf is not None:
tc.configure_args.append(f"--with-snf={yes_no(snf)}")
tc.configure_args.append(f"--with-snf={yes_no(self.options.with_snf)}")

Always present don't need to check.

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 11 (ff6d6225dad741d5fe38ecbeb74d677ff3f79708):

  • libpcap/1.10.4:
    All packages built successfully! (All logs)

  • libpcap/1.10.0:
    All packages built successfully! (All logs)

  • libpcap/1.9.1:
    All packages built successfully! (All logs)

  • libpcap/1.10.1:
    All packages built successfully! (All logs)


Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 11 (ff6d6225dad741d5fe38ecbeb74d677ff3f79708):

  • libpcap/1.9.1:
    All packages built successfully! (All logs)

  • libpcap/1.10.1:
    All packages built successfully! (All logs)

  • libpcap/1.10.0:
    All packages built successfully! (All logs)

  • libpcap/1.10.4:
    All packages built successfully! (All logs)

}
default_options = {
"shared": False,
"fPIC": True,
"enable_libusb": False,
"with_snf": False,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"with_snf": False,
"with_snf": False,

https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.10.4/CMakeLists.txt#L521
It's enabled by default, but I'm fine accepting the opposite, because it's private product.

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

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

LGTM. libpcap tries to find, when enabled, but no adds REQUIRED once enabled.

@conan-center-bot conan-center-bot merged commit 5c1cde6 into conan-io:master Apr 30, 2024
28 checks passed
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.

5 participants