# Trouble upgrading ports, LibreSSL related.



## giantkingsquid (Jun 1, 2017)

Hi everyone,

I'm new on these forums and newish to FreeBSD. Thought I'd give it a go for a web and mail server project I've been running for a while on a Mac. So I have migrated over to FreeBSD 
11.0-RELEASE-p9.

I'm having trouble upgrading my ports using portmaster. Basically I have a few ports that won't compile because they are missing various LibreSSL libraries. Trying to link them or otherwise fix this problem is way beyond me at this stage of my FreeBSD journey unfortunately.

So firstly I completed a 
	
	



```
portsnap fetch update
```
Then I did 
	
	



```
portmaster -a
```
 which came back with this error on every port that uses LibreSSL (or is it every port dependent on mysql?) 
	
	



```
Shared object "libssl.so.39" not found, required by "mysql"
```

If I go ahead and run portmaster the first port (curl in this case) fails with 
	
	



```
configure: error: one or more libs available at link-time are not available run-time. Libs used at link-time: -lnghttp2  -lssh2 -lssh2  -lssl -lcrypto -lz -L/usr/local/lib
```

I tried 
	
	



```
cd /usr/ports/security/libressl && make reinstall clean
```
 which runs fine but doesn't fix the problem.

I tried 
	
	



```
portmaster -r libressl
```
 which fails with, I'm not sure if this is the same LibreSSL problem or some conflict between MariaDB and MySQL (which I don't believe is installed...) 
	
	



```
===>>> Currently installed version: mariadb55-server-5.5.54_1

===>>> Port directory: /usr/ports/databases/mariadb55-server


Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

    ===>>> This port is marked IGNORE

    ===>>> cannot install: MySQL versions mismatch: mysql-client is installed and wanted version is mariadb55-client



    ===>>> If you are sure you can build it, remove the

          IGNORE line in the Makefile and try again.


===>>> Update for mariadb55-server-5.5.54_1 failed

===>>> Aborting update
```

I then tried 
	
	



```
cd /usr/ports/databases/mariadb55-server/ && make reinstall
```
 which failed with 
	
	



```
Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

===>  mariadb55-server-5.5.56_1 cannot install: MySQL versions mismatch:

mysql-client is installed and wanted version is mariadb55-client.

*** Error code 1


Stop.

make: stopped in /usr/ports/databases/mariadb55-server
```

So basically I'm pretty sure I am missing one of more LibreSSL libraries and may or may not have some form of SQL conflict. Any help is much appreciated.

p.s. versions:
libressl-2.5.4
mariadb55-server-5.5.54_1
mariadb55-client-5.5.54_1

Tom


----------



## ShelLuser (Jun 1, 2017)

giantkingsquid said:


> So firstly I completed a
> 
> 
> 
> ...


Was that the very first command you used? Because that could be a cause of the problem, normally you'd install the Ports collection by running `# portsnap fetch extract`, only after you did that then the update parameter can be used. I'm assuming you installed the Ports collection during installation, but it's still an important detail which is why I'm mentioning it.

Also noteworthy is that LibreSSL isn't used by default, all packages rely on OpenSSL unless you changed something. So start by please showing us your /etc/make.conf file.



giantkingsquid said:


> If I go ahead and run portmaster the first port (curl in this case) fails with
> 
> 
> 
> ...


Go into the /usr/ports/ftp/curl directory then run this command and share its output: `# make all-depends-list`.


----------



## giantkingsquid (Jun 1, 2017)

Sorry, that was the first command I used when trying to update my ports. Obviously I installed the ports collection when I installed FreeBSD a few months ago.

I used iredmail to setup the mail server (for better or worse haha), so the make.conf is a bit wild, it does specify libressl however. I put the very last line in based on a thread I found on here, but it didn't fix the problem and it was a long shot for sure.


```
# iRedMail-WANT_OPENLDAP_VER

WANT_OPENLDAP_VER=24

# iRedMail-WANT_MYSQL

WANT_MYSQL=55m

# iRedMail-WANT_PGSQL_VER

WANT_PGSQL_VER=95

# iRedMail-APACHE_PORT

APACHE_PORT=www/apache24

# iRedMail-WANT_BDB_VER

WANT_BDB_VER=5

# iRedMail-DEFAULT_VERSIONS

DEFAULT_VERSIONS+=ssl=libressl python=2.7 python2=2.7 apache=2.4 pgsql=9.5 php=7.0

# iRedMail-OPTIONS_SET-SASL

OPTIONS_SET+=SASL

# iRedMail-OPTIONS_UNSET-X11

OPTIONS_UNSET+=X11

# iRedMail-LICENSES_ACCEPTED-NONE

LICENSES_ACCEPTED+=NONE

WANT_OPENLDAP_SASL=yes
```

Here's the output of the curl dependencies list.


```
root@28spots:/usr/ports/ftp/curl # make all-depends-list

/usr/ports/ports-mgmt/pkg

/usr/ports/devel/gmake

/usr/ports/devel/gettext-tools

/usr/ports/converters/libiconv

/usr/ports/devel/gettext-runtime

/usr/ports/print/indexinfo

/usr/ports/devel/pkgconf

/usr/ports/devel/kyua

/usr/ports/devel/atf

/usr/ports/devel/lutok

/usr/ports/lang/lua52

/usr/ports/devel/libedit

/usr/ports/databases/sqlite3

/usr/ports/devel/readline

/usr/ports/security/libressl

/usr/ports/lang/perl5.24

/usr/ports/www/libnghttp2

/usr/ports/devel/autoconf

/usr/ports/devel/m4

/usr/ports/print/texinfo

/usr/ports/misc/help2man

/usr/ports/devel/p5-Locale-gettext

/usr/ports/devel/autoconf-wrapper

/usr/ports/devel/automake

/usr/ports/devel/automake-wrapper

/usr/ports/devel/libtool

/usr/ports/security/libssh2

/usr/ports/security/ca_root_nss
```

Thanks for your help,

Tom


----------



## ShelLuser (Jun 1, 2017)

I'm not familiar with iRedMail and when looking at the mess above and some of the things I found online I'm glad I'm not. Just to show you how much drive these guys have to support FreeBSD, check out his official thread from 2009. The guy took more time trying to spam the forums than trying to get this software officially incorporated into the Ports collection:


