Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs suggestion: Instructions for building on Windows (e.g. via github actions) #34

Open
tgross35 opened this issue Dec 9, 2022 · 6 comments

Comments

@tgross35
Copy link
Contributor

tgross35 commented Dec 9, 2022

I'm currently fighting through the best way to get libmysql available on GH actions to test with Windows, and I can't be the only one.

I've attempted installng via vcpkg which seems to be more or less what the CI here does (this is updated for powershell as gh actions now use)

$VCPKG_ROOT = "c:\projects\vcpkg"
git clone https://github.com/Microsoft/vcpkg --depth 1 $VCPKG_ROOT
& "${VCPKG_ROOT}\bootstrap-vcpkg.bat"
& "${VCPKG_ROOT}\vcpkg.exe" install libmysql

But hit the issue libmysql[core]:x86-windows is only supported on '!(windows & x86) & !uwp'

If I figure out a way around this, I will update this issue and create a PR.

Any suggestions are appreciated until then

@tgross35
Copy link
Contributor Author

tgross35 commented Dec 9, 2022

Ok, turns out gh actions already has vcpkg installed for windows. This is painfully slow so far

 echo "vcpkg root: ${VCPKG_ROOT}"
 echo "vcpkg install: ${VCPKG_INSTALLATION_ROOT}"
& c:\vcpkg\vcpkg.exe install libmysql:x64-windows

@tgross35
Copy link
Contributor Author

tgross35 commented Dec 10, 2022

It turns out that the GH image actually ships with MySQL but the linker doesn't know where to look. Setting the following environment variable works:

env:
  MYSQLCLIENT_LIB_DIR: C:\mysql\lib

Maybe it would be good to add that to the search path?

For any other windows-based build where mysql isn't preinstalled, the required libary can be downloaded from a zip:

curl -L https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.31-winx64.zip -o mysql-installer.zip

Once extracted, the DLLs/LIBs are in mysql-8.0.31-winx64\lib, and that can be set to the environment variable

@weiznich
Copy link
Collaborator

See here for diesels CI setup.

Otherwise I'm happy to merge PR's adding documentation and/or a CI configuration to this repo as well.

@tgross35
Copy link
Contributor Author

Thanks for the link. I learned that the windows images actually have mysql installed already, so the choco install isn't even needed https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md#database-tools

I will create a PR at some point to add some hints about this

@tgross35
Copy link
Contributor Author

tgross35 commented May 7, 2024

Github must have changed something. On windows-latest C:\mysql\lib doesn't exist, so the location needs to be changed:

MYSQLCLIENT_LIB_DIR: 'C:\Program Files\MySQL\MySQL Server 8.0\lib'
# will be accepted by a later Diesel version
MYSQLCLIENT_LIB_DIR_X86_64_PC_WINDOWS_MSVC: 'C:\Program Files\MySQL\MySQL Server 8.0\lib'

@grooverdan
Copy link
Contributor

Docs and CI are there now for vpkg and zip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants