Discussion:
RFC: Alternative to PRIVATELIB
Baptiste Daroussin
2015-04-11 14:28:35 UTC
Permalink
Hi,

I would like to propose to replace PRIVATELIB with something more convenient.

First what is PRIVATELIB is trying to solve:
We are maintaining stable ABI over branches but some third parties sources
are not really good at maintaining stable ABI, so we do hide them into private
where nothing can use it. We do not provide headers for that and we add rpath to
every binaries that needs to link to those.

What is the issues of PRIVATELIB:
any application linking to a library from base (a regular one) that does itself
links to a PRIVATELIB cannot anymore statically link to the said application.

The is no mechanism to handle PRIVATELIBS in compat*x ports which can be a
problem if one of our regular lib is linked to a privatelib and ends up into
compat one day.

It prevents easy linking for 3rd party application using those privatelibs on
purpose (aka with the knowledge abi can break) like libbsdstat.

What I would like to propose is the following:

Create in bsd.lib.mk support for PRIVATE knobs (what ever name you do prefer)

It will just prefix the name of the library with "private" but install it in the
regular place

It will automatically decide to install the headers into /usr/include/private/${LIB}/
Each private library headers in a custom place to avoid an application that
deliberatly use a given privatelib to find another one

Prefix all manpage with private_ so that we can provide the documentation for
the said libs for the version we ship but if another version is shipped by ports
then we can easily access both documentation.

As a result bsd.lib.mk will be simpler, we could again static link against
everything we ship in base, we can provide documentation for those libs and we
can easily isolate them anyway from the ports.

I plan to start working on this in a week.

Best regards,
Bapt
Baptiste Daroussin
2015-04-11 15:14:12 UTC
Permalink
Post by Baptiste Daroussin
Hi,
I would like to propose to replace PRIVATELIB with something more convenient.
We are maintaining stable ABI over branches but some third parties sources
are not really good at maintaining stable ABI, so we do hide them into private
where nothing can use it. We do not provide headers for that and we add rpath to
every binaries that needs to link to those.
any application linking to a library from base (a regular one) that does itself
links to a PRIVATELIB cannot anymore statically link to the said application.
The is no mechanism to handle PRIVATELIBS in compat*x ports which can be a
problem if one of our regular lib is linked to a privatelib and ends up into
compat one day.
It prevents easy linking for 3rd party application using those privatelibs on
purpose (aka with the knowledge abi can break) like libbsdstat.
Create in bsd.lib.mk support for PRIVATE knobs (what ever name you do prefer)
It will just prefix the name of the library with "private" but install it in the
regular place
It will automatically decide to install the headers into /usr/include/private/${LIB}/
Each private library headers in a custom place to avoid an application that
deliberatly use a given privatelib to find another one
Prefix all manpage with private_ so that we can provide the documentation for
the said libs for the version we ship but if another version is shipped by ports
then we can easily access both documentation.
As a result bsd.lib.mk will be simpler, we could again static link against
everything we ship in base, we can provide documentation for those libs and we
can easily isolate them anyway from the ports.
I plan to start working on this in a week.
Best regards,
Bapt
This patch shows an example with libucl:
https://people.freebsd.org/~bapt/private.diff