```
root@macron:/usr/ports # make search key=iredmail
root@macron:/usr/ports #
```
So first the "elitist sounding" suggestion: maybe you should consider to dump this stuff, and use something a little more sanitized. I cannot help wonder if the cause for your problems can't be traced back to this package (but that's just an assumption!).

Of course that doesn't help you, so let's see what we can do here.

Going by the error it seems you got a clash: MySQL client is installed and the system is trying to install MariaDB. Which leads up to the first question: when did you install iRedMail? Did you install it right after you installed the server or did you already install stuff in between yourself?

If you check the /etc/make.conf you'll notice that the version being used is MySQL. Is it possible that you tried to install MariaDB manually or something?

In the mean time, what happens when you run: `# make build` from /usr/ports/ftp/curl? Any errors?

If you're using the default root environment then you may want to use: `# make build |& build.log` so that you can paste any possible errors.


----------



## giantkingsquid (Jun 1, 2017)

Trust me the thought has crossed my mind more than once, it may worth rolling my own mail server, I only tried iRedmail as an experiment and it seemed to work fun up until now. Live and learn I suppose  That thread is funny though.

I installed iRedmail on a brand new VM, so no chance of anything being installed. MariaDB is installed but I cannot see MySQL installed anywhere in my list of ports below, apologies for long code block. Unless it's hiding somewhere. i do know that sometimes MariaDB refers to itself as MySQL for compatibility reasons, perhaps the port is thinking it is in conflict because it finds MariaDB and MySQL, though they're actually the same thing. Unlikely though and I'm sure it would've cropped up before now.

If I run `make build` I get the same error as in my OP, and if I try to log using your suggestion I get an error, evidently my root environment is not the default.


