Failed to link to module 'rlm_python': rlm_python.so - freeradius

I was trying to create a python authentication for freeradius 3.0.8. I followed this example. But when I'm trying to start freeradius in debug mode using command radiusd -X It shows following error.
/usr/local/etc/raddb/mods-enabled/python[9]: Failed to link to module 'rlm_python': rlm_python.so: cannot open shared object file: No such file or directory
I looked /usr/local/lib/ folder and found that rlm_python module is not there. How can I add that module? My python module inside /raddb/mods-available/ is as follows.
python {
module = example
mod_authorize = ${.module}
func_authorize = authorize
}
Appreciate any help.

rlm_python isn't always packaged depending on the distribution.
Basic build instructions can be found here: http://wiki.freeradius.org/building/Home
You will also need to have installed the python-dev/python-devel package on your system. If python still doesn't work you may need to specify the path to the python binary manually by passing it to configure e.g. ./configure --with-rlm-python-bin=/usr/bin/python2.7.
If you just wan to verify the configure scripts have picked up python cd src/modules/rlm_python; ./configure
On my system (macOS 10.11.6) the output when python is found is:
checking for gcc... /usr/local/opt/llvm/bin/clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/local/opt/llvm/bin/clang accepts -g... yes
checking for /usr/local/opt/llvm/bin/clang option to accept ISO C89... none needed
checking how to run the C preprocessor... /usr/local/opt/llvm/bin/clang -E
checking for python2.7... python2.7
configure: Python sys.prefix "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7"
configure: Python sys.exec_prefix "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7"
configure: Python sys.version "2.7"
configure: Python local_mod_libs ""
configure: Python base_mod_libs ""
configure: Python other_libs "-u _PyMac_Error $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) -ldl -framework CoreFoundation"
checking for Python.h in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7/... yes
checking for Py_Initialize in -lpython2.7 in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config... yes
configure: creating ./config.status
config.status: creating all.mk
Once the configure script find the python binary, it'll generally all "just work", as it can then get compilation and linking flags from python itself.

Related

How to pass a custom script to ./configure to be run after the compiling?

I'm trying to build the Tor project in my jailbroken iOS device. I cloned the Git repository, and ran autogen.sh. Next, I ran ./configure, and a C compiler was not found. So I ran this instead (after installing Clang, Theos Dependencies, etc. from the repos):
./configure CC="clang --isysroot /var/mobile/theos/sdks/iPhoneOS11.2.sdk"
Now it says that it can't run the C compiled program:
PoisonImy:~/tor mobile$ ./configure CC="clang -isysroot /var/mobile/theos/sdks/iPhoneOS11.2.sdk"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... no
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... clang -isysroot /var/mobile/theos/sdks/iPhoneOS11.2.sdk
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/var/mobile/tor':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
This is because of the "Killed: 9" error I got earlier when I compiled a hello world program using Clang and attempted to run it. I fixed it by using 'ldid -SEntitlements.plist a.out', with the Entitlements.plist file in here.
Is there any way to instruct the configure script (or clang) to do the same?
EDIT: Maybe making a shell script that runs clang and ldid, and then passing that to the configure script? I'll try this one. I'm new to shell scripting so I have no idea how to approach this problem.
Done. Here's the script I used:
#!/bin/bash
ALL="$*"
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-o)
OUTPUT="$2"
shift
shift
;;
*)
shift
;;
esac
done
clang -isysroot /var/mobile/theos/sdks/iPhoneOS11.2.sdk ${ALL}
ldid -S/var/mobile/Entitlements.plist ${OUTPUT}
I saved it as 'compiler.sh', made it executable, and put it in my PATH. And then I used that for my compiler in the configure script. You may need to adjust the SDK directory and Entitlements.plist directory on your own.

Building Gktmm 3.91 from source using gcc 7

