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 open62541/1.1 #1856

Closed
wants to merge 8 commits into from
Closed

Add open62541/1.1 #1856

wants to merge 8 commits into from

Conversation

syoliver
Copy link
Contributor

@syoliver syoliver commented Jun 6, 2020

Specify library name and version: open62541/1.1

  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the
    conan-center hook activated.

@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.0.1' failed in build 1 (13f8991e49d7478a034b025e89bac598c103aacb):

@madebr
Copy link
Contributor

madebr commented Jun 6, 2020

There is a dependency on python in the CMakeLists though find_package(PythonInterp). Is it possible to get the conans python interpreter, or have a build_requirement on python ?

I don't know of any official convention.

What I did until now is assume python is available on a build system.
Nevertheless, you cannot assume that sys.executable is the name of a python interpreter because conan is available as an installer on Windows using pyinstaller.

What you can do is add a cpython build requirement if tools.which("python") or tools.which("python3") returns False.

@Croydon
Copy link
Contributor

Croydon commented Jun 7, 2020

At Bincrafters we also have a recipe for this which might be helpful

https://github.com/bincrafters/conan-open62541

@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.0.1' failed in build 2 (3fe991b1ac21e8e2b64962926882cc3680f6168f):

  • Windows x86_64, Debug, Visual Studio 15, MDd. Options: open62541:shared-True
    • Hooks errors detected:
      • [HOOK - conan-center.py] post_package(): ERROR: [DEFAULT PACKAGE LAYOUT (KB-H013)] Unknown file 'open62541.dll' in the package (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H013)
    • Log download
    • Log error Download
    • Profile
  • Access to all the logs
  • Windows x86_64, Release, Visual Studio 15, MD. Options: open62541:shared-True
    • Hooks errors detected:
      • [HOOK - conan-center.py] post_package(): ERROR: [DEFAULT PACKAGE LAYOUT (KB-H013)] Unknown file 'open62541.dll' in the package (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H013)
    • Log download
    • Log error Download
    • Profile
  • Access to all the logs

@syoliver
Copy link
Contributor Author

syoliver commented Jun 7, 2020

At Bincrafters we also have a recipe for this which might be helpful

https://github.com/bincrafters/conan-open62541

Thanks @Croydon, I updated this PR with bincrafters recipe !

@syoliver
Copy link
Contributor Author

syoliver commented Jun 7, 2020

What I did until now is assume python is available on a build system.

Having python in %PATH% is not exactly the same, because FindPython.cmake check in windows registry to get installed path. Anyway I don't know exactly why but I am currently in a state where I have a broken python installation on windows. I think this is interseting because it proves that this recipe can't be build without python.
I wait for your PR to improve that 😇

@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.0.1' failed in build 3 (9e0eac510ed3afaabea468da7762b754370feca8):

@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.0.1' failed in build 4 (0efb10b96ca6dcaef9adc8258818f8ea1bb0e8e8):

@conan-center-bot
Copy link
Collaborator

An unexpected error happened and has been reported. Help is on its way! 🏇

@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.0.1' failed in build 6 (34ba9f1fd2972da5a747ad37ed2fbdcc7e091640):

@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.0.1' failed in build 7 (7ee508ef90ef2388fd0930450cfe40b57729e642):

syoliver and others added 2 commits June 7, 2020 22:09
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.0.1' failed in build 9 (7eea7e689cd1241e0afec2d52488a702e8c3c26f):

@syoliver syoliver marked this pull request as ready for review June 7, 2020 20:54
@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.0.1' failed in build 10 (b07484eef0644d2c1b8f6d7ed9c1a8f08cccf433):

@madebr
Copy link
Contributor

madebr commented Jun 8, 2020

@syoliver It seems the package is built with the address sanitizer enabled.

@conan-center-bot
Copy link
Collaborator

An unexpected error happened and has been reported. Help is on its way! 🏇

1 similar comment
@conan-center-bot
Copy link
Collaborator

An unexpected error happened and has been reported. Help is on its way! 🏇

@madebr
Copy link
Contributor

madebr commented Jun 8, 2020

I think it is better to patch the sources to disable the sanitizer because this incurs a runtime overhead.

@syoliver
Copy link
Contributor Author

syoliver commented Jun 8, 2020