```
root@28spots:/usr/ports/security/openssl # portmaster -l 

===>>> Root ports (No dependencies, not depended on)

===>>> dialog4ports-0.1.6

===>>> libatomic_ops-7.4.4

===>>> nasm-2.11.08_1,1

===>>> pkg-1.10.1

===>>> pkgconf-1.3.7,1

===>>> portmaster-3.17.10

===>>> zip-3.0_1

===>>> 7 root ports


===>>> Trunk ports (No dependencies, are depended on)

===>>> GeoIP-1.6.11

===>>> altermime-0.3.11.a1

===>>> arc-5.21p

===>>> arj-3.10.22_4

===>>> autoconf-wrapper-20131203

===>>> automake-wrapper-20131203

===>>> boehm-gc-7.6.0

===>>> c-ares-1.12.0_1

===>>> ca_root_nss-3.30.2

===>>> cabextract-1.6

===>>> cmake-modules-3.8.0

===>>> compat10x-amd64-10.3.1003000.20161027

===>>> cvsps-2.1_2

===>>> db5-5.3.28_6

===>>> dcc-dccd-1.3.158_2

===>>> expat-2.2.0_1

===>>> file-5.29

===>>> freetype2-2.8

===>>> freeze-2.5_2

===>>> giflib-5.1.4

===>>> icu-58.2_2,1

===>>> indexinfo-0.2.6

===>>> jbigkit-2.1_1

===>>> jpeg-turbo-1.5.1

===>>> json-c-0.12.1

===>>> jsoncpp-1.8.0_2

===>>> lha-1.14i_7

===>>> libdatrie-0.2.10

===>>> libiconv-1.14_10

===>>> libltdl-2.4.6

===>>> liblz4-1.7.5,1

===>>> libmcrypt-2.5.8_3

===>>> libnghttp2-1.23.1

===>>> libpaper-1.1.24.4

===>>> libressl-2.5.4

===>>> libuv-1.12.0

===>>> libxml2-2.9.4

===>>> libzip-1.1.3

===>>> lmdb-0.9.19,1

===>>> lsof-4.90.i,8

===>>> lzo2-2.10_1

===>>> nomarch-1.4

===>>> npth-1.4

===>>> oniguruma5-5.9.6_1

===>>> p0f-3.09b

===>>> p7zip-16.02

===>>> pcre-8.40

===>>> perl5-5.24.1_1

===>>> png-1.6.29

===>>> re2c-0.14.3

===>>> ripole-0.2.2

===>>> rpm2cpio-1.4_2

===>>> t1lib-5.1.2_4,1

===>>> tinycdb-0.78_2

===>>> tnef-1.4.12

===>>> unarj-2.65_2

===>>> unzoo-4.4_2

===>>> xmlcatmgr-2.2_2

===>>> zoo-2.10.1_3

===>>> 59 trunk ports


===>>> Branch ports (Have dependencies, are depended on)

===>>> aspell-0.60.6.1_6

===>>> autoconf-2.69_1

===>>> bash-static-4.4.12_2

===>>> cclient-2007f_2,1

===>>> compat9x-amd64-9.3.903000.20161027

===>>> curl-7.53.1

===>>> cyrus-sasl-2.1.26_12

===>>> docbook-1.5

===>>> docbook-sgml-4.5_1

===>>> docbook-xml-5.0_3

===>>> docbook-xsl-1.76.1_3

===>>> dovecot2-2.2.28_1

===>>> fontconfig-2.12.1,1

===>>> gdbm-1.12

===>>> getopt-1.1.6

===>>> gettext-runtime-0.19.8.1_1

===>>> gmake-4.2.1_1

===>>> gmp-6.1.2

===>>> gnupg-2.1.19

===>>> gnutls-3.5.9

===>>> iso8879-1986_3

===>>> libarchive-3.2.2,1

===>>> libassuan-2.4.3

===>>> libffi-3.2.1

===>>> libgcrypt-1.7.6

===>>> libgd-2.2.4,1

===>>> libgpg-error-1.27

===>>> libidn-1.33_1

===>>> libksba-1.3.5

===>>> libssh2-1.8.0,3

===>>> libtasn1-4.10

===>>> libthai-0.1.26

===>>> libunistring-0.9.7

===>>> libxslt-1.1.29_1

===>>> lzop-1.03

===>>> m4-1.4.18,1

===>>> mariadb55-client-5.5.54_1

===>>> nettle-3.3

===>>> node6-6.9.2

===>>> p11-kit-0.23.5

===>>> p5-Algorithm-C3-0.10_1

===>>> p5-AppConfig-1.71

===>>> p5-Archive-Zip-1.59

===>>> p5-Authen-NTLM-1.09_1

===>>> p5-Authen-SASL-2.16_1

===>>> p5-B-Hooks-EndOfScope-0.21

===>>> p5-BerkeleyDB-0.55_1

===>>> p5-Class-C3-0.33

===>>> p5-Class-Data-Inheritable-0.08_1

===>>> p5-Class-Inspector-1.31

===>>> p5-Class-Method-Modifiers-2.12

===>>> p5-Class-MethodMaker-2.24

===>>> p5-Class-Singleton-1.5_1

===>>> p5-Convert-ASN1-0.27_2

===>>> p5-Convert-BinHex-1.125

===>>> p5-Convert-TNEF-0.18_1

===>>> p5-Convert-UUlib-1.50,1

===>>> p5-Crypt-CBC-2.33_1

===>>> p5-Crypt-DES-2.07_1

===>>> p5-Crypt-OpenSSL-Bignum-0.08

===>>> p5-Crypt-OpenSSL-RSA-0.28_1

===>>> p5-Crypt-OpenSSL-Random-0.11

===>>> p5-DBD-mysql-4.041

===>>> p5-DBI-1.636_1

===>>> p5-Data-OptList-0.110

===>>> p5-DateTime-1.42

===>>> p5-DateTime-Locale-1.16

===>>> p5-DateTime-TimeZone-2.11,1

===>>> p5-Devel-StackTrace-2.02

===>>> p5-Digest-HMAC-1.03_1

===>>> p5-Digest-SHA1-2.13_1

===>>> p5-Dist-CheckConflicts-0.11_1

===>>> p5-Email-Date-Format-1.005

===>>> p5-Encode-Detect-1.01_1

===>>> p5-Encode-Locale-1.05

===>>> p5-Error-0.17024

===>>> p5-Eval-Closure-0.14

===>>> p5-Exception-Class-1.42

===>>> p5-File-Listing-6.04_1

===>>> p5-File-ShareDir-1.102_2

===>>> p5-Font-AFM-1.20_1

===>>> p5-Geo-IP-1.50

===>>> p5-HTML-Parser-3.72

===>>> p5-HTML-StripScripts-1.06

===>>> p5-HTML-Tagset-3.20_1

===>>> p5-HTML-Tree-5.05

===>>> p5-HTTP-Cookies-6.03

===>>> p5-HTTP-Daemon-6.01_1

===>>> p5-HTTP-Date-6.02_1

===>>> p5-HTTP-Message-6.11

===>>> p5-HTTP-Negotiate-6.01_1

===>>> p5-IO-HTML-1.001_1

===>>> p5-IO-Multiplex-1.13_1

===>>> p5-IO-Socket-INET6-2.72_1

===>>> p5-IO-Socket-IP-0.38

===>>> p5-IO-Socket-SSL-2.044

===>>> p5-IO-stringy-2.111

===>>> p5-LWP-MediaTypes-6.02_1

===>>> p5-Lchown-1.01_2

===>>> p5-List-AllUtils-0.14

===>>> p5-List-SomeUtils-0.53

===>>> p5-List-SomeUtils-XS-0.52

===>>> p5-List-UtilsBy-0.10

===>>> p5-Locale-gettext-1.06

===>>> p5-MIME-Base64-3.15

===>>> p5-MIME-Charset-1.012.2

===>>> p5-MIME-Lite-3.030_1

===>>> p5-MIME-Tools-5.508,2

===>>> p5-MIME-Types-2.13

===>>> p5-MRO-Compat-0.13

===>>> p5-Mail-DKIM-0.40_2

===>>> p5-Mail-SPF-2.9.0_4

===>>> p5-Mail-Tools-2.14

===>>> p5-Module-Implementation-0.09_1

===>>> p5-Module-Runtime-0.014_1

===>>> p5-Mozilla-CA-20160104

===>>> p5-Net-DNS-1.08,1

===>>> p5-Net-DNS-Resolver-Programmable-0.003_2

===>>> p5-Net-HTTP-6.14

===>>> p5-Net-IP-1.26_1

===>>> p5-Net-LibIDN-0.12_4

===>>> p5-Net-SNMP-6.0.1_1

===>>> p5-Net-SSLeay-1.80

===>>> p5-Net-Server-2.008_3

===>>> p5-Net-XWhois-0.90_5

===>>> p5-NetAddr-IP-4.078

===>>> p5-Package-Stash-0.37_1

===>>> p5-Package-Stash-XS-0.28_2

===>>> p5-Params-Util-1.07_2

===>>> p5-Params-Validate-1.26

===>>> p5-Params-ValidationCompiler-0.24

===>>> p5-Role-Tiny-2.000005

===>>> p5-Scalar-List-Utils-1.45,1

===>>> p5-Socket-2.024

===>>> p5-Socket6-0.28

===>>> p5-Specio-0.36

===>>> p5-Sub-Exporter-0.987_1

===>>> p5-Sub-Exporter-Progressive-0.001013

===>>> p5-Sub-Identify-0.14

===>>> p5-Sub-Install-0.928_1

===>>> p5-Term-ReadKey-2.37

===>>> p5-TimeDate-2.30_2,1

===>>> p5-Try-Tiny-0.24

===>>> p5-URI-1.71

===>>> p5-Unix-Syslog-1.1_1

===>>> p5-Variable-Magic-0.61

===>>> p5-WWW-RobotRules-6.02_1

===>>> p5-XML-Filter-BufferText-1.01_1

===>>> p5-XML-NamespaceSupport-1.12

===>>> p5-XML-SAX-0.99_2

===>>> p5-XML-SAX-Base-1.09

===>>> p5-XML-SAX-Writer-0.56

===>>> p5-libwww-6.26

===>>> p5-namespace-autoclean-0.28

===>>> p5-namespace-clean-0.27

===>>> php70-7.0.16

===>>> php70-dom-7.0.16

===>>> php70-exif-7.0.16

===>>> php70-fileinfo-7.0.16

===>>> php70-filter-7.0.16

===>>> php70-gd-7.0.16

===>>> php70-iconv-7.0.16

===>>> php70-intl-7.0.16

===>>> php70-json-7.0.16

===>>> php70-mbstring-7.0.16

===>>> php70-openssl-7.0.16

===>>> php70-pdo-7.0.16

===>>> php70-pdo_mysql-7.0.16

===>>> php70-pspell-7.0.16

===>>> php70-session-7.0.16

===>>> php70-simplexml-7.0.16

===>>> php70-xml-7.0.16

===>>> php70-zip-7.0.16

===>>> pinentry-1.0.0

===>>> pinentry-tty-1.0.0

===>>> py27-Babel-2.3.4

===>>> py27-MarkupSafe-0.23_1

===>>> py27-acme-0.9.3,1

===>>> py27-cffi-1.7.0

===>>> py27-configargparse-0.11.0

===>>> py27-configobj-5.0.6_1

===>>> py27-cryptography-1.6

===>>> py27-dnspython-1.15.0

===>>> py27-enum34-1.1.6

===>>> py27-funcsigs-1.0.2

===>>> py27-gdbm-2.7.13_4

===>>> py27-idna-2.0

===>>> py27-ipaddress-1.0.17

===>>> py27-mock-1.3.0_1

===>>> py27-ndg_httpsclient-0.4.2

===>>> py27-openssl-16.0.0

===>>> py27-parsedatetime-2.1

===>>> py27-pbr-1.8.1

===>>> py27-pip-9.0.1

===>>> py27-psutil-5.0.1

===>>> py27-pyasn1-0.1.9

===>>> py27-pycparser-2.10

===>>> py27-pycrypto-2.6.1_1

===>>> py27-pyrfc3339-1.0

===>>> py27-python2-pythondialog-3.4.0

===>>> py27-pytz-2016.10,1

===>>> py27-pyzor-1.0.0

===>>> py27-requests-2.11.1

===>>> py27-setuptools-32.1.0_1

===>>> py27-six-1.10.0

===>>> py27-sqlite3-2.7.13_7

===>>> py27-werkzeug-0.11.15

===>>> py27-zope.component-4.2.2

===>>> py27-zope.event-4.1.0

===>>> py27-zope.interface-4.1.3

===>>> python2-2_3

===>>> python27-2.7.13_3

===>>> rar-5.4.0,3

===>>> razor-agents-2.84_1

===>>> readline-6.3.8_1

===>>> rsync-3.1.2_6

===>>> sdocbook-xml-1.1_2,2

===>>> spamassassin-3.4.1_9

===>>> sqlite3-3.17.0

===>>> tiff-4.0.7_1

===>>> tpm-emulator-0.7.4_1

===>>> trousers-0.3.14_1

===>>> unrar-5.40,5

===>>> w3m-0.5.3.20170102

===>>> webp-0.5.2

===>>> xmlcharent-0.3_2

===>>> 226 branch ports


===>>> Leaf ports (Have dependencies, not depended on)

===>>> amavisd-new-2.11.0_1,1

===>>> asciidoc-8.6.9_5

===>>> automake-1.15_1

===>>> awstats-7.6,1

===>>> bison-3.0.4,1

===>>> check-0.11.0

===>>> clamav-0.99.2_2

===>>> cmake-3.7.2

===>>> dovecot-pigeonhole-0.4.17

===>>> gettext-tools-0.19.8.1

===>>> git-2.12.1

===>>> help2man-1.47.4

===>>> htop-2.0.2

===>>> libtool-2.4.6

===>>> logwatch-7.4.3

===>>> mariadb55-server-5.5.54_1

===>>> nano-2.7.3

===>>> nginx-1.10.3_1,2

===>>> npm3-3.10.10_1

===>>> p5-Canary-Stability-2012

===>>> p5-Crypt-CipherSaber-1.01

===>>> p5-DateTime-Format-Mail-0.403

===>>> p5-Email-Simple-2.213

===>>> p5-Exporter-Tiny-0.044

===>>> p5-File-Copy-Recursive-0.38_1

===>>> p5-File-NFSLock-1.21_1

===>>> p5-File-ShareDir-Install-0.11

===>>> p5-HTML-Format-2.12

===>>> p5-HTML-StripScripts-Parser-1.03_1

===>>> p5-Locale-libintl-1.26

===>>> p5-MIME-EncWords-1.014.3

===>>> p5-MIME-Lite-HTML-1.24_1

===>>> p5-Module-Build-0.4220

===>>> p5-Msgcat-1.03_1

===>>> p5-Net-CIDR-0.18

===>>> p5-Net-Netmask-1.9022

===>>> p5-Net-Nslookup-2.04_1

===>>> p5-Proc-ProcessTable-0.53

===>>> p5-Template-Toolkit-2.27

===>>> p5-Term-ProgressBar-2.18

===>>> p5-Time-HiRes-1.9726_1,1

===>>> p5-Unicode-LineBreak-2017.004

===>>> p5-XML-LibXML-2.0129,1

===>>> p5-perl-ldap-0.6500

===>>> php70-bz2-7.0.16

===>>> php70-ctype-7.0.16

===>>> php70-gettext-7.0.16

===>>> php70-hash-7.0.16

===>>> php70-imap-7.0.16

===>>> php70-mcrypt-7.0.16

===>>> php70-mysqli-7.0.16

===>>> php70-zlib-7.0.16

===>>> postfix-3.1.4,1

===>>> py27-Jinja2-2.8

===>>> py27-MySQLdb-1.2.5

===>>> py27-bcrypt-0.4_2

===>>> py27-beautifulsoup-4.5.1

===>>> py27-certbot-0.9.3,1

===>>> py27-lxml-3.6.0

===>>> py27-netifaces-0.10.5

===>>> py27-pycurl-7.43.0

===>>> py27-sqlalchemy10-1.0.14

===>>> roundcube-1.2.3,1

===>>> rsnapshot-1.4.2

===>>> scons-2.5.1_1

===>>> texinfo-6.3_2,1

===>>> uwsgi-2.0.14_2

===>>> webpy-0.38

===>>> wget-1.18_2

===>>> xmlto-0.0.28

===>>> 70 leaf ports


===>>> 362 total installed ports
```


