Opened 8 years ago

Last modified 6 years ago

#49711 new submission

[cpp-netlib][0.11.2][new port]

Reported by: nikkoara@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: cpp-netlib

Description

cpp-netlib is a very useful C++ networking library that lives in the Boost ecosystem. Not yet an official Boost library but has a strong integration with the rest of it.

I have preserved the official name cpp-netlib instead of prefixing a "boost-".

I need advice on one issue: the default installation of boost is with +no_static. This only installs shared libraries. The default build process for cpp-netlib is creating static libraries and depends on the static boost libraries. I have chosen no to change the defaults (i.e., cpp-netlib does not have a +shared default). As a result of this if one attempts to install cpp-netlib over a default boost install it will fail and the only error is in the log file, a complaint that it cannot find the static boost libraries it needs.

IMHO, the port should check if the variants are compatible but I could not find how to programmatically check the variants of another port that is already installed. I would appreciate some pointers. Thanks!

Attachments (8)

Portfile (1.1 KB) - added by nikkoara@… 8 years ago.
version.diff (435 bytes) - added by nikkoara@… 8 years ago.
Portfile.2 (1.2 KB) - added by nikkoara@… 8 years ago.
Portfile.3 (1.2 KB) - added by nikkoara@… 8 years ago.
Portfile.4 (1.2 KB) - added by raimue (Rainer Müller) 8 years ago.
CMakeOutput.log (36.7 KB) - added by raimue (Rainer Müller) 8 years ago.
Failed configure attempt
main.log (12.5 KB) - added by raimue (Rainer Müller) 8 years ago.
Failed configure attempt
Portfile.5 (1.4 KB) - added by nikkoara@… 8 years ago.
Disabled examples, tests, fixed shared v static conflicts.

Download all attachments as: .zip

Change History (21)

Changed 8 years ago by nikkoara@…

Attachment: Portfile added

Changed 8 years ago by nikkoara@…

Attachment: version.diff added

comment:1 Changed 8 years ago by mf2k (Frank Schima)

Keywords: boost networking c++ removed
Version: 2.3.4

comment:2 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

