Need help with perl error in using DBD::mysql - 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.

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.

Load new module in Kamailio

I would like to ask, how can I load new module in Kamailio 4.1.2?
Actually, I have an issue, when I tried to compile my kamaiio.cfg
I've got error:
root#kamailio:/usr/local/# kamailio -c kamailio.cfg
loading modules under /usr/local/lib64/kamailio/modules/
0(25392) ERROR: <core> [sr_module.c:587]: load_module(): ERROR: load_module: could not find module <websocket> in </usr/local/lib64/kamailio/modules/>
0(25392) : <core> [cfg.y:3408]: yyerror_at(): parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 323, column 12-25: failed to load module
0(25392) ERROR: <core> [cfg.y:3272]: yyparse(): cfg. parser: failed to find command ws_handle_handshake
0(25392) : <core> [cfg.y:3411]: yyerror_at(): parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 1083, column 27: unknown command, missing loadmodule?
ERROR: bad config file (2 errors)
when I look physically to the /usr/local/lib64/kamailio/modules/ there is some modules, but websocket.so is missing.
So, how can I get and load module in Kamailio?
Thank you for help!
You haven't installed the module websocket. Edit modules.lst file in the source code directory and add websocket to include_modules variable. If you don't have modules.lst, just do:
make cfg
Alternative is to do:
make cfg include_modules="websocket"
By default, the build system for kamailio compiles and install only the modules that have the same dependencies as the core of the application. For websocket you need to install libunistring and openssl (libssl) devel packages.
Steps to load new module to Kamailio server. (Try if above answer is not working for you)
Check the modules is exist in the default module directly /usr/local/lib64/kamailio/modules.
If found, add loadmodule "module_name.so" in load module section in kamailio.cfg file.
If the module is not found in default module directory, you can check for the source code of that module in the default module source code directory /usr/local/src/kamailio-4.4/kamailio/modules.
If source code found, enter to the module directory. Then create modules' shared object file(.so) by following commands.
./configure
make
make test
make install
Then you will get a shared object file(.so). Copy that file into the default module directory. and load this module from the kamailio.cfg file as mentioned in step 1.
If module source code does not exist in the default source code directory, You need to download the source code from the web. And follow step 3 and 4.

mysql error for module DBD::mysql: libmysqlclient.so.15:

i am using mysql for orthomcl software. when i use the command
orthomclLoadBlast my_orthomcl/orthomcl.config my_orthomcl/similarSequence.txt
it gives this error
Can't load '/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.15: cannot open shared object file: No such file or directory at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230, line 5. at /storage/home/cdac/OrthoMCL/orthomclSoftwarev2.0.8/bin/../lib/perl/OrthoMCLEngine/Main/Base.pm line48
Compilation failed in require at /storage/home/cdac/OrthoMCL/orthomclSoftware-v2.0.8/bin/../lib/perl/OrthoMCLEngine/Main/Base.pm line 48, <F> line 5.
How to solve this problem ??
You could install a local perl in your home and you could leave vendor perl untouched.
You could use perlbrew or local::lib to maintain an up to date perl version without modifying the system installed perl.

Need help with perl error in using DBD::mysql [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
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. It comes with the mysqlclient package on some distributions.
Also, Make sure /etc/ld.so.conf contains /usr/local/mysql/lib/mysql and /usr/local/mysql/ . If not, add them and run ldconfig.