----------



## ShelLuser (Jun 1, 2017)

giantkingsquid said:


> MariaDB is installed but I cannot see MySQL installed anywhere in my list of ports below, apologies for long code block.


Portmaster is an excellent tool, but not the right tool for this job. Instead use: `pkg info -x mysql`. This would list all installed packages which names match 'mysql'. Thing is: the error you got above got triggered for a reason.



giantkingsquid said:


> If I run `make build` I get the same error as in my OP, and if I try to log using your suggestion I get an error, evidently my root environment is not the default.


First, the error you mentioned in the OP was "Shared object "libssl.so.39" not found, required by "mysql"" and I'm pretty sure that you wouldn't be getting that error because MySQL is completely unrelated to Curl.

If that redirect didn't work then it means you or something else could have changed the root shell, which is bad practice

No, in this case it means I'm an idiot: `# make build >& build.log` (from within /usr/ports/ftp/curl). Sorry about that, mistyped.

However, just to be safe: start with `echo $SHELL`, if it says csh then the above will work. If it says something else (probably sh or worse bash) then you should use: `# make build 2>&1 >build.log`.

Get us that exact error. Or maybe upload the entire file to pastebin...


----------



## giantkingsquid (Jun 1, 2017)

Output of pkg info, looks like plugins for php, perl and python?