Best regards,
Bapt
Brooks Davis
2015-04-13 16:11:41 UTC
Permalink
Post by Baptiste Daroussin
Post by Baptiste Daroussin
Hi,
I would like to propose to replace PRIVATELIB with something more convenient.
We are maintaining stable ABI over branches but some third parties sources
are not really good at maintaining stable ABI, so we do hide them into private
where nothing can use it. We do not provide headers for that and we add rpath to
every binaries that needs to link to those.
any application linking to a library from base (a regular one) that does itself
links to a PRIVATELIB cannot anymore statically link to the said application.
The is no mechanism to handle PRIVATELIBS in compat*x ports which can be a
problem if one of our regular lib is linked to a privatelib and ends up into
compat one day.
It prevents easy linking for 3rd party application using those privatelibs on
purpose (aka with the knowledge abi can break) like libbsdstat.
Create in bsd.lib.mk support for PRIVATE knobs (what ever name you do prefer)
It will just prefix the name of the library with "private" but install it in the
regular place
It will automatically decide to install the headers into /usr/include/private/${LIB}/
Each private library headers in a custom place to avoid an application that
deliberatly use a given privatelib to find another one
Prefix all manpage with private_ so that we can provide the documentation for
the said libs for the version we ship but if another version is shipped by ports
then we can easily access both documentation.
As a result bsd.lib.mk will be simpler, we could again static link against
everything we ship in base, we can provide documentation for those libs and we
can easily isolate them anyway from the ports.
I plan to start working on this in a week.
https://people.freebsd.org/~bapt/private.diff
This seems good to me.

-- Brooks
Bryan Drewery
2015-04-24 18:57:51 UTC
Permalink
Post by Baptiste Daroussin
Hi,
I would like to propose to replace PRIVATELIB with something more convenient.
We are maintaining stable ABI over branches but some third parties sources
are not really good at maintaining stable ABI, so we do hide them into private
where nothing can use it. We do not provide headers for that and we add rpath to
every binaries that needs to link to those.
any application linking to a library from base (a regular one) that does itself
links to a PRIVATELIB cannot anymore statically link to the said application.
The is no mechanism to handle PRIVATELIBS in compat*x ports which can be a
problem if one of our regular lib is linked to a privatelib and ends up into
compat one day.
It prevents easy linking for 3rd party application using those privatelibs on
purpose (aka with the knowledge abi can break) like libbsdstat.
Create in bsd.lib.mk support for PRIVATE knobs (what ever name you do prefer)
It will just prefix the name of the library with "private" but install it in the
regular place
It will automatically decide to install the headers into /usr/include/private/${LIB}/
This is basically a requirement to even make some libraries private. (I
may be misremembering details) Anything built against readline wants to
find a readline/*.h but the source in the tree is not stored in a
readline/*.h structure. By installing the actual headers into
/usr/include/private the problem goes away.
Post by Baptiste Daroussin
Each private library headers in a custom place to avoid an application that
deliberatly use a given privatelib to find another one
Prefix all manpage with private_ so that we can provide the documentation for
the said libs for the version we ship but if another version is shipped by ports
then we can easily access both documentation.
This sounds useful for debugging and developing base applications which
need these private libs.
Post by Baptiste Daroussin
As a result bsd.lib.mk will be simpler, we could again static link against
everything we ship in base, we can provide documentation for those libs and we
can easily isolate them anyway from the ports.
I plan to start working on this in a week.
+1
--
Regards,
Bryan Drewery
Bryan Drewery
2015-04-24 19:00:45 UTC
Permalink
Post by Bryan Drewery
Post by Baptiste Daroussin
Prefix all manpage with private_ so that we can provide the documentation for
the said libs for the version we ship but if another version is shipped by ports
then we can easily access both documentation.
This sounds useful for debugging and developing base applications which
need these private libs.
However I would suggest a /usr/share/man/private that you can access by
setting MANDIR. Prefixing all manpages with 'private_' will get silly
with cross-references and function_name.3 files.
--
Regards,
Bryan Drewery
Baptiste Daroussin
2015-04-24 19:02:18 UTC
Permalink
Post by Bryan Drewery
Post by Bryan Drewery
Post by Baptiste Daroussin
Prefix all manpage with private_ so that we can provide the documentation for
the said libs for the version we ship but if another version is shipped by ports
then we can easily access both documentation.
This sounds useful for debugging and developing base applications which
need these private libs.
However I would suggest a /usr/share/man/private that you can access by
setting MANDIR. Prefixing all manpages with 'private_' will get silly
with cross-references and function_name.3 files.
Actually manpages is the complicated part of that proposal, so I may do manpages
in a second attempt :)

Best regards,
Bapt

Loading...