OS : Ubuntu 16.04 LTS
Compiler : Gcc7.2
I want to add Gtkmm3.9 as a third party dependency for one of my project and I try to compile from the source. I'm not familiar with autoconf or automake toolset.
Going through the documentation https://developer.gnome.org/anjuta-build-tutorial/stable/create-autotools.html.en I've found that you can autogen.sh to generate configure file. But the project is not able to configure and hence cannot generate any make files too.
Gtkmm/gtkmm-3.91.2$ sh autogen.sh
autogen.sh: 5: autogen.sh: mm-common-prepare: not found
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --warnings=all -I build
${ACLOCAL_FLAGS}
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build'.
libtoolize: copying file 'build/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build'.
libtoolize: copying file 'build/libtool.m4'
libtoolize: copying file 'build/ltoptions.m4'
libtoolize: copying file 'build/ltsugar.m4'
libtoolize: copying file 'build/ltversion.m4'
libtoolize: copying file 'build/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force --warnings=all
autoreconf: running: /usr/bin/autoheader --force --warnings=all
autoreconf: running: automake --add-missing --copy --force-missing --
warnings=all
configure.ac:51: installing 'build/compile'
configure.ac:51: installing 'build/config.guess'
configure.ac:51: installing 'build/config.sub'
configure.ac:28: installing 'build/install-sh'
configure.ac:28: installing 'build/missing'
Makefile.am:26: error: ENABLE_DOCUMENTATION does not appear in
AM_CONDITIONAL
automake: error: cannot open < build/dist-changelog.am: No such file or directory
autoreconf: automake failed with exit status: 1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '1000' is supported by ustar format... yes
checking whether GID '1000' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... yes
./configure: line 3211: syntax error near unexpected token `0.9.10'
./configure: line 3211: `MM_PREREQ(0.9.10)'
I want to use C++17 and it seems modern C++ is supported after Gtkmm 3.81 as a parallel build to already existing Gtk3. I cannot find any ubuntu prebuilt packages for Gtkmm3.81.
Does the Gtkmm3.9 repository contains all the dependencies within its repository.
Can that be used with C++17 (I use gcc7.2 compiler)
I cannot compile any programs with old Gtkmm3 with C++17 as there are some removed functions in the header.
I intend to use the library with C++17. More interested in the building the library ourselves.Any build instructions would be very helpful too.
Thanks Johny

How can I install ImageMagick in Fedora 26 / Lampp?