`root@28spots:~ # pkg info -x mysql

p5-DBD-mysql-4.041

php70-mysqli-7.0.16

php70-pdo_mysql-7.0.16

py27-MySQLdb-1.2.5`

The below is the error outputted from `make build` run in the curl directory that I was referring to in my previous post:


```
configure: error: one or more libs available at link-time are not available run-time. Libs used at link-time: -lnghttp2  -lssh2 -lssh2  -lssl -lcrypto -lz -L/usr/local/lib
```

However I have since deinstalled LibreSSL and installed OpenSSL and Curl installs fine now. One problem solved I suppose. So I have started rebuilding the list of ports that depended on LibreSSL, in the (vain) hope that they'll be rebuilt depending on the freshly installed OpenSSL. This worked for the first few, Curl included. 

But, now MariaDB is having a freakout...


```
[ 62%] Building CXX object mysys/CMakeFiles/mysys.dir/my_new.cc.o

cd /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys && /usr/bin/c++  -DHAVE_CONFIG_H -I/usr/local/include -I/usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/include -I/usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -DDBUG_OFF   -fPIC -o CMakeFiles/mysys.dir/my_new.cc.o -c /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys/my_new.cc

In file included from /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys/my_new.cc:25:

In file included from /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys/mysys_priv.h:63:

/usr/local/include/mysql/psi/mysql_file.h:1370:11: error: use of undeclared identifier 'my_delete_with_symlink'

  result= my_delete_with_symlink(name, flags);

          ^

1 error generated.

*** Error code 1


Stop.

make[4]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56

*** Error code 1


Stop.

make[3]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56

*** Error code 1


Stop.

make[2]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56

*** Error code 1


Stop.

make[1]: stopped in /usr/ports/databases/mariadb55-client

*** Error code 1


Stop.

make: stopped in /usr/ports/databases/mariadb55-client
```

And I note when I look back through the print during the dependency checks that the following is still occurring. Though my hunch is that these errors will disappear when each port has been rebuilt dependent on OpenSSL.


```
===>>> Currently installed version: dovecot2-2.2.28_1

===>>> Port directory: /usr/ports/mail/dovecot2


Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

===>>> Launching 'make checksum' for mail/dovecot2 in background

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

===>>> Gathering dependency list for mail/dovecot2 from ports

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

Shared object "libssl.so.39" not found, required by "mysql"

===>>> Initial dependency check complete for mail/dovecot2
```

I'm tempted to start from scratch, but would appreciate your (continued and much appreciated help) getting mariaDB to compile.


----------



## SirDice (Jun 1, 2017)

Remove all the WANT_ entries from make.conf _except_ WANT_OPENLDAP_SASL. You need this to prevent conflicts between openldap-sasl-* and openldap-*. The others are going to cause problems. Add MySQL to  your DEFAULT_VERSIONS, the default is MySQL 5.6 and you appear to want MariaDB 5.5:

```
DEFAULT_VERSIONS+=ssl=libressl python=2.7 python2=2.7 apache=2.4 pgsql=9.5 php=7.0 mysql=5.5m
```
Python and Apache could be removed, those are the same versions as the default. But it won't hurt or cause problems if you leave them in.

Make sure you remove any mysql-* ports you happen to have installed. They're going to conflict with the mariadb-* ports.


----------



## ShelLuser (Jun 1, 2017)

giantkingsquid said:


> Output of pkg info, looks like plugins for php, perl and python?


Yes, no problems. However... Some of those plugins could be trying to pull MySQL (mysql-client) in as a dependency. And that cannot co-exist with MariaDB client.

So before you do anything on a larger scale (such as `# portmaster -a`) be sure to manually install MariaDB server and client _first_. Then any port which may have a dependency on MySQL will notice that the dependency was already satisfied by MariaDB.

But be careful, one step at a time or otherwise you're only going to make things worse. Be sure to follow up on SirDice 's comment first though.



giantkingsquid said:


> However I have since deinstalled LibreSSL and installed OpenSSL and Curl installs fine now. One problem solved I suppose.


No, you're creating more problems 

If you change a library (like above: changing your crypto engine from LibreSSL to OpenSSL) then you need to ensure that the programs which use that library also get rebuild in order for them to use it. This is not a requirement for small updates (fictional example: when upgrading from xxxSSL version 1.0 to 1.2) but it _is_ for major versions. So 1.2 to 2.0 or in your example when switching between LibreSSL and OpenSSL.

What you seem to be running into (concluded from the output) is that you changed libraries without rebuilding the programs using those (this includes other libraries!). Then you try to build (/ install) even more stuff which then b0rks on 2 accounts: it depends on libraries to link against, but if those libraries got 'invalidated' (because you changed the crypto engine for example) then this will fail. Also: if some of that stuff relies on installed software (to run/use) which in its turn also relies on the crypto libraries to be present then this will fail as well.

So first things first... MariaDB and your crypto engine sanity.

Step one: MariaDB client. My suggestion: `# portmaster -Rtf databases/mariadb55-client`.

This will take a while; what this command will do is rebuild the MariaDB client and everything it depends on, which is quite a list. This includes devel/apr1 which is a good thing because that's being used by a lot of other software.

