pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wget does not compile on FreeBSD12 with openssl (a solution?)



Finally, I have perhaps found a way to manage what I want by using the
current

pkgsrc infrastructure (which is much more convenient than compiling

everything directly from source).

First, there is a lot of good ideas in this thread:

https://stackoverflow.com/questions/6578484/telling-gcc-directly-to-link-a-library-statically

Since, these ideas are for GCC and I use at the moment pkgsrc on FreeBSD

(where the default compiler is clang), I can not test all of them.


But with the compiler clang, more environment variables exist. In

particular one can use CPPFLAGS (for adding more directories to search

for include files) and the variable LIBS to add some libraries (normally

with the "-l" option).  Both variables duplicates functionalities from

the traditionnal CFLAGS and LDFLAGS but when parameters are specified

in these variables, they are better used by the compiler and the linker.


By using pkgsrc, I was able:

        1) to compile "vim" fully statically (by adding

            "-static" to the LDFLAGS and CFLAGS variable)

         2)  to link with static libraries by adding them in the LIBS
variable.

You can see my definitions in the following file "mk.conf". To have a fully

statically linked binary you should uncomment the definitions where

the "-static" option is used and comment the definition where LIBS is used.

By switching the commented blocks, you have a dynamically linked executable

with some static libraries.

One of the ramaining problem is "libtool" which does generally

what it want instead of what one wishes (but my

misunderstanding of the black box "libtool" is perhaps the reason

why I can't have what I want with this tool).

I will do further trials and test and tell you what has succeded and
what has failed.

best regards,

--------------------------------------------------------------------mk.conf------------------------------------------------

# Example /opt/pkg/etc/mk.conf file produced by bootstrap-pkgsrc
# lun. 29 juil. 2019 21:27:32 CEST

.ifdef BSD_PKG_MK    # begin pkgsrc settings

ABI=            64
PKGSRC_COMPILER=    clang
CC=            clang
CXX=            clang++
CPP=            ${CC} -E
CLANGBASE=        /usr

PKG_DBDIR=        /opt/pkg/pkgdb
LOCALBASE=        /opt/pkg
VARBASE=        /opt/pkg/var
PKG_TOOLS_BIN=        /opt/pkg/sbin
PKGINFODIR=        info
PKGMANDIR=        man
ACCEPTABLE_LICENSES+=   gnu-lgpl-v2.1 unrar-license rc5-nonlicense openssl
ACCEPTABLE_LICENSES+=   vim-license
#
#Specific instructions for the APU pcengines

#There is 4 cores
MAKE_JOBS=4
#AMD Jaguar has AVX, SSE and AES instruction
CFLAGS+= -march=native -Oz -pipe -maes -mavx -msse4.2
CXXFLAGS+= -march=native -Oz -pipe -maes -mavx -msse4.2

#Some programs should be compiled with the highest speed possible
.if !empty(.CURDIR:M/opt/pkgsrc/security/gnupg2*)
    CFLAGS+= -Ofast
    CXXFLAGS+= -Ofast
.endif

#and some others compiled statically
#.if !empty(.CURDIR:M/opt/pkgsrc/net/rsync*)        ||   \
#    !empty(.CURDIR:M/opt/pkgsrc/security/gnupg2*)  ||   \
#    !empty(.CURDIR:M/opt/pkgsrc/editors/vim*)
#    CFLAGS+= -static
#    CXXFLAGS+= -static
#    LDFLAGS+= -static
#.endif

.if !empty(.CURDIR:M/opt/pkgsrc/editors/vim*)
    LIBS+= /opt/pkg/lib/libintl.a /usr/lib/libm.a /usr/lib/libncurses.a
.endif

#Specific options for programs.
PKG_OPTIONS.curl=http2 idn inet6
#With the "psl" package, the static linkink failed due to missing symbols.
PKG_OPTIONS.wget=idn inet6 openssl -psl
PKG_OPTIONS.openssl=idea md2 mdc2 threads zlib rc5

.endif            # end pkgsrc settings

Le 02.08.2019 à 14:27, Greg Troxel a écrit :
Joerg Sonnenberger <joerg%bec.de@localhost> writes:

On Fri, Aug 02, 2019 at 09:57:57AM +0200, Martin Husemann wrote:
On Thu, Aug 01, 2019 at 07:58:57PM +0000, maya%NetBSD.org@localhost wrote:
Note that any solution requiring the modification of the package
contents to work will be dismissed as a too niche use case to justify
the maintenance.
I would reformulate this: pkgsrc is likely going to accept patches for
adding a static link option (via the options framework) if it boils down
to changing a configure argument / env var. Everything beyound that should
be handled upstream first.
Are we? It requires a lot of changes in many places for a very minor use
case. I'm really not in favor.
I am also not in favor.  Changes for this would have to be extremely
contained -- not needing per-package support -- for me to view them as
acceptable.

Basically, wanting static linking in pkgsrc is counter to the main plan,
and so far we seem to have only one person that wants it.



Home | Main Index | Thread Index | Old Index