I think it is better to patch the sources to disable the sanitizer because this incurs a runtime overhead.

If it is acceptable, I would prefer because there seems to be a bug with some version of the sanitizer... And I can't test locally...

@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.0.1' failed in build 13 (4d6584d022301204f9dd19dc401227afe728cec7):

@conan-center-bot
Copy link
Collaborator

All green in build 14 (73abf9286da24d1e40bebbf591652872424a3114)! 😊

@syoliver syoliver marked this pull request as draft June 9, 2020 15:27
@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.0.1' failed in build 15 (23b52771abc7b53d4b93be01a55ff791193b964a):

  • Linux x86_64, Release, gcc 5, libstdc++ . Options: open62541:shared-True
    • Hooks errors detected:
      • [HOOK - conan-center.py] pre_export(): ERROR: [CONANDATA.YML FORMAT (KB-H030)] First level entries ['submodules'] not allowed. Use only first level entries ['sources', 'patches'] in conandata.yml (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H030)
    • Log download
    • Log error Download
    • Profile
  • Access to all the logs

@conan-center-bot
Copy link
Collaborator

Some configurations of 'open62541/1.1' failed in build 16 (feba5b091ed0a3240835c90ac4c65e28392d96ea):

@syoliver syoliver changed the title Add open62541/1.0.1 Add open62541/1.1 Jun 13, 2020
@conan-center-bot
Copy link
Collaborator

All green in build 17 (3555a3a801c05d9d9b4ece27a8f6cd6868ab0a1c)! 😊

@@ -0,0 +1,6 @@
submodules:
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 have a mechanism for downloading submodules in this recipe, would it make sense to add an option to tools.get or add a new function in conan for it ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would make sense when you use the scm feature of conan, which is forbidden on cci.
The aim of cci is to provide packages which can be consumed using conan alone.

So in this case, mdnsd should be conanized and added as a conan dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the general case it would make sense, but it points to specific version of mdnsd, no idea if it matches a stable version (according to mdnsd itself) at all.

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 didn't notice before, but it is even worse : it point to a fork of the original mdnsd.

Copy link
Contributor

Choose a reason for hiding this comment

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

When in doubt: ask, or look what the linux distributions are doing
It looks like the fork has added cmake support.
Maybe the goal of the fork is only to provide cmake support.

Copy link
Contributor Author

@syoliver syoliver Jun 15, 2020

Choose a reason for hiding this comment

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