Step two: the MariaDB server. My idea: `# portmaster databases/mariadb55-server`.

You maybe tempted to start with the server (because it would also pull in the client) but I think that might fail because the server would rely on a MySQL-based solution. Having the client installed first will ensure that this dependency is satisfied up front.

Step three: fixing the rest of your crypto engine: `# portmaster -r openssl`.

This would force the system to build OpenSSL but also every port which depends on it. Normally I'd do this first, but if you already have remnants of MySQL installed then there is a chance it would pull that it, that's why I'd try to start with MariaDB first, then the rest.

If step one fails with errors then there's an easier way to start to ensure the direct dependencies. It's a bit of a crude hack but it might work:


```
# cd /usr/ports/databases/mariadb55-client
# make clean
# make build-depends-list | sed -e 's/\/usr\/ports\///g/' > deps.list
# portmaster -f `cat deps.list`
```
You should remove deps.list when everything build without errors.


----------



## giantkingsquid (Jun 1, 2017)

Thanks very much ShelLuser and SirDice. By completing both of your suggestions I believe I'm on the right track. However I appear to be coming across a circular dependency during `portmaster -Rtf databases/mariadb55-client`.


```
===>>> mariadb55-client-5.5.54_1 >> libarchive-3.2.2,1 >> liblz4-1.7.5,1 >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua (68/36)
```

I left it go for a few minutes before ctrl+c.

I tried `portmaster -Rtf -x kyua databases/mariadb55-client` but that just caused the next dependency `devel/lutok` to go circular.

I completed the steps in post #4 in https://forums.freebsd.org/threads/54766/ but it didn't fix the problem.

Any ideas?


----------



## giantkingsquid (Jun 1, 2017)

So I managed to detour around the circular dependencies by running portmaster like this:

`portmaster -Rtf -x libarchive -x liblz4 -x kyua -x lutok -x pkgconf databases/mariadb55-client`

However right at the end of building `cmake`, which was the last one to do the crypto dragon reread it's ugly head again. This is doing my head in.


```
===>  Staging for cmake-3.8.0

===>   Generating temporary packing list

[  5%] Built target cmsys

[  7%] Built target cmsys_c

[  7%] Built target cmcompress

[ 73%] Built target CMakeLib

[ 75%] Built target CMakeServerLib

[ 80%] Built target CPackLib

[ 93%] Built target CTestLib

[ 97%] Built target ccmake

[ 98%] Built target cmake

[ 99%] Built target cpack

[100%] Built target ctest

Installing the project stripped...

Shared object "libcrypto.so.38" not found, required by "libarchive.so.13"

*** Error code 1


Stop.

make[2]: stopped in /usr/ports/devel/cmake/work/cmake-3.8.0

*** Error code 1


Stop.

make[1]: stopped in /usr/ports/devel/cmake

*** Error code 1


Stop.

make: stopped in /usr/ports/devel/cmake


===>>> make stage failed for devel/cmake

===>>> Aborting update


===>>> Update for cmake-3.7.2 failed

===>>> Aborting update
```


----------



## giantkingsquid (Jun 2, 2017)

Hi,

After mucking around last night for a while I have mostly got it fixed. The server is running now anyway.

I couldn't get it to work in the order you suggested ShelLuser, mostly becasue no matter what I did I could not (and still can not) get either mariadb55-client or mariadb55-server to build.

So I did your Step 3 first which worked fine, then  went through all of the ports that use SSL: nginx, postfix, dovecot etc, and when they failed with (or similar) 
	
	



```
Shared object "libcrypto.so.38" not found, required by "libarchive.so.13"
```
 I simply sym-linked from an existing library and changed the numerical suffix to match what the port was looking for. 
`ln -s /usr/local/lib/libcrypto.so.9 /usr/local/lib/libcrypto.so.38`

Now this seems highly dodgy to me and I'm sure it will break sooner rather than later but it did work for all of them. What does the suffix mean by the way? 

But as I alluded to before I still cannot get mariadb55-client or mariadb55-server to build. It should probably go in a another thread, please let me know if that's the case.

If I do `portmaster -r mariadb55-client` it fails with:


```
In file included from /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys/my_new.cc:25:
In file included from /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys/mysys_priv.h:63:
/usr/local/include/mysql/psi/mysql_file.h:1370:11: error: use of undeclared identifier 'my_delete_with_symlink'
  result= my_delete_with_symlink(name, flags);
          ^
1 error generated.
*** [mysys/CMakeFiles/mysys.dir/my_new.cc.o] Error code 1

make[4]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56
--- mysys/CMakeFiles/mysys.dir/ma_dyncol.c.o ---
In file included from /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys/ma_dyncol.c:29:
In file included from /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys/mysys_priv.h:63:
/usr/local/include/mysql/psi/mysql_file.h:1370:11: warning: implicit declaration of function 'my_delete_with_symlink' is invalid in C99 [-Wimplicit-function-declaration]
  result= my_delete_with_symlink(name, flags);
          ^
1 warning generated.
1 error

make[4]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56
*** [mysys/CMakeFiles/mysys.dir/all] Error code 2

make[3]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56
1 error

make[3]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56
*** [all] Error code 2

make[2]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56
1 error

make[2]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/mariadb55-client
*** Error code 1

Stop.
```

If I add `MAKE_JOBS_UNSAFE=yes` as suggested to the makefile (I assume this is what I'm meant to do with it? It doesn't actually say...) I get:


```
[ 62%] Building CXX object mysys/CMakeFiles/mysys.dir/my_new.cc.o
cd /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys && /usr/bin/c++  -DHAVE_CONFIG_H -I/usr/local/include -I/usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/include -I/usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -DDBUG_OFF   -fPIC -o CMakeFiles/mysys.dir/my_new.cc.o -c /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys/my_new.cc
In file included from /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys/my_new.cc:25:
In file included from /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/mysys/mysys_priv.h:63:
/usr/local/include/mysql/psi/mysql_file.h:1370:11: error: use of undeclared identifier 'my_delete_with_symlink'
  result= my_delete_with_symlink(name, flags);
          ^
1 error generated.
*** Error code 1

Stop.
make[4]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/databases/mariadb55-client/work/mariadb-5.5.56
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/mariadb55-client
*** Error code 1

Stop.
```

