DBD::mysql error in ActivePerl 5.28 on Windws10 64bits, Can't load mysql.dll - mysql

I'm having an issue with the DBD::mysql module. This question has been asked before on this forum but a solution was not posted so I thought I would repost it. Sorry if this is not appropriate for this forum. This is my first post.
You can find the original post from bLIGU here:
Error using perl module DBD::mysql in ActivePerl 5.28 on Windws10 64bits
I have the exact same problem. I'm just upgrading my Active Perl version. Nothing else changed. I'm running the same MySql server version and this script ran fine before the update and it runs fine if I go back to version 5.20.2.2002 and use PPM to download the packages.
Note that ActiveState now requires you to build a custom version of ActivePerl with the modules online and generates an install file for you. PPM is no longer supported.
Here's the error:
install_driver(mysql) failed: Can't load 'C:/Perl64/site/lib/auto/DBD/mysql/mysql.dll' for module DBD::mysql: load_file:The specified module could not be found at C:/Perl64/lib/DynaLoader.pm line 193.
at (eval 11) line 3.
Compilation failed in require at (eval 11) line 3.
Perhaps a required shared library or dll isn't installed where expected
at C:\E22_TE~1\ICTDEV~1\Scripts\UPDATE~1.PL line 136.strong text
The file C:/Perl64/site/lib/auto/DBD/mysql/mysql.dll is present so I'm wondering if the DLL is trying to load something else and returns an error.

Related

unable to install any pkg in Octave

I am new to Octave, coming from Matlab. I am trying to install a few packages, and so far none has worked. I have tried the download method from forge, then running the install command. But my question is about my latest attempt. There it is:
pkg install -global -forge io
csvconcat.cc:79:37: warning: result of comparison of constant 18446744073709551615 with expression of type
'unsigned int' is always true [-Wtautological-constant-out-of-range-compare]
while ((pos=str.find(prot, pos)) != str.npos) {
~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
1 warning generated.
error: couldn't append to /Applications/Octave-4.4.1.app/Contents/Resources/usr/Cellar/octave-octave-app#4.4.1/4.4.1/share/octave/octave_packages
save: unable to open output file '/Applications/Octave-4.4.1.app/Contents/Resources/usr/Cellar/octave-octave-app#4.4.1/4.4.1/share/octave/octave_packages'
error: called from
install at line 254 column 7
pkg at line 437 column 9
Couldn't find any documentation on it, I am a bit lost.... (oh and btw, I can't find the config.log file! where is that gem?)
I am on MacOS catalina 10.15.7, and just followed that procedure https://flaviocopes.com/fix-xcrun-error-invalid-active-developer-path/, which solved the issues I had before which is described on that page.
cheers for any help
The error:
error: couldn't append to /Applications/Octave-4.4.1.app/Contents/Resources/usr/Cellar/octave-octave-app#4.4.1/4.4.1/share/octave/octave_packages
save: unable to open output file '/Applications/Octave-4.4.1.app/Contents/Resources/usr/Cellar/octave-octave-app#4.4.1/4.4.1/share/octave/octave_packages'
error: called from
install at line 254 column 7
pkg at line 437 column 9
basically says it's failing to save to that file. Probably a permissions issue. Check if the file /Applications/Octave-4.4.1.app/Contents/Resources/usr/Cellar/octave-octave-app#4.4.1/4.4.1/share/octave/octave_packages exists and its permissions. That file is a database of all packages installed globally, i.e., for all users in the system.
Fixing the permission issues is dependent on what is the permissions issue you have (probably you need to run octave as root to install a global package). But maybe try to install the package for your user only, i.e., install the package without the -global flag, like so:
pkg install -forge io

How can I check if a Perl module (DBD::mysql) is properly installed?

I am using XAMPP on Mac OS X Yosemite, and I am trying to communicate with my MySQL database using Perl.
This requires two things: (1) DBI and (2) the mysql driver module, DBD::mysql.
I ran into a lot of trouble installing the DBD::mysql portion. However, after following some instructions online, it now looks like DBD::mysql is installed, but I am skeptical that it has correctly.
In Terminal, when I load up cpan and then type "install DBD::mysql", it responds, "DBD::mysql is up to date (4.032)".
From the looks of it, then, it is installed. However, I am worried that what I've installed is enough for it to say, "Hey, I am installed!", but not enough for it to actually be functional, which would be why I'm having errors show up when I try to connect to my database with Perl:
install_driver(mysql) failed: Can't load '/Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Reason: image not found at /System/Library/Perl/5.18/darwin-thread-multi-2level/DynaLoader.pm line 194.
at (eval 6) line 3.
Compilation failed in require at (eval 6) line 3.
Perhaps a required shared library or dll isn't installed where expected
at login.pl line 9.
Relevant Perl code snippet:
my $dbh = DBI->connect(
"dbi:mysql:dbname=TEST",
"root",
"",
{ RaiseError => 1 },
) or die $DBI::errstr;
I am trying to troubleshoot whether this is a problem with my installation of DBD::mysql, or if it is my Perl code.
How can I verify whether my installation of DBD::mysql is all good? Better yet, how can I stop getting this error?
Thank you.
You could wrap the connect() call into an eval block to catch this error, however you don't have many options left if it crashes, probably just to try and produce a more user-friendly error messsage and then die anyway.
As for why you are getting the error, try checking where libmysqlclient.18.dylib lives on your system. It seems like it was somewhere where it could be found during compilation of the DBD::mysql driver but not during your script's runtime. Assuming it hasn't been accidentially uninstalled, adding its directory to the DYLD_LIBRARY_PATH variable should work. I don't know what config to add the path to to make that addition permanent on OSX though.