Differences to the base repo (https://github.com/troglobit/mdnsd):

  • Use CMake for the build
  • Strict compilation flags for better portability
  • Support of Linux, MinGW, OS X and Windows
  • Continuous Integration

Copy link
Contributor

Choose a reason for hiding this comment

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

The base repo is way more active.
And looking at recent commits, actual bugs are fixed.

It is possible to build using autotools with MSVC when using appropriate wrapper scripts.
Maybe the changes of the Pro fork can help what changes should be made.
If possible, they can be upstreamed so the autotools build system improves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK understood, but I find it better to do in two steps here. Have the opcua package and improve msdns after because I feel like there is much work.

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem with that is that your recipe will get merged only and only if it passes all hook checks.
And this means that adding recipes to cci is a bottom-up process.

What is that opcua package? It's the first mention.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually it passes the hooks checks now.

OPCUA is an industrial protocol. It is related to the IoT world. This library is the most popular open source implementation.

recipes/open62541/all/conanfile.py Outdated Show resolved Hide resolved
recipes/open62541/all/conanfile.py Outdated Show resolved Hide resolved
@conan-center-bot
Copy link
Collaborator

All green in build 19 (fb3885f6d6130d6ef66a8372eff5df7de6d9fe05)! 😊

@SSE4 SSE4 requested a review from danimtb June 16, 2020 16:36
@danimtb danimtb requested a review from jgsogo June 17, 2020 08:54
Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

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

Hi!

I'd really like to see mdnsd merged first and then build this package using the requirement. Is it too hard to build? Has anyone tried to open the PR from Pro/mdnsd in order to add CMake support? Maybe the author will merge it right away.

OTH, I'm also worried about ua-nodeset, it has been moved to a private repo. What's the reason for that movement? Will the repository OPCFoundation/UA-Nodeset be there forever? And also, we should use a released version, not a commit.

or self.options.enable_pubsub_informationmodel_methods \
or self.options.enable_pubsub_custom_publish_handling \
or self.options.enable_pubsub_eth_uadp_etf:
raise ConanInvalidConfiguration("The option 'enable_pubsub' must be True, if pubsub is required." )
Copy link
Contributor

Choose a reason for hiding this comment

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

We only enter this block if if self.options.enable_pubsub, so enable_pubsub is already True.

"enable_pubsub_eth_uadp_xdp": [True, False], # Enable Subscribe UADP over Ethernet using XDP
"enable_pubsub_eth_uadp_etf": [True, False], # Use ETF implementation for the ETH_UADP publish
"enable_pubsub_mqtt": [True, False], # Enable publish/subscribe with mqtt (experimental)
"namespace_zero": ["minimal", "reduced", "full"] # Completeness of the generated namespace zero (minimal/reduced/full)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd love to see options grouped together:

  • move enable_pubsub_eth_uadp_xdp, enable_pubsub_eth_uadp_etf , enable_pubsub_mqtt together with the others related to enable_pubsub...
  • enable_discovery_semaphore...

Copy link
Contributor

Choose a reason for hiding this comment

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

It makes sense to group enable_pubsub_eth_uadp , enable_pubsub_eth_uadp_xdp, enable_pubsub_eth_uadp_etf under one option as an enumeration, since, as I understand, these options are mutually exclusive

"multithread": "ANY", # Level of multithreading (0-99: No Multithreading, 100-199: Thread-Safe API, >=200: Internal Threads
# multithread configuration may be
# 1.0 : False, True
# 1.1 : False, thread-safe, internal-threads or an integer
Copy link
Contributor

Choose a reason for hiding this comment

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

How does that integer work? It is the same 10 or 30? If it is, I would list here only the meaningful values... if every number has a different meaning... well, that's how it is 🤷

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 have extracted meaningful values here : False, thread-safe, internal-threads
But @madebr made a suggestion where he leaved the possibility to the user to set the integer if he prefers. I think it can make sense.

homepage = "http://open62541.org"
license = "MPL-2.0"
exports_sources = ["CMakeLists.txt", "patches/**"]
exports = "submoduledata.yml"
Copy link
Contributor

Choose a reason for hiding this comment

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

This should go in the exports_sources, it is only needed if we are going to build the package.

@matkonnerth
Copy link

please be aware that there is a second PR #1687 in progress

@syoliver
Copy link
Contributor Author

I'd really like to see mdnsd merged first and then build this package using the requirement. Is it too hard to build?

I will try, Yes I don't think it will be easy, but I have to try. I miss time to do it right now 🙄

cmake_minimum_required(VERSION 3.1.2)

project(cmake_wrapper)
message(WARNING "Conan Open62541 Wrapped CMake")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
message(WARNING "Conan Open62541 Wrapped CMake")

message(WARNING "Conan Open62541 Wrapped CMake")

include(conanbuildinfo.cmake)
conan_basic_setup(NO_OUTPUT_DIRS)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this required?

@@ -0,0 +1,8 @@
sources:
"1.1":
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to bump the version to 1.1.2?


def requirements(self):
if self.options.tls == "openssl":
self.requires("openssl/1.1.1g")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self.requires("openssl/1.1.1g")
self.requires("openssl/1.1.1h")

# multithread configuration may be
# 1.0 : False, True
# 1.1 : False, thread-safe, internal-threads or an integer
"tls": [False, "openssl", "mbedtls-apache", "mbedtls-gpl"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"tls": [False, "openssl", "mbedtls-apache", "mbedtls-gpl"],
"tls": [False, "openssl", "mbedtls"],

Eventually create a auto option:

        "tls": [False, "auto", "openssl", "mbedtls"],
...
See the cmake recipe how to use this:
https://github.com/conan-io/conan-center-index/blob/master/recipes/cmake/3.x.x/conanfile.py#L17

"shared": False,
"fPIC": True,
"multithread": False,
"tls": "mbedtls-apache",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"tls": "mbedtls-apache",
"tls": "mbedtls",

Comment on lines +124 to +127
def configure(self):
self.options["libwebsockets"].with_ssl = self.options.tls

if self.options.enable_pubsub:
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't override options of dependencies, but check in build.

Suggested change
def configure(self):
self.options["libwebsockets"].with_ssl = self.options.tls
if self.options.enable_pubsub:
def configure(self):
if self.options.enable_pubsub:

self.info.options.multithreaded = self._ua_multithreaded()

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
Copy link
Contributor

Choose a reason for hiding this comment

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

In package, you remove lib/cmake and lib/pkgconfig.
Please check + add the cmake_find_package/cmake_find_package_multi/pkg_config names.

In the future, .pc will files might be created only for those recipes that set pkg_config explicitly. So that one should be set anyhow.

"1.1":
deps/mdnsd:
sha256: b1847047c0c4a20ab6a132fed6d6b6e50db6b07f0068a95213306603279a3b9a
url: https://github.com/Pro/mdnsd/archive/5af316c4b79460c0c1b6c2a674a37e28a85441a3.zip
Copy link
Contributor

Choose a reason for hiding this comment

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

pro-mdnsd/0.8.4 is now available as a conan package!
Alas, nodeset not yet.

@ghost
Copy link

ghost commented Nov 16, 2020

I detected other pull requests that are modifying open62541 recipe:

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

@ghost ghost mentioned this pull request Nov 16, 2020
4 tasks
self._cmake.definitions["UA_DEBUG_DUMP_PKGS"] = self.options.debug_dump_pkgs
self._cmake.definitions["UA_ENABLE_HARDENING"] = self.options.enable_hardening
self._cmake.definitions["OPEN62541_VERSION"] = self.version
self._cmake.definitions["UA_DEBUG" ] = self.settings.build_type == "Debug"
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be set to Release? Are you running the internal test and thus need this flag (you shouldn't run unit tests on conan though...).

Also if I am not mixing things up, isn't this flag also changing optimization levels?

If you really want to allow the user to change from release to debug, set it through settings.build_type instead

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, this option is set by CMakeLists.txt file itself when CMAKE_BUILD_TYPE is Debug, so you can skip this option, since it is already handled by settings.build_type

"enable_pubsub_eth_uadp_xdp": [True, False], # Enable Subscribe UADP over Ethernet using XDP
"enable_pubsub_eth_uadp_etf": [True, False], # Use ETF implementation for the ETH_UADP publish
"enable_pubsub_mqtt": [True, False], # Enable publish/subscribe with mqtt (experimental)
"namespace_zero": ["minimal", "reduced", "full"] # Completeness of the generated namespace zero (minimal/reduced/full)
Copy link
Contributor

Choose a reason for hiding this comment

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

It makes sense to group enable_pubsub_eth_uadp , enable_pubsub_eth_uadp_xdp, enable_pubsub_eth_uadp_etf under one option as an enumeration, since, as I understand, these options are mutually exclusive

self._cmake.definitions["UA_ENABLE_TYPEDESCRIPTION"] = self.options.enable_typedescription
self._cmake.definitions["UA_NAMESPACE_ZERO"] = self.options.namespace_zero

self._cmake.definitions["UA_BUILD_EXAMPLES"] = False
Copy link
Contributor

Choose a reason for hiding this comment

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

this option defaults to Off in CmakeLists.txt, no need to set it

self._cmake.definitions["UA_NAMESPACE_ZERO"] = self.options.namespace_zero

self._cmake.definitions["UA_BUILD_EXAMPLES"] = False
self._cmake.definitions["UA_BUILD_UNIT_TESTS"] = False
Copy link
Contributor

Choose a reason for hiding this comment

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

this option also defaults to Off in CmakeLists.txt, thus again, no need to set it

@saukijan
Copy link
Contributor

Looks quite good, pretty much everything that I tried to achieve with my pull request. If all code discussions are resolved I am willing to close my PR and accept this as the proper one. (Also there is documentation PR on open62541 that would need slight updates to cover all of the options that you provide, I would update it once the PR is merged )

One question thought, have you checked if include directories are properly set in the final package? I had some problems with those myself and had to explicitly set them in my package_info section of my conanfile.py

Also it would be nice if you simplified the names of your options, in my opinion, they don't need to be exact representations of cmake option names. You can check my conanfile.py for some inspiration.

prince-chrismc referenced this pull request in Hahn-Schickard/conan-center-index Dec 2, 2020
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.

None yet

8 participants