Now the fact it mentions symlinking does concern me given my reckless use of `ln -s` above, but the other 15 or so ports didn't complain, so I'm at a loss. Should i contact the maintainer?

Many thanks,

Tom


----------



## ShelLuser (Jun 2, 2017)

I'm lazy so I'm responding in sequence...



giantkingsquid said:


> ```
> ===>>> mariadb55-client-5.5.54_1 >> libarchive-3.2.2,1 >> liblz4-1.7.5,1 >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua >> devel/kyua
> ```


Yeah, sometimes that can happen, annoying. Break the operation, install the offender (in this case devel/kyua) manually and then carry on with the command. This is why -R is used: that keeps track of which Ports have already been installed.

So far, so good.



giantkingsquid said:


> However right at the end of building `cmake`, which was the last one to do the crypto dragon reread it's ugly head again. This is doing my head in.
> 
> 
> ```
> ...


In such cases fix the dependency and try again. Remember my story about libraries which got corrupted when you switched crypto engines? Here ya go   So we need to find out which Port installed libarchive.so.13 and re-install that (so build it against the right crypto library).


```
macron:/home/peter $ locate libarchive.so.13
/usr/local/lib/libarchive.so.13
/usr/local/lib/libarchive.so.13.2.2
/usr/local/lib/libarchive.so.13.3.1
macron:/home/peter $ pkg which -o /usr/local/lib/libarchive.so.13
/usr/local/lib/libarchive.so.13 was installed by package archivers/libarchive
macron:/home/peter $
```
So now your assignment: `# portmaster archivers/libarchive`, then re-install CMake again.



giantkingsquid said:


> After mucking around last night for a while I have mostly got it fixed. The server is running now anyway.


That is good to hear. Still hope my comments above can be put to good use. It may seem like a tedious event right now but seriously: never underestimate what you can learn from the experience.



giantkingsquid said:


> I couldn't get it to work in the order you suggested ShelLuser, mostly becasue no matter what I did I could not (and still can not) get either mariadb55-client or mariadb55-server to build.


Due to b0rked dependencies, I hope this post can help you fix that.



giantkingsquid said:


> So I did your Step 3 first which worked fine, then  went through all of the ports that use SSL: nginx, postfix, dovecot etc, and when they failed with (or similar)
> 
> 
> 
> ...


See above.



giantkingsquid said:


> I simply sym-linked from an existing library and changed the numerical suffix to match what the port was looking for.
> `ln -s /usr/local/lib/libcrypto.so.9 /usr/local/lib/libcrypto.so.38`
> 
> Now this seems highly dodgy to me and I'm sure it will break sooner rather than later but it did work for all of them. What does the suffix mean by the way?


May I say that I'm pleasantly surprised to see you acknowledging the 'hack' for what it is instead of thanking me for my help and move on because your problem is now "fixed"?  Yeah, this is a hack and definitely not something to rely on, but when you need a solution you do what you do to get things working   But I do suggest that you fix it, I showed you above how to do this.

Still, I have a hard time understanding where libcrypto.so.38 came from. Definitely not security/openssl (I think):


```
macron:/usr/local/lib $ pkg info -lx openssl |grep libcrypto
        /usr/local/lib/libcrypto.a
        /usr/local/lib/libcrypto.so
        /usr/local/lib/libcrypto.so.9
        /usr/local/libdata/pkgconfig/libcrypto.pc
```
Do me a favor if you will: `pkg query /usr/local/lib/libcrypto.so.38`? That should tell us something 



giantkingsquid said:


> But as I alluded to before I still cannot get mariadb55-client or mariadb55-server to build. It should probably go in a another thread, please let me know if that's the case.


That decision is really not mine to make, but considering how this problem is related to your initial problem I'd personally think it should be quite ok. Also gives readers a good look at the context.

Still, this was to be expected because from what I can tell from your posts some of those build dependencies are most likely not fixed yet. For example: devel/cmake didn't build, yet that port is a build dependency for MariaDB. That's what I usually refer to as the cascading effect. Where one problem can cause another.

No need to contact any maintainers because right now your problems are still pretty much self-inflicted.


----------



## giantkingsquid (Jun 2, 2017)

You've been far from lazy, quite the contrary actually.

I'm afraid to admit it, but I am quite enjoying the experience of learning from this. FreeBSD is a very powerful OS, if a bit tricky for a newcomer, though the handbook is excellent.

Actually, since my sym-link hackery cmake did build; the only two ports that will not build, out of 385 or something, are the two MariaDBs. As it stands now all ports have been freshly rebuilt except for mariadb55-client and mariadb55-server. Both are working, all DB reads and writes are functioning fine, I just can't build/update them which isn't ideal.

Here's what I got when I tried `pkg which` on `libcrypto.so.38`. I assume you did the same?

```
root@28spots:~ # pkg which -o /usr/local/lib/libcrypto.so.38
/usr/local/lib/libcrypto.so.38 was not found in the database
```

I tried `pkg query /usr/local/lib/libcrypto.so.38` but got back `Invalid query: query should contain a format string`, so I did `pkg query %n %v %o /usr/local/lib/libcrypto.so.38` but that returned no response. Isn't `libcrypto.so.38` a library rather than a package?

Clutching at straws I did `pkg query -F /usr/local/lib/libcrypto.so.38 %n %v %o` which returned `pkg: archive_read_open_filename(/usr/local/lib/libcrypto.so.38): Unrecognized archive format` which is most likely to do with my use of the cmd 

If I run `pkg info -lx openssl |grep libcrypto` I get the same result as you did, so not my OpenSSL either

Here are all of my `libcrypto`s, all symlinks with numerical suffixes by me for both `libcrypto` and `libssl`.


```
lrwxr-xr-x   1 root  wheel    14B Jun  1 22:32 libcrypto.so -> libcrypto.so.9
lrwxr-xr-x   1 root  wheel    29B Jun  1 22:39 libcrypto.so.38 -> /usr/local/lib/libcrypto.so.9
lrwxr-xr-x   1 root  wheel    29B Jun  1 22:35 libcrypto.so.41 -> /usr/local/lib/libcrypto.so.9
lrwxr-xr-x   1 root  wheel    29B Jun  1 22:35 libcrypto.so.43 -> /usr/local/lib/libcrypto.so.9
-rw-r--r--   1 root  wheel   2.4M Jun  1 22:32 libcrypto.so.9
```


