[Bug 291004] new port: databases/mysql-shell: MySQL Shell

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 24 Jan 2026 12:48:48 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291004

--- Comment #6 from Daniƫl van Eeden <freebsd@myname.nl> ---
I managed to build MySQL Shell on FreeBSD 15. This isn't a port yet, but it is
a step in the right direction.

% ./bin/mysqlsh --version
./bin/mysqlsh   Ver 9.6.0 for FreeBSD15.0 on amd64 - for MySQL 9.6.0 (Source
distribution)


Here are my notes:

# Sources

- https://dev.mysql.com/get/Downloads/MySQL-9.6/mysql-9.6.0.tar.gz
- https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-9.6.0-src.tar.gz

# MySQL

## Dependencies

Packages:

- cmake
- bison
- pkgconf
- protobuf

## Building

```
tar zxf mysql-9.6.0.tar.gz
cd mysql-9.6.0
mkdir bld
cd bld
cmake .. -DWITH_SSL=system -D
CMAKE_INSTALL_PREFIX=/home/dveeden/mysql-shell/mysql
make -j18 install
```

- The INSTALL file says only building the mysqlclient and mysqlxclient targets
is enough. This isn't the case
- You also need to build the libprotobuf-lite target
- You do need to install as scripts/mysql_config output is used to find things
- Building with `-DWITHOUT_SERVER=ON -DWITH_UNIT_TESTS=OFF` doesn't provide the
right libraries
- You need to add `#include <sys/stat.h>` to
`sql/server_component/mysql_file_imp.cc`

# MySQL Shell

## Dependencies

- MySQL build from source (not a package)
- cmake
- libantlr4 
- libssh (not libssh2)

## Building

```
tar zxf mysql-shell-9.6.0-src.tar.gz
cd mysql-shell-9.6.0-src
mkdir bld
cd bld
cmake .. -DMYSQL_SOURCE_DIR=/home/dveeden/mysql-shell/mysql-9.6.0
-DMYSQL_BUILD_DIR=/home/dveeden/mysql-shell/mysql-9.6.0/bld
-DBUNDLED_ANTLR_DIR=/usr/local
```

- mysqlshdk/libs/utils/logger.cc: Add include for sys/stat.h
- mysqlshdk/libs/utils/utils_file.cc: Change linux/limits.h to limits.h
- mysqlshdk/libs/utils/utils_file.cc: Change stat64 to stat on line 415, 416
- mysqlshdk/libs/ssh/ssh_tunnel_handler.cc: Add incluedes for sys/types.h,
sys/socket.h and netinet/in.h
- mysqlshdk/libs/utils/utils_general.cc: Change the code around line 251 so it
takes the other version
- mysqlshdk/libs/utils/utils_general.cc: Add elif for __FreeBSD__
- mysqlshdk/libs/utils/utils_general.cc: Add include for sys/wait.h
- mysqlshdk/libs/utils/utils_general.h: Add FREEBSD to OperatingSystem
- mysqlshdk/libs/utils/utils_net.cc: Add netinet/in.h include
- mysqlshdk/libs/utils/utils_os.cc: Remove sysinfo stuff, make it go to return
0
- mysqlshdk/libs/utils/uuid_gen.cc: Needs a cast to `(char *)` before assigning
to buf
- ext/linenoise-ng/src/linenoise.cpp: Add include for sys/stat.h
- modules/util/upgrade_checker/upgrade_check_options.cc: Change int64_t to long
long

Also note that the cmake code to find antlr4-runtime seems to have multiple
problems. 

Using relative directories for MYSQL_BUILD_DIR and MYSQL_SOURCE_DIR might not
work, so use absolute directories

-- 
You are receiving this mail because:
You are the assignee for the bug.