I am using Fedora 26 with Lampp(Xampp) version (PhP)5.6.31 and I 'm trying to install ImageMagick through a terminal command like this:
sudo /opt/lampp/bin/pecl install imagick
I am getting this result:
Downloading imagick-3.4.3.tgz ...
Starting to download imagick-3.4.3.tgz (245,410 bytes)
...................................................done: 245,410 bytes
19 source files, building
running: phpize
grep: /opt/lampp/include/php/main/php.h: No such file or directory
grep: /opt/lampp/include/php/Zend/zend_modules.h: No such file or directory
grep: /opt/lampp/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Please provide the prefix of Imagemagick installation [autodetect] :
building in /tmp/pear/temp/pear-build-margaritisyJF8eL/imagick-3.4.3
running: /tmp/pear/temp/imagick/configure --with-php-config=/opt/lampp/bin/php-config --with-imagick
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /opt/lampp
checking for PHP includes... -I/opt/lampp/include/php -I/opt/lampp/include/php/main -I/opt/lampp/include/php/TSRM -I/opt/lampp/include/php/Zend -I/opt/lampp/include/php/ext -I/opt/lampp/include/php/ext/date/lib
checking for PHP extension directory... /opt/lampp/lib/php/extensions/no-debug-non-zts-20131226
checking for PHP installed headers prefix... /opt/lampp/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable the imagick extension... yes, shared
checking for pkg-config... /bin/pkg-config
checking ImageMagick MagickWand API configuration program... checking Testing /usr/local/bin/MagickWand-config... Doesn't exist
checking Testing /usr/bin/MagickWand-config... Doesn't exist
checking Testing /usr/sbin/bin/MagickWand-config... Doesn't exist
checking Testing /opt/bin/MagickWand-config... Doesn't exist
checking Testing /opt/local/bin/MagickWand-config... Doesn't exist
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
ERROR: `/tmp/pear/temp/imagick/configure --with-php-config=/opt/lampp/bin/php-config --with-imagick' failed
As those are my first steps in Linux world, could anyone help me by giving me step-by-step instructions on how I can make ImageMagick extension work under my lampp ??
Thanks in advance for your help
Looks like you are building your own PHP rather than using the system one, but want to use the system PHP. Like so many other answers here, the problem is that you need to have the corresponding devel packages installed. In your case, that's ImageMagick-devel. You can look for lines like:
checking Testing /usr/bin/MagickWand-config... Doesn't exist
and then run sudo dnf install /usr/bin/MagickWand-config to pull in the needed packages. (And it looks from the earlier warning before the error that you also want sudo dnf install re2c.)

How to force armadillo library to link to local OpenBLAS during compilation

I need to have armadillo (current version is 5.100.1) available as a local library within $HOME (cluster application, and can't install on every compute node, but $HOME is shared folder). I'm using cmake to manage the application, and have been able to get cmake to link to local libraries in $HOME (e.g., boost) rather than elsewhere just fine. Armadillo needs BLAS and LAPACK, although it can use (and in fact advises as such) OpenBLAS for both. However, I don't understand how to force armadillo to use OpenBLAS even when its own cmake .configure confirms that it has found OpenBLAS. Here is the output from running ./configure on a pristine armadillo folder:
$ ./configure
-- Configuring Armadillo 5.100.1
-- CMAKE_SYSTEM_NAME = Linux
-- CMAKE_CXX_COMPILER_ID = GNU
-- CMAKE_CXX_COMPILER_VERSION = 4.9.1
-- CMAKE_COMPILER_IS_GNUCXX = 1
-- Found MKL libraries: /opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_rt.so
-- Found OpenBLAS: /home/rolf/lib/libopenblas.so
-- Found BLAS: /usr/lib64/libblas.so
-- Found LAPACK: /usr/lib64/liblapack.so
-- MKL_FOUND = YES
-- ACMLMP_FOUND = NO
-- ACML_FOUND = NO
-- OpenBLAS_FOUND = YES
-- ATLAS_FOUND = NO
-- BLAS_FOUND = YES
-- LAPACK_FOUND = YES
--
-- *** If the MKL or ACML libraries are installed in non-standard locations such as
-- *** /opt/intel/mkl, /opt/intel/composerxe/, /usr/local/intel/mkl
-- *** make sure the run-time linker can find them.
-- *** On Linux systems this can be done by editing /etc/ld.so.conf
-- *** or modifying the LD_LIBRARY_PATH environment variable.
--
-- *** On systems with SELinux enabled (eg. Fedora, RHEL),
-- *** you may need to change the SELinux type of all MKL/ACML libraries
-- *** to fix permission problems that may occur during run-time.
-- *** See README.txt for more information
--
-- Found ARPACK: /usr/lib64/libarpack.so
-- ARPACK_FOUND = YES
-- Could not find SuperLU
-- SuperLU_FOUND = NO
--
-- *** Armadillo wrapper library will use the following libraries:
-- *** ARMA_LIBS = /opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_rt.so;/usr/lib64/libarpack.so
--
-- Detected gcc 4.8.3 or later. Added '-std=c++11' to compiler flags
-- Copying /home/rolf/work/pdefect/armadillo/include/ to /home/rolf/work/pdefect/armadillo/tmp/include/
-- Generating /home/rolf/work/pdefect/armadillo/tmp/include/config.hpp
-- Generating /home/rolf/work/pdefect/armadillo/examples/Makefile
-- CMAKE_CXX_FLAGS = -std=c++11 -O2
-- CMAKE_SHARED_LINKER_FLAGS = -Wl,--no-as-needed
-- CMAKE_REQUIRED_INCLUDES =
-- *** CMAKE_INSTALL_PREFIX was initalised by cmake to the default value of /usr/local
-- *** CMAKE_INSTALL_PREFIX changed to /usr
-- *** Detected 64 bit system
-- *** /usr/lib64/ exists, so destination directory for the run-time library changed to /usr/lib64/
-- *** Your system and/or compiler must search /usr/lib64/ during linking
-- CMAKE_INSTALL_PREFIX = /usr
-- INSTALL_LIB_DIR = /usr/lib64
-- INSTALL_INCLUDE_DIR = /usr/include
-- INSTALL_DATA_DIR = /usr/share
-- INSTALL_BIN_DIR = /usr/bin
-- Generating '/home/rolf/work/pdefect/armadillo/ArmadilloConfig.cmake'
-- Generating '/home/rolf/work/pdefect/armadillo/ArmadilloConfigVersion.cmake'
-- Generating '/home/rolf/work/pdefect/armadillo/InstallFiles/ArmadilloConfig.cmake'
-- Generating '/home/rolf/work/pdefect/armadillo/InstallFiles/ArmadilloConfigVersion.cmake'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rolf/work/pdefect/armadillo
So it succeeds in finding it in $HOME, but if I query the library's links to shared libraries after
$ cmake .
$ make
I see that it has linked to the login node's standard copies of BLAS and LAPACK, but made no use of OpenBLAS:
$ ldd libarmadillo.so.5.100.1
linux-vdso.so.1 => (0x00007fff05b9b000)
libmkl_rt.so => /opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/libmkl_rt.so (0x00007f14d2558000)
libarpack.so.2 => /home/rolf/lib/libarpack.so.2 (0x00007f14d230a000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f14d1fe9000)
libm.so.6 => /lib64/libm.so.6 (0x00007f14d1d64000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f14d1b4e000)
libc.so.6 => /lib64/libc.so.6 (0x00007f14d17ba000)
/lib64/ld-linux-x86-64.so.2 (0x0000003d83400000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f14d15b5000)
libblas.so.3 => /usr/lib64/libblas.so.3 (0x00007f14d135e000)
liblapack.so.3 => /usr/lib64/atlas/liblapack.so.3 (0x00007f14d0b3d000)
libgfortran.so.3 => /usr/lib64/libgfortran.so.3 (0x00007f14d084a000)
libf77blas.so.3 => /usr/lib64/atlas/libf77blas.so.3 (0x00007f14d062d000)
libcblas.so.3 => /usr/lib64/atlas/libcblas.so.3 (0x00007f14d040c000)
libatlas.so.3 => /usr/lib64/atlas/libatlas.so.3 (0x00007f14cfcfe000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f14cfae1000)
Unfortunately, libblas.so.3 and liblapack.so.3 are not available on the nodes:
$ ssh node01 'ldd /home/rolf/work/pdefect/armadillo/libarmadillo.so.5.100.1 | grep "not found" '
libblas.so.3 => not found
liblapack.so.3 => not found
How do I force armadillo to compile and link to my local copy of OpenBLAS, and not the standard copies of BLAS and LAPACK in /usr/lib64. There is a note in the faq that states that
* For Linux-based systems the automatic installer can figure out that
OpenBLAS, MKL, ACML or ATLAS are installed, and will use them instead of
the standard LAPACK and BLAS libraries. See README.txt within the Armadillo
archive for more information.
but from the above results, this does not seem to be the case. Can anyone point me to what I'm doing wrong here?
You can tell Armadillo to directly use whatever BLAS and LAPACK you want, as well as their location. You need to define ARMA_DONT_USE_WRAPPER before including the armadillo header, and then link with whatever BLAS and LAPACK you have.
For example:
g++ code.cpp -o code -O3 -DARMA_DONT_USE_WRAPPER -L/home/abc/libs -lmyblas -lmylapack
Substitute /home/abc/libs with the directory which has your libraries. Change -lmyblas -lmylapack to whatever library/libraries implement BLAS and LAPACK functions (for example: -lopenblas)
Bear in mind that the system linker will also need find your libraries. You may need to set the LD_LIBRARY_PATH environment variable. For example:
export LD_LIBRARY_PATH=/home/abc/libs:${LD_LIBRARY_PATH}
Alternatively, you can just link statically during compilation (see the -static switch in g++)

Erlang Build Fails: Can not link the wx driver, wx will NOT be useable

./configure returns an error message when run:
wx:Can not link the wx driver, wx will NOT be useable
When I run .\configure | grep wx, the logs are as follows:
configure: configuring in wx/.
configure: running /bin/bash '/home/nihal/Downloads/otp_src_17.1/lib/wx/./configure' --prefix=/usr/local '--prefix=/usr/local' 'ERL_TOP=/home/nihal/Downloads/otp_src_17.1' '--cache-file=/dev/null' '--srcdir=/home/nihal/Downloads/otp_src_17.1/lib' --cache-file=/dev/null --srcdir=/home/nihal/Downloads/otp_src_17.1/lib/wx/.
rm: remove write-protected regular file './CONF_INFO'?
checking for debug build of wxWidgets... checking for wx-config... /usr/bin/wx-config
checking for wxWidgets version >= 2.8.4 (--unicode --debug=yes)... yes (version 2.8.12)
checking for wxWidgets static library... no
checking for standard build of wxWidgets... checking for wx-config... (cached) /usr/bin/wx-config
checking for wxWidgets version >= 2.8.4 (--unicode --debug=no)... yes (version 2.8.12)
checking for wxWidgets static library... no
checking if wxwidgets have opengl support... yes
checking for wx/stc/stc.h... yes
checking if we can link wxwidgets programs... yes
wx : Can not link the wx driver, wx will NOT be useable
How do I successfully build it?
If you don't need wx, you can build Erlang without it with:
./configure --without-wx
If you need wx support, see instructions at Building with wxErlang section.
Check the contents of the $ERL_TOP/lib/wx/config.log file for a possible cause.
In my case, I was missing the c++ compiler. After installing g++ I was able to compile and install OTP with no further problems.
I got the same error while building erlang on CentOS 7.
I too was missing the C++ compiler.
After doing yum install gcc-c++, I was able to build erlang successfully.

Resources