```
root@28spots:/usr/local/lib # pkg which -o /usr/local/lib/libssl.so.9
/usr/local/lib/libssl.so.9 was installed by package security/openssl
```

And my `libssl`s

```
lrwxr-xr-x   1 root  wheel    11B Jun  1 22:32 libssl.so -> libssl.so.9
lrwxr-xr-x   1 root  wheel    26B Jun  1 22:38 libssl.so.38 -> /usr/local/lib/libssl.so.9
lrwxr-xr-x   1 root  wheel    26B Jun  1 22:38 libssl.so.39 -> /usr/local/lib/libssl.so.9
lrwxr-xr-x   1 root  wheel    26B Jun  1 22:37 libssl.so.43 -> /usr/local/lib/libssl.so.9
-rw-r--r--   1 root  wheel   469K Jun  1 22:32 libssl.so.9
```


```
root@28spots:/usr/local/lib # pkg which -o /usr/local/lib/libcrypto.so.9
/usr/local/lib/libcrypto.so.9 was installed by package security/openssl
```

I'm a bit lost, I mean neither mariadb55-client and mariadb55-server are actually complaining about any missing dependencies, but I'm assuming that the `libcrypto` or `libssl` that I have symlinked are not the right ones, so when it actually builds against it the `undeclared identifier 
'my_delete_with_symlink' result= my_delete_with_symlink(name, flags);` occurs.

But counter to this train of thought is that the other 15 ports that use `libcrypto` or `libssl` built and are working great. 

Cheers,

Tom


----------



## ShelLuser (Jun 2, 2017)

I have good news, and I got some bad news 

The good news is that you don't have to worry too much about your symlink experiment for now because you basically pointed it to the right (official) crypto library from OpenSSL.

The bad news though is that your system is kind of messed up right now   I assume this is courtesy of that mailserver panel thingie you installed. The problem being: what is going to happen when libcrypto.so.9 gets upgraded to libcrypto.so.10 (for example)? Then many of those symlinks will refuse to work and it'll be something the system can't cope with:


```
macron:/usr/local/lib $ ls -l libcrypt*
-rw-r--r--  1 root  wheel  2871232 May 28 15:07 libcrypto.a
lrwxr-xr-x  1 root  wheel       14 May 28 15:07 libcrypto.so@ -> libcrypto.so.9
-rw-r--r--  1 root  wheel  1912432 May 28 15:07 libcrypto.so.9
macron:/usr/local/lib $ pkg which ./libcrypto.so
/usr/local/lib/libcrypto.so was installed by package openssl-1.0.2k_1,1
```
As you can see the only symlink here was installed by the OpenSSL package. So the moment I upgrade then that symlink will also be dealt with.

So you may want to consider (somewhere later, when your MariaDB issues got resolved) to remove all of those manually added symlinks and rebuild the whole thing against the officially maintained ones.

But back to the MariaDB building problem.

When I study that error message I see the cause of the problem being: 
/usr/local/include/mysql/psi/mysql_file.h. Now, I'm running MySQL so the location for this file is different on my system:


```
macron:/home/peter $ locate mysql_file.h
/usr/local/include/mysql/mysql/psi/mysql_file.h
macron:/home/peter $ pkg which `locate mysql_file.h`
/usr/local/include/mysql/mysql/psi/mysql_file.h was installed by package mysql56-client-5.6.36
```
I'm positive that if you run the same kind of command (`pkg which `locate mysql_file.h``) you'll see it got installed by MariaDB.

This is a bizarre "chicken and egg" issue which I've also came across plenty of times already, most recent one with a Perl module (see this post). So basically in order to ensure that the port doesn't use its own libraries you'd start by de-installing it. I think I can hear you thinking: "_if I do that and it doesn't build then I won't be able to contact the database server anymore_", and you'd be right.

SO....  We'll first start by making a backup: `# pkg create -o /root -x mariadb`.

This will create a binary package in the /root directory for every currently installed package with 'mariadb' in its name. My assumption is that you'll now have something like /root/mariadb55-client*.txz present afterwards. In fact you should have several files there, but the client and server are most important.

Do *not* continue with the next step until you double checked the existence for those files, because the next step *will* be a bit destructive.

Don't worry too much about the destructive part, that's why we made a backup. However, don't perform the next steps when the server is being used (database will be stopped) and also mind what I said above.

So now: `cd /usr/ports/database/mariadb55-client` and then: `# make deinstall reinstall clean`.

What this does is deinstall (remove) the MariaDB client (so including that pesky mysql_file.h file), then it'll rebuild the client which then won't be influenced by this file anymore. And afterwards it re-installs it.

_If something goes wrong_: not to worry, that's why those files were made. If the client fails to build no matter what and you need to get things restarted again: `# pkg add /root/mariadb55-client*` and you should be back where you left off (be sure to use the right package name though).

(edit)

If something goes wrong with the same error then there's something funny going on, in that case I'd like the output of: `pkg which /usr/local/include/mysql/psi/mysql_file.h`.


----------



## giantkingsquid (Jun 2, 2017)

You're a legend ShelLuser! MariaDB, both client and server built without any problems and are working fine after deinstalling, reinstalling and cleaning as you suggested 

I have a few more copies of mysql_file.h floating around, but I suspect these are just some leftover working copies and shouldn't cause any concern. Note this is after the successful builds.


```
root@28spots:/usr/ports/databases/mariadb55-server # locate mysql_file.h

/usr/local/include/mysql/psi/mysql_file.h

/usr/ports/databases/mariadb55-client/work/mariadb-5.5.56/include/mysql/psi/mysql_file.h

/usr/ports/databases/mariadb55-server/work/mariadb-5.5.56/include/mysql/psi/mysql_file.h
```

Now that the MariaDB issues appear resolved I will work on sorting out those pesky symlinks. What do you suggest there? Deleting my symlinks, then doing a `make deinstall reinstall clean` on openssl and libarchive? Or something to that effect?

Many thanks, I'd buy you a  if you were located closer haha.

Tom


----------

