# mysql57-server won't compile on patched FreeBSD 9.3-RELEASE



## noodlefling (Jun 10, 2016)

I don't have this problem on fully patched 10.3-RELEASE installations.  I've done a `portupgrade -af` and all 660 or so other ports seem fine.

I have a feeling it's got something to do with SSL, based on some other complaints on this forum about similar issues and some error messages I've seen working on this specific problem.

I should note I've got `WITH_OPENSSL_PORT=yes` defined in my /etc/make.conf.  Commenting it out didn't seem to have any effect.

I don't know what yaSSL is, but I've seen errors in reference to it.  Sample clip from the make:


```
...
[ 68%] Building CXX object rapid/plugin/x/CMakeFiles/mysqlxtest.dir/mysqlxtest_src/mysqlxtest.cc.o
[ 68%] Building CXX object sql/CMakeFiles/binlog.dir/sql_binlog.cc.o
[ 69%] Building CXX object rapid/plugin/x/CMakeFiles/mysqlxtest.dir/mysqlxtest_src/password_hasher.cc.o
[ 69%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/handler.cc.o
/usr/ports/databases/mysql57-server/work/mysql-5.7.12/rapid/plugin/x/mysqlxtest_src/password_hasher.cc:135:3: error: use of undeclared identifier 'yaSSL'
  yaSSL::RAND_bytes((unsigned char *) buffer, SCRAMBLE_LENGTH);
  ^
1 error generated.
*** [rapid/plugin/x/CMakeFiles/mysqlxtest.dir/mysqlxtest_src/password_hasher.cc.o] Error code 1
[ 69%] Building CXX object sql/CMakeFiles/binlog.dir/rpl_filter.cc.o
[ 69%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/hostname.cc.o
...
```
Another suspicious error:

```
...
[ 74%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_alloc_error_handler.cc.o
[ 75%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_alter.cc.o
[ 75%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_alter_instance.cc.o
[ 75%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_analyse.cc.o
In file included from /usr/ports/databases/mysql57-server/work/mysql-5.7.12/sql/sql_alter_instance.cc:16:
/usr/ports/databases/mysql57-server/work/mysql-5.7.12/sql/sql_alter_instance.h:16:9: warning: 'SQL_ALTER_INSTANCE_INCLUDED' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef SQL_ALTER_INSTANCE_INCLUDED
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/databases/mysql57-server/work/mysql-5.7.12/sql/sql_alter_instance.h:17:9: note: 'SQL_ALTER_INSTNACE_INCLUDED' is defined here; did you mean 'SQL_ALTER_INSTANCE_INCLUDED'?
#define SQL_ALTER_INSTNACE_INCLUDED
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  SQL_ALTER_INSTANCE_INCLUDED
In file included from /usr/ports/databases/mysql57-server/work/mysql-5.7.12/sql/sql_admin.cc:35:
/usr/ports/databases/mysql57-server/work/mysql-5.7.12/sql/sql_alter_instance.h:16:9: warning: 'SQL_ALTER_INSTANCE_INCLUDED' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef SQL_ALTER_INSTANCE_INCLUDED
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/databases/mysql57-server/work/mysql-5.7.12/sql/sql_alter_instance.h:17:9: note: 'SQL_ALTER_INSTNACE_INCLUDED' is defined here; did you mean 'SQL_ALTER_INSTANCE_INCLUDED'?
#define SQL_ALTER_INSTNACE_INCLUDED
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  SQL_ALTER_INSTANCE_INCLUDED
1 warning generated.
[ 75%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_base.cc.o
[ 75%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_bootstrap.cc.o
[ 75%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_initialize.cc.o
1 warning generated.
[ 75%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_cache.cc.o
[ 75%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_class.cc.o
...
```
That looks like a legit typo.  I've gone into /usr/ports/databases/mysql57-server/work/mysql-5.7.12/sql/sql_alter_instance.h and changed the bad reference, but that's in a work directory and a `make clean` wipes it out, so I'm too ignorant to see if that does anything or if it's just a red herring.

When the build ultimately craps out, it looks something like this:

```
...
[ 79%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_lex.cc.o
[ 79%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_lex_hash.cc.o
[ 79%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_lex_hints.cc.o
[ 79%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/sql_hints.yy.cc.o
[ 79%] Linking CXX static library libsql_embedded.a
[ 80%] Built target sql_embedded
1 error
*** [all] Error code 2
1 error
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** [do-build] Error code 1

Stop in /usr/ports/databases/mysql57-server.
*** [stage] Error code 1

Stop in /usr/ports/databases/mysql57-server.
```
It doesn't always cease building at the same percentage.  Maybe that's some kind of threading thing? Sometimes it gets all the way up to something like 93%, but it never makes it all the way.

I did the `MAKE_JOBS_UNSAFE=yes` and it was very slow.  The final error before crash seemed to be the undeclared yaSSL thing.  I can run that again if you think it'll help.

Any suggestions?


----------



## SirDice (Jun 10, 2016)

noodlefling said:


> I should note I've got  WITH_OPENSSL_PORT=yes defined in my /etc/make.conf. Commenting it out didn't seem to have any effect.


On FreeBSD 9.x the port always builds with OpenSSL from ports. Only on 10.x and higher you can choose to use the base OpenSSL or the port (the default action is to use the OpenSSL port).


----------



## noodlefling (Jun 10, 2016)

Ah, OK.

So that's one mystery solved, thanks!


----------



## noodlefling (Jun 11, 2016)

Well, it looks like there's another security flaw with OpenSSL, so maybe when they update the port, this problem will magically disappear.

Although, that might not be too likely, since the problem seems to be with the mysql57-server port.

I'll try a bugzilla report, since even if that typo isn't the problem, it should probably be addressed.


----------



## noodlefling (Jun 14, 2016)

Haven't made any progress in bugzilla town.  The port author doesn't see the problem on his test systems.

Any suggestions for config switches to toggle that might be influencing the error?  We've got something like 660 ports, so that sort of conflict seems totally plausible.  There aren't many OpenSSL switches to mess with, and changing some of the likely ones didn't seem to have any effect.  Everything's been rebuilt a couple times now, so if the base system is working and each individual port is working, then it's most likely a configuration issue with a port that mysql57-server is dependent on, right?  Does that make sense?


----------



## kpa (Jun 14, 2016)

Take the trouble to set up ports-mgmt/synth or ports-mgmt/poudriere and see if the error can be replicated under those. It's very likely that the problem in your case is leftover files from old versions under /usr/local. The mentioned package builders avoid such problems by creating a clean environment for each of builds.


----------



## noodlefling (Jun 16, 2016)

As cool as synth looks (and I will try it out on a test server), changing horses midstream and going with a totally new package manager to deal with one grumpy port didn't make sense.

Luckily, I won't have to expand my horizons and learn anything new, because the new fix to the port to deal with the change from `WITH_OPENSSL_PORT` to `DEFAULT_VERSIONS` in /etc/make.conf seems to have magically taken care of the issue.  So that error about SSL was probably important.

The typo is still in there, but the port compiles and seems to work, so I'm willing to call it a day on this one.

As always, thanks for the help and moral support.


----------

