TCL_LIB_SPEC missing in modules install - tcl

I'm trying to install modules from SourceForge and I'm getting an error that a variable named TCL_LIB_SPEC is not set. What is this supposed to be set to?

The answer here is to install the TCL development package
% yum install tcl-devel
This gives you a tclConfig.sh file at /usr/lib64/tcl8.5
So
% cd /usr/lib64/tcl8.5
% . ./tclConfig.sh
Then configure works.

It's supposed to be set to the instructions to use with your compiler for linking against the Tcl C library, and it should (conventionally) be generated by running the relevant configure script inside a Tcl source distribution. Or a distribution of Tcl (e.g., on Linux perhaps called tcl-dev) may have alternate correct values already set up.

Related

How to build DBD::mysql with DBI in a custom #INC?

I'm building DBI and DBD::mysql in a continuous integration build server. The build of DBI is successful, as seen in the excerpt of the build log below. It clearly installs DBI/DBD.pm in the correct location.
pushd DBI-1.643
perl Makefile.PL INSTALL_BASE=/data/pods/mysql-tools/mysql-tools/current
...
Installing /data/pods/mysql-tools/mysql-tools/current/lib/perl5/x86_64-linux-thread-multi/DBI/DBD.pm
...
Appending installation info to /data/pods/mysql-tools/mysql-tools/current/lib/perl5/x86_64-linux-thread-multi/perllocal.pod
But the next part of the build for DBD::mysql fails because it can't find the files installed by DBI.
pushd DBD-mysql-4.050
perl Makefile.PL INSTALL_BASE=/data/pods/mysql-tools/mysql-tools/current --ssl
Can't locate DBI/DBD.pm in #INC (#INC contains:
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5 .)
at Makefile.PL line 15.
You can see, MakeMaker for DBD::mysql isn't adding the install location to its #INC at all. It just has default directories.
Is there a way to pass an argument to MakeMaker to add the install directory to #INC? I suppose I could hard-code it, but that seems improper and hard to maintain. Is there a better way to automatically add INSTALL_BASE/lib/perl5/<arch> to #INC?
Environment:
CentOS 7 Linux
Perl 5.16.3
I would have preferred to use cpanm of course. But the CI build server is isolated from the internet because of my employer's security policy. No http proxying is allowed from CI.
According to the documentation, INSTALL_BASE is used for telling make install where to put the installed module:
INSTALL_BASE
INSTALL_BASE can be passed into Makefile.PL to change where your
module will be installed. INSTALL_BASE is more like what everyone else
calls "prefix" than PREFIX is.
but it does not tell perl where to look for installed modules. To do that you can use the environment variable PERL5LIB, according to the documentation :
PERL5LIB
A list of directories in which to look for Perl library files before
looking in the standard library. Any architecture-specific and
version-specific directories, such as version/archname/, version/, or
archname/ under the specified locations are automatically included if
they exist, with this lookup done at interpreter startup time. In
addition, any directories matching the entries in
$Config{inc_version_list} are added.

Perl to mysql connectivity on Windows 10

I have a process that works in the production environment, that I need to get working on my local Windows 10 environment. It is a Perl script that calls mySql stored procedures.
I have installed ActivePerl 5.26.3 (64-Bit) from Active State. When I attempt to execute the script I get an error:
Can't locate DBD/mysql.pm (you may need to install the DBD::mysql module)...
So, I went to https://metacpan.org/release/DBD-mysql and found instructions that indicated I needed to do the following:
perl -MCPAN -e shell
install DBD::mysql
But, when I type the first command I get a message stating:
It looks like you don't have a C compiler and make utility installed. Trying to install dmake and the MinGW gcc compiler using the Perl Package Manager. This may take several minutes....
Then it goes thru what appears to be a successful installation. So I type in the second command. It scrolls by for a while, but ends with:
Failed during this command
DVEEDEN/DBD-mysql-4.050.tar.gz: writemakefile NO 'C:\Perl64\bin\perl.exe MakeFile.PL INSTALLDIRS=site' returned status 512
Not sure how to proceed.
For ActivePerl, use their package manager PPM.
Or, use Strawberry Perl for a more unixy experience. It comes with all the stuff to compile and install modules.
No matter which Perl you use, on Windows or elsewhere, modules typically need to be compiled the same. Mixing compilers (such as Visual Studio and gcc) or options can lead to incompatible binaries. The same might happen across Perl versions too. That means to use the same Perl (and compilation method) for everything in your project).
The cpan utility doesn't figure out those things for you. It does whatever it's configured to do.
For what it's worth, the cpan method to install modules can be simpler:
$ cpan DBD::mysql