You can use the require_active_variants procedure in the active_variants 1.1 portgroup to check for variants of a dependency. For example, in the shared variant, you should use require_active_variants to verify that boost has not been installed with the no_shared variant. (The boost port's variant names are awful and I should change them to no longer use the "no_" prefix...)

You should make the default configuration of the cpp-netlib port such that it works with the default configuration of the boost port, in other words shared.

Seems like putting "boost" into the port name would be valuable.

"universal_variant yes" should be removed because that is the default.

"worksrcdir ${distname}" should be removed because that is the default.

In the shared variant, instead of using configure.args-delete and configure.args-append, you should use configure.args-replace.

Changed 8 years ago by nikkoara@…

Attachment: Portfile.2 added

comment:3 in reply to:  2 Changed 8 years ago by nikkoara@…

Replying to ryandesign@…:

You can use the require_active_variants procedure in the active_variants 1.1 portgroup to check for variants of a dependency. For example, in the shared variant, you should use require_active_variants to verify that boost has not been installed with the no_shared variant. (The boost port's variant names are awful and I should change them to no longer use the "no_" prefix...)

Used require_active_variants to constrain the building of static libraries only when boost has been built with no_static.

You should make the default configuration of the cpp-netlib port such that it works with the default configuration of the boost port, in other words shared.

Done.

Seems like putting "boost" into the port name would be valuable.

It seems so. I have no strong opinions on this. I only went with the official name.

"universal_variant yes" should be removed because that is the default.

Done.

"worksrcdir ${distname}" should be removed because that is the default.

Done.

In the shared variant, instead of using configure.args-delete and configure.args-append, you should use configure.args-replace.

Done. Thanks for the help.

comment:4 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

You've used the active_variants 1.0 portgroup but that's deprecated. You should use the active_variants 1.1 portgroup instead.

It doesn't look like the static variant does anything. If the user does not select the static variant, the static libraries should not be built.

Changed 8 years ago by nikkoara@…

Attachment: Portfile.3 added

comment:5 in reply to:  4 ; Changed 8 years ago by nikkoara@…

Replying to ryandesign@…:

You've used the active_variants 1.0 portgroup but that's deprecated. You should use the active_variants 1.1 portgroup instead.

Done.

It doesn't look like the static variant does anything. If the user does not select the static variant, the static libraries should not be built.

When the user selects the static build of cpp-netlib there is no need to change the default build configuration. The only thing we need is to check whether the boost port has been installed with no_static variant.

comment:6 in reply to:  5 Changed 8 years ago by nikkoara@…

Replying to nikkoara@…:

Replying to ryandesign@…:

It doesn't look like the static variant does anything. If the user does not select the static variant, the static libraries should not be built.

When the user selects the static build of cpp-netlib there is no need to change the default build configuration. The only thing we need is to check whether the boost port has been installed with no_static variant.

Are there any issues left with this ticket? Please let me know if I could help in any way. Thanks!

Changed 8 years ago by raimue (Rainer Müller)

Attachment: Portfile.4 added

comment:7 Changed 8 years ago by raimue (Rainer Müller)

Cc: raimue@… added

Regarding the +static variant, the port contents should not change depending on the variants selected on the boost port. This is an additional input that is not represented in the set of name/version/revision/epoch/variants. This means, users get different results depending on the installed boost library and users cannot use binary archives. Can the static libraries explicitly be disabled? Also, what would be built if I use both -shared -static?

Compilation failed on my system. I am no CMake expert and have no idea where to look further for this. I did not see any mention of the problem in CMakeOutput.log, but if required I could provide it.

CMake Error at CMakeLists.txt:121 (export):
  export given target "cppnetlib-client-connections" which is not built by
  this project.


-- Configuring incomplete, errors occurred!

Also, as another suggestion, I would reorder the options in the Portfile in the order they are required for the fetch/patch/configure/build phases. I attached an updated version, but leave the final decision on this to you as proposed maintainer.

comment:8 in reply to:  7 ; Changed 8 years ago by nikkoara@…

Replying to raimue@…:

Regarding the +static variant, the port contents should not change depending on the variants selected on the boost port. This is an additional input that is not represented in the set of name/version/revision/epoch/variants. This means, users get different results depending on the installed boost library and users cannot use binary archives. Can the static libraries explicitly be disabled? Also, what would be built if I use both -shared -static?

Disclaimer: my knowledge of Macports is limited.

The CMake infrastructure of the cpp-netlib project builds either shared libraries or static libraries. It does not contain provisions to build both. The selection hinges entirely on the CMake macro BUILD_SHARED_LIBS: if on, it builds shared libs, etc. If this is considered to be a limitation from the Macports framework pov there is little I can do about it.

The selection of static/shared libraries must match the kind of Boost libraries that are installed on the target machine, which is why I added the check inside the +static block. IMO it makes no sense to install the port with -static -shared. IIUC that means build without static and without shared variants? How does that work for libraries?

Compilation failed on my system. I am no CMake expert and have no idea where to look further for this. I did not see any mention of the problem in CMakeOutput.log, but if required I could provide it.

Could you please attach that and your invocation of ports? I would like to take a look at it.

Also, as another suggestion, I would reorder the options in the Portfile in the order they are required for the fetch/patch/configure/build phases. I attached an updated version, but leave the final decision on this to you as proposed maintainer.

I have no problem with that.

Thanks!

Changed 8 years ago by raimue (Rainer Müller)

Attachment: CMakeOutput.log added

Failed configure attempt

Changed 8 years ago by raimue (Rainer Müller)

Attachment: main.log added

Failed configure attempt

comment:9 in reply to:  8 ; Changed 8 years ago by raimue (Rainer Müller)

Replying to nikkoara@…:

The CMake infrastructure of the cpp-netlib project builds either shared libraries or static libraries. It does not contain provisions to build both. The selection hinges entirely on the CMake macro BUILD_SHARED_LIBS: if on, it builds shared libs, etc. If this is considered to be a limitation from the Macports framework pov there is little I can do about it.

If this port builds either static or shared libraries, it does not make sense to provide two variants. This would only be one choice, which could be addressed with a single +static variant. Although in this case, I do not see any reason to provide static libraries at all. I would just default to shared libraries and leave out the static libraries completely.

Compilation failed on my system. I am no CMake expert and have no idea where to look further for this. I did not see any mention of the problem in CMakeOutput.log, but if required I could provide it.

Could you please attach that and your invocation of ports? I would like to take a look at it.

I attached both CMakeOutput.log and main.log. I do not know what other parameters could be different on my system if it worked for you.

comment:10 in reply to:  9 Changed 8 years ago by nikkoara@…

Replying to raimue@…:

Replying to nikkoara@…:

The CMake infrastructure of the cpp-netlib project builds either shared libraries or static libraries. It does not contain provisions to build both. The selection hinges entirely on the CMake macro BUILD_SHARED_LIBS: if on, it builds shared libs, etc. If this is considered to be a limitation from the Macports framework pov there is little I can do about it.

If this port builds either static or shared libraries, it does not make sense to provide two variants. This would only be one choice, which could be addressed with a single +static variant. Although in this case, I do not see any reason to provide static libraries at all. I would just default to shared libraries and leave out the static libraries completely.

I see what you are saying. Use only one variant (has to be +shared) and in its absence, build the other/default kind of libraries. Because cpp-netlib CMake scripts default to building static libraries, the variant would be +shared: when present, build shared libs, when absent (or explicit "-shared"?) build default/static.

Compilation failed on my system. I am no CMake expert and have no idea where to look further for this. I did not see any mention of the problem in CMakeOutput.log, but if required I could provide it.

Could you please attach that and your invocation of ports? I would like to take a look at it.

I attached both CMakeOutput.log and main.log. I do not know what other parameters could be different on my system if it worked for you.

You attempted to install the the port with the default variant, i.e., static, but your boost installation only installed the shared Boost libraries. See in main.log, about line 120. The failure occurs during configuration but I don't remember having done this for me during the testing of the port. I expect this kind of errors to be loud and early, right after invocation, because of the +static variant and the check for Boost statics that is inside it. Is that check not performed unless the user puts +static explicitly on the command line?

comment:11 Changed 8 years ago by raimue (Rainer Müller)

I tried to build the default, which is +shared. I should not need static boost libraries for this. However, looking at the +shared variant, I noticed it is not actually doing anything:

variant shared description {Build shared libraries} {
    configure.args-replace -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON
}

The cmake port group provides a list of default options in configure.args. The one listed here is not in this list, so the -replace finds nothing to replace. Probably you meant to use -append with the second argument only? This works for me:

variant shared description {Build shared libraries} {
    configure.args-append -DBUILD_SHARED_LIBS:BOOL=ON
}

I did not test the +static variant, as I would have to recompile boost -no_static to test it.

I would recommend to also add -DCPP-NETLIB_BUILD_EXAMPLES:BOOL=OFF to avoid wasting CPU time to build examples which will not be installed at all. I am unsure if the same is true for -DCPP-NETLIB_BUILD_TESTS:BOOL=OFF and -DCPP-NETLIB_BUILD_EXPERIMENTS:BOOL=OFF, since they could be used for port test, but I did not try.

comment:12 in reply to:  11 Changed 8 years ago by nikkoara@…

Replying to raimue@…:

I tried to build the default, which is +shared. I should not need static boost libraries for this. However, looking at the +shared variant, I noticed it is not actually doing anything:

variant shared description {Build shared libraries} {
    configure.args-replace -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON
}

The cmake port group provides a list of default options in configure.args. The one listed here is not in this list, so the -replace finds nothing to replace. Probably you meant to use -append with the second argument only? This works for me:

variant shared description {Build shared libraries} {
    configure.args-append -DBUILD_SHARED_LIBS:BOOL=ON
}

I did not test the +static variant, as I would have to recompile boost -no_static to test it.

Aha.

I went back to testing it against Boost variants. I see now that the failure you noticed occurs in the scenario where Boost is installed with defaults (i.e., +no_static) which does not build but a handful of static libraries; in turn, cpp-netlib Portfile configure.args-replace does indeed nothing because the arg is not among the defaults. Will correct it shortly.

I would recommend to also add -DCPP-NETLIB_BUILD_EXAMPLES:BOOL=OFF to avoid wasting CPU time to build examples which will not be installed at all. I am unsure if the same is true for -DCPP-NETLIB_BUILD_TESTS:BOOL=OFF and -DCPP-NETLIB_BUILD_EXPERIMENTS:BOOL=OFF, since they could be used for port test, but I did not try.

I will add them all. Thanks!

Changed 8 years ago by nikkoara@…

Attachment: Portfile.5 added

Disabled examples, tests, fixed shared v static conflicts.

comment:13 Changed 6 years ago by raimue (Rainer Müller)

Cc: raimue removed
Note: See TracTickets for help on using tickets.