Re^2: Perl XAMPP DB Connect issue (Windows/Strawberry?)
by syphilis (Archbishop) on Jan 01, 2023 at 04:41 UTC
|
Now the error message is that it cannot find "mysql.h"--a file that exists nowhere on the machine
That file and the rest of the mysql library ships with Strawberry Perl 5.32.1.
The 'mysql.h' file is in Strawberry's c/include/mysql50716 folder, the static library ('libmysql.a') is in Strawberry's c/lib folder and the shared library ('libmysql__.dll) is in Strawberry's c/bin folder.
If you're using Strawberry Perl, I recommend building against that mysql library, rather than the one that xampp provided.
After all, the mysql library that ships with the Strawberry Perl distro is the one against which Strawberry's DBD::mysql was built.
OTOH, if you're using XAMPP's perl, then you should build against the mysql library that they provided.
HTH.
(I haven't read this thread thoroughly, and I don't do databases. I concede that this post might therefore be of no help at all.)
Update:
By the way, XAMPP's version of Perl is: 5.32.1, said to be "built for MSWin32-x64-multi-thread"
If you want to check that this version of perl is compatible with Strawberry Perl 5.32.1, just run perl -V:archname using your Strawberry Perl 5.32.1.
If it reports 'MSWin32-x64-multi-thread', then they're compatible. Else, they are incompatible.
Cheers, Rob
| [reply] [d/l] |
|
|
Well, you were right about the "mysql.h" file. I found it just where you said it would be.
Now the next error in this wild goose chase is that there is no "mysqlclient.lib" and I am supposed to supply the directory where that can be found before the "make" will process. Having searched the entire hard disk (which took awhile), it is nowhere to be found.
It seems this module is pretty needy, and assumes its dependencies will be supplied by the unsuspecting client, rather than the source. I have no idea when the requirements will end, as they appear one at a time...or even if I will be able to meet all of them.
| [reply] |
Re^2: Perl XAMPP DB Connect issue (Windows/Strawberry?)
by Polyglot (Chaplain) on Jan 01, 2023 at 02:51 UTC
|
My options are nearly exhausted at this point. I have made some discoveries, some good, some not.
I downloaded Strawberry Perl, which is supposed to have DBD::mysql and all that is necessary, and found it to apparently have the identical list of libraries that came with XAMPP. So that's the bad news--XAMPP is not working out of the box with what, by all accounts online, appears to be the best possible option for getting Perl going on Windows.
The good news is that I found the DBD::mysql library tucked into a directory where I would not have expected it. It was in "C:\xampp\perl\vendor\lib\auto\".
But more bad news is coming. The file is not compatible for some reason. An error message leading back to DynaLoader.pm appears saying "Can't load 'C:/xampp/perl/vendor/lib/auto/DBD/mysql/mysql.xs.dll' for module DBD::mysql: load_file: The specified module could not be found at C:/xampp/perl/lib/DynaLoader.pm line 193."
I tried a "hail Mary"-style push of the path for the DBD module to DynaLoader's "@dl_library_path" array...to no avail, of course.
It looks like this is where the whole project dies. Is there an easy way to inline some php to handle the DB connections that I cannot do with Perl?
I'd really hate to go back to having to run a linux VM on windows just to get perl to use a database--it takes a whopping amount of space to do it this way, not to mention the added layers of complexity with accessing it via the VM.
| [reply] |
|
|
I'd really hate to go back to having to run a linux VM on windows just to get perl to use a database--it takes a whopping amount
of space to do it this way, not to mention the added layers of complexity with accessing it via the VM.
By coincidence, just the other day I installed Ubuntu on my Windows 11 laptop.
I seem to have fluked a clean Ubuntu WSL2 install with a single wsl --install command,
to install the default Ubuntu distribution of Linux from the Microsoft Store.
It required a couple of reboots IIRC.
I started with 148 GB free of 237 GB. I now have 131 GB free, i.e. Ubuntu on WSL2 took around 17 GB.
I am now happily running WSL2 Linux: Ubuntu 22.04.1 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64).
All I've done on it so far is run some basic Perl programs and compile and run some C++ programs with g++ and clang++.
It seems to be just a basic core Perl v5.34, so you'll need to install DBD/DBI and other modules from CPAN.
Update: I later built perl v5.36 from source (update: improved build perl v5.38 notes) and played around
with many Linux C++ libraries, including boost, Catch2 and Abseil.
For WSL2, I believe you must first upgrade to Windows 11 (or at least the latest version of Windows 10) --
more detail on this topic can be found at WSL2 on wikipedia or perhaps by ringing Microsoft Support.
Disclaimer: I am not an expert on this topic just throwing it out there in case it helps.
(AFAIK, the main alternative to WSL2 is to install VMware, followed by multiple different Linux distros).
References Added Later
Scrappy WSL Ubuntu Notes
Steps to Install Ubuntu on WSL2 on Windows 11:
See : How to install WSL on Windows 11
To see the version of WSL you are running (e.g. WSL2) enter the command : wsl -l -v. For example, I see:
C:\> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 2
or:
* Ubuntu Running 2
To see alternative versions:
C:\>wsl -l -o
The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.6 openSUSE Leap 15.6
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
SUSE-Linux-Enterprise-Server-15-SP6 SUSE Linux Enterprise Server 15 SP6
openSUSE-Tumbleweed openSUSE Tumbleweed
To install WSL2:
- Right click on CMD, select Run as administrator
- wsl --install -d NameofLinuxDistro (e.g. wsl --install -d ubuntu)
- wsl --install - default is to install ubuntu
Misc Notes:
Right clicking on CMD and selecting Ubuntu, starts it up with:
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.153.1-microsoft-standard-WSL2 x86_64)
TODO: upgrade to Ubuntu-24.04?
See Also
| [reply] [d/l] [select] |
|
|
If it were my computer, based on what little I know, I would have zero interest in downgrading to Windows 11. But it's not even mine.
As for using 17 GB, and still without a DBI/DBD solution, that illustrates the issue. I think I'm in about 2 GB total right now: XAMPP takes about 700 MB, plus I've had to install MSYS2: 277 MB; 7-Zip: 6 MB; plus my database itself is around 1 GB. But the main thing is (if I could get it to work--and this is the second round of trying, so far without success), it would be much easier to utilize--just browse to the local file in the browser, no muss, no fuss with starting a VM, etc.
But, alas! It looks like perl/DBI cannot work on Windows outside of a VM. Does anyone here have it running natively, sans VM?
| [reply] |
|
|
|
|
|
|
|
|
Is the Strawberry Perl c\bin directory in your path? If not then external DLLs cannot be located by the system and nothing that depends on them will work. In this case the file you refer to, mysql.xs.dll depends on libmysql__.dll. If that file is not in the path then the bindings will not work.
The .xs.dll file is also the compiled XS bindings, not the mysql DLL.
If you have downloaded a portable version of Strawberry perl, which from memory is what Chocolatey distributes, then you need to run the portableshell.bat script to set up the paths, or manually prepend them to your path. This script is at the top level of the Strawberry perl distribution.
(Edited a few minutes after posting to clarify reference to .xs.dll file.)
| [reply] [d/l] [select] |
|
|
There is no "portableshell.bat" anywhere in the xampp directory tree. The only thing "portable" is a "Portable.pm" in the "C:\xampp\perl\vendor\lib\" and "C:\xampp\perl\vendor\lib\CPAN\Mini\" directories -- the former having 6,643 bytes as compared to the 388 bytes of the latter. I doubt they are what is needed.
| [reply] |
|
|
|
|
| [reply] [d/l] |