# Building mysql57-server from ports - fatal error: 'endian.h' file not found



## nerozero (Jul 1, 2018)

Hi, 
Trying to build databases/mysql57-server, all settings - default, stuck on error: 


```
ion -Wno-unused-private-field
-- CMAKE_C_LINK_FLAGS:
-- CMAKE_CXX_LINK_FLAGS:
-- CMAKE_C_FLAGS_RELEASE: -O2 -pipe -march=native  -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELEASE: -O2 -pipe -march=native -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -DDBUG_OFF
-- Configuring incomplete, errors occurred!
See also "/usr/ports/databases/mysql57-client/work/.build/CMakeFiles/CMakeOutput.log".
See also "/usr/ports/databases/mysql57-client/work/.build/CMakeFiles/CMakeError.log".
*** Error code 1
```

errors in CMakeError.log:

```
Source:
Building C object CMakeFiles/cmTC_dadbc.dir/HAVE_ENDIAN_H.c.o
/usr/bin/cc -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/local/include/editline  -O2 -pipe -march=native  -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement    -o CMakeFiles/cmTC_dadbc.dir/HAVE_ENDIAN_H.c.o   -c /usr/ports/databases/mysql57-client/work/.build/CMakeFiles/CheckIncludeFiles/HAVE_ENDIAN_H.c
/usr/ports/databases/mysql57-client/work/.build/CMakeFiles/CheckIncludeFiles/HAVE_ENDIAN_H.c:2:10: fatal error: 'endian.h' file not found
#include <endian.h>
         ^~~~~~~~~~
1 error generated.
gmake[5]: *** [CMakeFiles/cmTC_dadbc.dir/build.make:66: CMakeFiles/cmTC_dadbc.dir/HAVE_ENDIAN_H.c.o] Error 1
gmake[5]: Leaving directory '/usr/ports/databases/mysql57-client/work/.build/CMakeFiles/CMakeTmp'
gmake[4]: *** [Makefile:126: cmTC_dadbc/fast] Error 2
gmake[4]: Leaving directory '/usr/ports/databases/mysql57-client/work/.build/CMakeFiles/CMakeTmp'

Source:
/* */
#include <endian.h>


int main(void){return 0;}
```


----------



## ShelLuser (Jul 1, 2018)

What FreeBSD version?

Generally speaking though problems like these are often caused by build dependencies which aren't in check. Not always, but often. When I have issues with building a port the first thing I usually do is re-building the direct dependencies: `portmaster `make build-depends-list | cut -d '/' -f 4-` |& tee build.log`, stuff like that. 

hope this can help.


----------



## nerozero (Jul 1, 2018)

ShelLuser,
Thank you so much for quick response! 
Version: FreeBSD srv1 11.1-RELEASE-p10 FreeBSD 11.1-RELEASE-p10 #0: Tue May  8 05:21:56 UTC 2018

Build in progress - it might take a while ... 

Thank you


----------



## nerozero (Jul 1, 2018)

It worked! 
Thanks !


----------



## fugee279 (Jan 10, 2019)

ShelLuser said:


> What FreeBSD version?
> 
> Generally speaking though problems like these are often caused by build dependencies which aren't in check. Not always, but often. When I have issues with building a port the first thing I usually do is re-building the direct dependencies: `portmaster `make build-depends-list | cut -d '/' -f 4-` |& tee build.log`, stuff like that.
> 
> hope this can help.



I have the same problem but that didn't work for me 
make: "/usr/ports/databases/mysql57-client/../mysql57-server/Makefile" line 1: Need an operator


----------



## SirDice (Jan 10, 2019)

Does /etc/make.conf exist? If so, what does it contain?


----------



## fugee279 (Jan 10, 2019)

SirDice said:


> Does /etc/make.conf exist? If so, what does it contain?


yes, contents below

```
DEFAULT_VERSIONS+=ssl=openssl
```


----------



## SirDice (Jan 10, 2019)

Ok, that's fine. That setting shouldn't be a problem. What's the exact command you used to build it?


----------



## fugee279 (Jan 10, 2019)

SirDice said:


> Ok, that's fine. That setting shouldn't be a problem. What's the exact command you used to build it?


make install clean


----------



## SirDice (Jan 10, 2019)

Are you sure you're using FreeBSD's make(1) and not GNU's devel/gmake?


----------



## fugee279 (Jan 10, 2019)

SirDice said:


> Are you sure you're using FreeBSD's make(1) and not GNU's devel/gmake?


I'm only sure of the command I used `make install clean`


----------



## SirDice (Jan 10, 2019)

I'm trying to find an easy way to check but can't find anything on short notice. So lets have a look at something obvious, what's the first line of /usr/ports/databases/mysql57-server/Makefile? It's giving an error about it and I'm wondering why, the first line should be a remark:

```
# Created by: Mahdi Mokhtari <mokhi64@gmail.com>
```


----------



## fugee279 (Jan 10, 2019)

SirDice said:


> I'm trying to find an easy way to check but can't find anything on short notice. So lets have a look at something obvious, what's the first line of /usr/ports/databases/mysql57-server/Makefile? It's giving an error about it and I'm wondering why, the first line should be a remark:
> 
> ```
> # Created by: Mahdi Mokhtari <mo****@gmail.com>
> ```


# Created by: Mahdi Mokhtari <mo****@gmail.com>


----------



## fugee279 (Jan 10, 2019)

I think lines not commented would be more suspect


----------



## SirDice (Jan 10, 2019)

That's a good one, it might be counting from the first "real" line and skip all the remarks/empty lines.  In that case it should be:

```
PORTNAME?=       mysql
```


----------



## fugee279 (Jan 10, 2019)

SirDice said:


> That's a good one, it might be counting from the first "real" line and skip all the remarks/empty lines.  In that case it should be:
> 
> ```
> PORTNAME?=       mysql
> ```


PORTNAME?=      mysql


----------



## SirDice (Jan 10, 2019)

Well, I'm out of ideas. The only thing I can think of now is a broken/bad ports tree. If you use portsnap(8) you might want to try doing `portsnap extract` to get a fresh, clean, copy again.


----------



## fugee279 (Jan 10, 2019)

I got past that somehow, back to the original error
https://gist.github.com/mices/12cf01ecc985231b8396e021bfb865df


----------



## fugee279 (Jan 10, 2019)

SirDice said:


> Well, I'm out of ideas. The only thing I can think of now is a broken/bad ports tree. If you use portsnap(8) you might want to try doing `portsnap extract` to get a fresh, clean, copy again.


Tried that I deleted the whole tree and ran portsnap fetch and portsnap extract


----------



## fugee279 (Jan 10, 2019)

Should I try running the portmaster command again?


----------



## SirDice (Jan 10, 2019)

Is there any particular reason to use ports? If you're fine with the default options why not use the packages instead?


----------



## fugee279 (Jan 10, 2019)

It's installing from ports now The next time I tried the command you posted above it worked and ran for a long time and installed mysql57-client (and deps I guess?) I'll post back when install finishes


----------



## fugee279 (Jan 10, 2019)

SirDice said:


> Is there any particular reason to use ports? If you're fine with the default options why not use the packages instead?


It installed but when i try to start the server `/usr/local/etc/rc.d/mysql-server start` it says starting mysql but then I can't connect 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
that error means the server's not running and `ps auxw|grep mysql` doesn't show any running processes


----------



## fugee279 (Jan 10, 2019)

pkg gives me the same result


----------



## Vull (Jan 10, 2019)

Why are people installing mysql57-server and not mysql80-server? Just curious.


----------



## SirDice (Jan 11, 2019)

Vull said:


> Why are people installing mysql57-server and not mysql80-server? Just curious.


Why are people install MySQL at all? Why not MariaDB? Or PostgreSQL? Probably for the same reason a lot of MySQL 5.5 installations still exist today.


----------



## SirDice (Jan 11, 2019)

fugee279 said:


> It installed but when i try to start the server `/usr/local/etc/rc.d/mysql-server start` it says starting mysql but then I can't connect
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
> that error means the server's not running and `ps auxw|grep mysql` doesn't show any running processes


Look in /var/db/mysql/$(hostname).err for clues why it's not working.


----------



## Vull (Jan 11, 2019)

SirDice said:


> Why are people install MySQL at all? Why not MariaDB? Or PostgreSQL? Probably for the same reason a lot of MySQL 5.5 installations still exist today.


I was wondering if maybe something was wrong with version 8.0, since people seem to be avoiding it. Or if maybe people are using version 5.7 because some other software depends on that specific version.

I used to use MySQL because SMF forums software and Wordpress were dependent on it, and also because available ISP hosting services were providing it, but not providing any other databases. When I tested it against PostgreSQL it was immediately noticeable that MySQL was much much slower. And so, after Oracle bought Sun Microsystems, since I  wasn't working on SMF or Wordpress anymore, I quit using MySQL completely. MariaDB sounds interesting but I haven't ever tried it because Postgres seems so solid, and it does everything I need.


----------



## SirDice (Jan 11, 2019)

Vull said:


> I was wondering if maybe something was wrong with version 8.0, since people seem to be avoiding it. Or if maybe people are using version 5.7 because some other software depends on that specific version.


Probably the main reason why people have 5.7, at least on FreeBSD, is because it's the default.


----------