"Fatal error: 'EXTERN.h' file not found" while installing Perl modules

While trying to install Perl modules like JSON::XS or YAML::XS, i receive the same error:
XS.xs:1:10: fatal error: 'EXTERN.h' file not found
I use MacBook, xCode is up to date, everything else that could help is up to date too.
Since OS X El Capitan, Apple introduced System Integrity Protection which restricts writing to /usr/lib /usr/bin and other sensitive directories (even to root or sudo user) that are used by the installation of Perl bundled with the Operating System. This can cause issues when it comes to installing new modules and also if trying to install XS modules ( those linked to external C libraries ).
For this reason you should not consider the default Perl installation as a working development environment, especially if you are installing custom modules.
Check out this thread on PM and others. I had since El-Capitan managed to solve this before by manually building from tarball and adding a few params or environment variables to set the paths believing that it would be best to retain use of the system Perl but this is not the way to go. This makes your environment difficult to build but also brittle and sensitive to OS updates that may either break things in many different ways.
The best practice seems to be starting with a Perl using brew install perl and work in this environment, remembering to setup your bash_profile as directed by the installer.
Also worth remembering to do a brew link perl. If you receive warnings about this clobbering what looks like system Perl libraries don't worry - these are likely modules that were installed by you over the top and it will cause you less trouble to link over these. If you have concerns, make a note of which module installs will be cleared and re-install them once your environment is configured ( ie your module installer approach is configured using cpanm or sticking with the old perl -MCPAN -e shell etc)
This new Perl setup from brew eliminates the need to continuing running sudo which adds another layer of things that can go wrong as environment variables don't follow through and permission conflicts arise etc.
Finally to simplify package/module installation I suggest doing a brew install cpanminus. If you had previously already installed this, you can ensure the paths etc are configured by doing a brew reinstall cpanminus
If you want to take it another step further then you can install perlbrew as well which will give you the ability to run multiple versions of Perl as your user and configure these with their own libs and modules which can be very useful particularly if aligning with your production environment for testing etc.
One problem you may face if moving from system Perl to this kind of approach is needing to deal with any hangovers from installing things with sudo. It wis worth taking a little time to get all this set up right though and your issues going forward will be greatly reduced and you won't be left with that nagging feeling that you don't want to change anything for fear of it all breaking.
I have also come across a Perl Blog Article that suggests a fix for XS issues with perlbrew on Mojave
This Gist described updating your cpan shell install root though this shouldn't be necessary unless your cpan is stuck in an old config after taking steps above.
I've also raised this as a new issue on PerlMonks
After reading https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624 and installing the Additional headers via
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
I successfully compiled without the missing 'EXTERN.h' error
In order to follow the common advice I also tried with Perlbrew to install a dedicated development version of Perl. Especially with the advice in mind First, do not use the system Perl on MacOS. The installed version is for Apple, not for you (see the discussion here: https://www.perlmonks.org/?node_id=1224727).
Unfortunately, the following error occurred:
Test Summary Report
-------------------
porting/libperl.t (Wstat: 65280 Tests: 35 Failed: 0)
Non-zero exit status: 255
Parse errors: No plan found in TAP output
Files=2653, Tests=1217766, 708 wallclock secs (52.74 usr 9.40 sys + 395.38 cusr 49.90 csys = 507.42 CPU)
Result: FAIL
make: *** [test_harness] Error 1
##### Brew Failed #####
Therefore, I decided to install it the following way (and not following the advice due to the error).
Even after having the above mentioned macOS SDK headers already installed on Catalina (macOS 10.15.2) it didn't work for me. I faced the issue during the installation of the Perl module Mac-SystemDirectory-0.13. The following steps (by identifying the missing file in hope of having a more generic approach for more or less equivalent issues) did the trick:
Locate the header file (in this case EXTERN.h)
sudo find /Library -type f -name EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
Ensure the installed Perl version (here 5.18) match the header file:
perl -v | grep version
This is perl 5, version 18, subversion 4 (v5.18.4) built for darwin-thread-multi-2level
Export the path for the C-Compiler (note MacOSX10.15.sdk for Catalina and Perl Version 5.18)
export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE
Invoke the Makefile.PL with perl
perl Makefile.PL
BTW — For anybody who's still struggling with this, my workaround was:
bash% module="Sub::Util" # For example
bash% cpanm --configure-args="INC=-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" "$module"
Please try this
CPATH=$(dirname $(find /usr/local/Cellar/ -name EXTERN.h)) cpan JSON::XS
For Big Sur and perl 5.30, EXTERN.h is at /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE
I'm trying to upgrade CPAN itself and got that error. But I have /usr/bin/cpan and I can't write there so I have to tweak it to write the updated version to /usr/local/bin/cpan.
No promises, but yum install perl-devel worked for me.
As #huyz has helpfully pointed out, if you hit this error on a Mac, you don't have this option, even though this is probably your issue, and you need to follow one of the above methods of getting a version of Perl that isn't missing important chunks, as per other answers.
But if, dear reader, you hit this error on a linux host, as I did, then this might be an option for you.
Building on what E Lisse suggested, you might also have luck looking in
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/
For example:
CPATH=$(dirname $(find /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/ -name EXTERN.h)) cpan JSON::XS
You could also find where EXTERN.h is located and add that to your shell by default, e.g. in your .bashrc or .zshrc file:
export CPATH=/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/

Geant4 does not find Expat library

I'm trying to install Geant4 10.00 on Linux Mint 15. I have the unzipped geant4 file geant4.10.00.p01 in the directory I made:
/home/mickmau5/Geant4
along with the required build file geant4.10.00-build.
This site goes throught the installation process http://goo.gl/nzxpQG . I'm at the lengthy cmake command part and getting this error
mickmau5#linuxmint ~/Geant4/geant4.10.00-build $ cmake -DCMAKE_INSTALL_PREFIX=/home/mickmau5/Geant4/geant4.10.00.p01-install /home/mickmau5/Geant4/geant4.10.00.p01
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
Could NOT find EXPAT (missing: EXPAT_LIBRARY EXPAT_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindEXPAT.cmake:50 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/Modules/Geant4OptionalComponents.cmake:71 (find_package)
CMakeLists.txt:78 (include)
-- Configuring incomplete, errors occurred!
Seems like I ought to download some things.
Thanks for any help!
From the Geant4 documentation:
GEANT4_USE_SYSTEM_EXPAT (DEFAULT : ON)
If set to ON, build Geant4 with an external install of Expat. In this
case, the Expat headers and library will be searched for under the
standard system paths. If these are not sufficient to locate the
required Expat installation, see the Advanced EXPAT_INCLUDE_DIR and
EXPAT_LIBRARY options.
Whilst Expat is installed on the vast majority of systems, it may be
missing in certain instances. In these cases, simply switch this
option to OFF and Geant4 will build and use its internal version of
Expat.
REQUIRES : Expat library and headers.
I had the same problem and I could fix it by downloading the expat-devel library.
To install expat-devel package (dnf package manager):
dnf install expat-devel

Equivalent to libmysqldev FreeBSD

I have compiled a program in fedora using the mysql dev library (include mysql.h in header file). I need to compile in on FreeBSD. I do not want to download from source and compile but rather would like to download from ports or something equivalent to facilitate removing it if need be.
Does anyone know the equivalent of the libmysql-dev in FreeBSD. I have not found it in ports?
You do not need a special package for this. The standard mysql client package/port already includes the libraries and the header files you will need. The header files will end up, by
default, in /usr/local/include/mysql/ directory, while
the libraries will go to /usr/local/lib/mysql/.
So - just install a client from ports or packages, and you are set.
mysql.h is included in the mysql-client-xx port.
assuming you have a configure script or makefile you should set the LDFLAGS and CPPFLAGS environment variables to:
export LDFLAGS='-l /usr/local/lib'
export CPPFLAGS='-I /usr/local/include'
(or setenv, if using csh)
then ./configure and make as normal.
if you are compiling from the command line "gcc -o myprog mysource.c" just add the -I and -l options to your command and it should compile fine.
try: find /usr/local -iname 'mysql' to see files (headers, shared objects and binaries) you in fact have installed on your system.