Failed to build libmysql on windows using vc2008

I want to build libmysql.dll, so I got source code mysql-connector-c-6.1.6-src.zip from http://dev.mysql.com/downloads/connector/c/.
Then cmake-gui.exe to configure and generate vc 2008 sln, leave all settings default.
Then got errors and warnings when building, like this:
mysql-connector-c-6.1.6-src\include\thr_cond.h(109) : error C2065: “ETIMEDOUT”: 未声明的标识符(an unspecified identifier)
mysql-connector-c-6.1.6-src\include\thr_rwlock.h(80) : warning C4013: “TryAcquireSRWLockShared” 未定义(not defined)
mysql-connector-c-6.1.6-src\include\thr_rwlock.h(102) : warning C4013: “TryAcquireSRWLockExclusive” 未定义(not defined)
I searched the source, and find ETIMEDOUT is defined in my_pthread.h, so I include this header in thr_cond.h, but still error.
And TryAcquireSRWLockShared and TryAcquireSRWLockExclusive seem only supported on Win7 and later !
Do I have done something wrong?
How can I build libmysql?
Any help will be appreciated.
Download the previous version (6.0.2), it doesn's use the TryAcquireSRWLockShared() API function.
With a few minor tweeks, it compiles clean with MSVC 2008.
Here are the modifications (based on the extracted zip file root):
Replace line 306 of include/config-win.h with:
// avoid annoying warning
#ifndef HAVE_COMPRESS
# define HAVE_COMPRESS
#endif
Comment lines 350-367 of CMakeLists.txt (CPack instructions cause CMake to fail)
Follow instructions in BUILD.win

error installing octcdf-1.1.5

I Have in my Mac:
Octave-3.4.0
Gnuplot 4.2 - that I had to install because I had problems plotting - it wouldn't plot at all.
I need to load a netcdf file, the error that came was:
nc = netcdf('/users/matheuscortezi/Desktop/Pcse005/ocean_avg.nc', 'r')
error: `netcdf' undefined near line 9 column 6
So I think I don't have the netcdf comand installed, and tried installing by typing this on octave:
pkg install -global -forge octcdf
The error message that I receive from that is:
configure: error: in `/var/tmp/oct-t8XcYD/octcdf/src':
configure: error: C compiler cannot create executables
See `config.log' for more details.
the configure script returned the following error: checking for gcc... /usr/bin/gcc-4.2
checking whether the C compiler works... no
error: called from `pkg>configure_make' in file /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/pkg/pkg.m near line 1325, column 9
error: called from:
error: /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/pkg/pkg.m at line 783, column 5
error: /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/pkg/pkg.m at line 354, column 9
I haven't the faintest idea about what I should do. How can I solve this problem with either:
fixing this error, or
installing a netcdf "comand pack" (i don't know the name for that) so I can use netcdf() as in the example given.
Hope I was clear enough.
It seems to me that you installed Octave from the Mac OSX App bundle. That is not recommended at all. You should install from one of the package managers as explained on Octave's wiki. As far as I know, there are 3 options for Mac (see previous link). Just search for one that also has the netcdf package.
Anyway, if you really don't want to install it through a package manager (but seems to me you really should), seems that your problem lies on gcc (the GNU C compiler). do you have it installed at all? Some packages have code in C++ or C and are also dependent on some external libraries.
EDIT using a package manager would have also solved your problem about plotting since it would install gnuplot at same time

Need help with perl error in using DBD::mysql

When I run a perl script which uses DBD::mysql , I get the error message:
install_driver(mysql) failed: Can't load '/home/y/lib/perl5/site_perl/5.8/i686-linux-64int/auto/DBD/mysql/mysql.so'
for module DBD::mysql: libmysqlclient.so.16: cannot open shared object file: No such file or directory
at /home/y/lib/perl5/5.8/i686-linux-64int/DynaLoader.pm line 230. at (eval 30) line 3
I am new to perl, but from what I understand it needs mysql.so and it knows the path.
/home/y/lib/perl5/site_perl/5.8/i686-linux-64int/auto/DBD/mysql/mysql.so is present.
Then why the problem?
The file that is missing is libmysqlclient.so.16, not mysql.so. It comes with the mysqlclient package on some distributions.
Make sure /etc/ld.so.conf contains /usr/local/mysql/lib/mysql and /usr/local/mysql/ . If not, add them and run ldconfig.