Unable to build SWIG.exe using MinGw - python

I am trying to install 'pocketsphinx' module in python which requires swig.exe. After a lot of searching I followed the steps mentioned in the swig site(http://www.swig.org/Doc3.0/Windows.html#Windows_swig_exe) to build an exe. But I am stuck at the last 2 steps.
When './autogen.sh' is executed, I get the following error message although the file 'aclocal' is present in the '/mingw/bin' directory.
vinay#DESKTOP-7LB2J5M /usr/src/swig
$ ./autogen.sh
+ test -d Tools/config
+ aclocal -I Tools/config
./autogen.sh: /mingw/bin/aclocal: No such file or directory
I renamed c:\MinGW\msys\1.0\etc\fstab.sample to c:\MinGW\msys\1.0\etc\fstab and also installed automake, libtool, autoconf, aclocal, autoheader dependencies from MinGW installation manager. What am I missing?
I am not familiar with MinGw or unix commands.

Related

ta-lib replit python install problem, ERROR: No matching distribution found for talib-binary

I use it on my windows machine by downloading its binary. I also use it in Heroku from its herokus build pack. I don't know what operating system replit use. But I try every possible commed like.
!pip install ta-lib
!pip install talib-binary
It's not working with replit. I thought it work like google co-lab but its not the same.
can anyone use TA-LIB with replit. if so. How you install it?
Getting TA-Lib work on Replit
(by installing it from sources)
Create a new replit with Nix toolset with a Python template.
In main.py write:
import talib
print (talib.__ta_version__)
This will be our test case. If ta-lib is installed the python main.py (executed in Shell) will return something like:
$ python main.py
b'0.6.0-dev (Jan 1 1980 00:00:00)'
We need to prepare a tools for building TA-Lib sources. There is a replit.nix file in your project's root folder (in my case it was ~/BrownDutifulLinux). Every time you execute a command like cmake the Nix reports that:
cmake: command not installed. Multiple versions of this command were found in Nix.
Select one to run (or press Ctrl-C to cancel):
cmake.out
cmakeCurses.out
cmakeWithGui.out
cmakeMinimal.out
cmake_2_8.out
If you select cmake.out it will add a record about it into the replit.nix file. And next time you call cmake, it will know which cmake version to launch. Perhaps you may manually edit replit.nix file... But if you're going to add such commands in a my way, note that you must execute them in Shell in your project root folder as replit.nix file is located in it. Otherwise Nix won't remember your choice.
After all my replit.nix file (you may see its content with cat replit.nix) content was:
{ pkgs }: {
deps = [
pkgs.libtool
pkgs.automake
pkgs.autoconf
pkgs.cmake
pkgs.python38Full
];
env = {
PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
# Needed for pandas / numpy
pkgs.stdenv.cc.cc.lib
pkgs.zlib
# Needed for pygame
pkgs.glib
# Needed for matplotlib
pkgs.xorg.libX11
];
PYTHONBIN = "${pkgs.python38Full}/bin/python3.8";
LANG = "en_US.UTF-8";
};
}
Which means I executed libtool, autoconf, automake and cmake in Shell. I always choose a generic suggestion from Nix, without a specific version. Note: some commands may report errors as we executing them in a wrong way just to add to a replit.nix.
3.
Once build tools are set up we need to get and build TA-Lib C library sources. To do that execute in Shell:
git clone https://github.com/TA-Lib/ta-lib.git
then
cd ta-lib/
libtoolize
autoreconf --install
./configure
If configure script is completed without any problems, build the library with:
make -j4
It will end up with some compilation errors, but they are related to some additional tools which are used to add new TA-Lib indicators and build at the end, but not the library itself. The library will be successfully compiled and you should be able to see it with:
$ ls ./src/.libs/
libta_lib.a libta_lib.lai libta_lib.so.0
libta_lib.la libta_lib.so libta_lib.so.0.0.0
Now we have our C library built, but we can't install it to a system default folders. So we have to use the library as is from the folders where it was build. All we need is just one more additional preparation:
mkdir ./include/ta-lib
cp ./include/*.h ./include/ta-lib/
This will copy a library headers to a subfolder, as they are designed to be used from a such subfolder (which they don't have due to impossibility to perform the installation step).
4.
Now we have TA-Lib C library built and prepared to be used locally from its build folders. All we need after that - is to compile the Python wrapper for it. But Python wrapper will look for a library only in system default folders, so we need to instruct it where our library is.
To do this, execute pwd and remember the absolute path to your project's root folder. In my case it was:
/home/runner/FormalPleasedOffice
Then adjust the paths (there are two) in a following command to lead to your project path:
TA_INCLUDE_PATH=/home/runner/FormalPleasedOffice/ta-lib/include/ TA_LIBRARY_PATH=/home/runner/FormalPleasedOffice/ta-lib/src/.libs/ pip install ta-lib
This is one line command, not a two commands.If the paths would be shorter it would look like:
TA_INCLUDE_PATH=/path1/ TA_LIBRARY_PATH=/path2/ pip install ta-lib.
After execution of this command the wrapper will be installed with two additional paths where it will look for a library and its header files.
That's actually all.
An alternative way would be to clone the wrapper sources, edit its setup.py and install wrapper manually. Just for the record this would be:
cd ~/Your_project
git clone https://github.com/mrjbq7/ta-lib.git ta-lib-wrapper
cd ta-lib-wrapper
Here edit the setup.py. Find the lines include_dirs = [ and library_dirs = [ and append your paths to these lists. Then you just need to:
python setup.py build
pip install .
Note the dot at the end.
5.
Go to the project's folder and try our python script:
$python main.py
b'0.6.0-dev (Jan 1 1980 00:00:00)'
Bingo!
The #truf answer is correct.
after you add the
pkgs.libtool
pkgs.automake
pkgs.autoconf
pkgs.cmake
in the replit.nix dippendancies.
git clone https://github.com/TA-Lib/ta-lib.git
cd ta-lib/
libtoolize
autoreconf --install
./configure
make -j4
mkdir ./include/ta-lib
cp ./include/*.h ./include/ta-lib/
TA_INCLUDE_PATH=/home/runner/FormalPleasedOffice/ta-lib/include/ TA_LIBRARY_PATH=/home/runner/FormalPleasedOffice/ta-lib/src/.libs/ pip install ta-lib
Note : FormalPleasedOffice should be your project name
Done.
Here is the youtube video :
https://www.youtube.com/watch?v=u20y-nUMo5I

./python: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

I need to try python 3.7 with openssl-1.1.1 in Ubuntu 16.04. Both python and openssl versions are pre-release. Following instructions on how to statistically link openssl to python in a previous post, I downloaded the source for opnssl-1.1.1.
Then navigate to the source code for openssl and execute:
./config
sudo make
sudo make install
Then, edit Modules/Setup.dist to uncomment the following lines:
SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
Then download python 3.7 source code. Then, navigate inside the source code and execute:
./configure
make
make install
After I execute make install I got this error at the end of the terminal output:
./python: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
generate-posix-vars failed
Makefile:596: recipe for target 'pybuilddir.txt' failed
make: *** [pybuilddir.txt] Error 1
I could not figure out what is the problem and what I need to do.
This has (should have) nothing to do with Python or OpenSSL versions.
Python build process, includes some steps when the newly built interpreter is launched, and attempts to load some of the newly built modules - including extension modules (which are written in C and are actually shared objects (.sos)).
When an .so is loaded, the loader must find (recursively) all the .so files that the .so needs (depends on), otherwise it won't be able to load it.
Python has some modules (e.g. _ssl*.so, _hashlib*.so) that depend on OpenSSL libs. Since you built yours against OpenSSL1.1.1 (the lib names differ from what comes by default on the system: typically 1.0.*), the loader won't be able to use the default ones.
What you need to do, is instruct the loader (check [Man7]: LD.SO(8) for more details) where to look for "your" OpenSSL libs (which are located under /usr/local/ssl/lib). One way of doing that is adding their path in ${LD_LIBRARY_PATH} env var (before building Python):
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/ssl/lib
./configure
make
make install
You might also want to take a look at [Python.Docs]: Configure Python - Libraries options (--with-openssl, --with-openssl-rpath).
Check [SO]: How to enable FIPS mode for libcrypto and libssl packaged with Python? (#CristiFati's answer) for details on a wider problem (remotely) related to yours.
What I have done to fix this :
./configure --with-ssl=./libssl --prefix=/subsystem
sed -i 's!^RUNSHARED=!RUNSHARED=LD_LIBRARY_PATH=/path/to/own/libssl/lib!' Makefile
make
make install
Setting LD_LIBRARY_PATH with export was not sufficient
With Python-3.6.5 and openssl-1.1.0h i get stuck in the same problem. I have uncomment _socket socketmodule.c.

How do I install de b2 command line with cmake

I have a c++ code that use boost functions. I want to install boost and link against my binary. But the boost repository doesn't have a cmake file and I coudn't use this repository as submodule. I could install boost using cmake. But to intall it, I have the b2 command line. I know the b2 command line is a python package.
My question: is possible to download this python package using a cmake file?
EDIT:
I know how to install de boost now with b2 command. But, I want only install de filesystem library. The boost directory has many content that I won't need. I have this cmake file, BUt I don't know how to exacly edited to archive my goal. I see a post here in stackoverflow that I can do something like that:
b2 tools/bcp
mkdir /tmp/interprocess
bcp interprocess /tmp/interprocess
But I don't know how to make this command line in side of a cmake file
my cmake file
cmake_minimum_required(VERSION 2.8)
include(ExternalProject)
# Download boost from git
SET (BOOST_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/boost/src/boost/lib/filesystem/include/boost/)
SET (BOOST_URL https://github.com/google/re2.git)
SET (BOOST_BUILD ${CMAKE_BINARY_DIR}/boost/src/boost)
get_filename_component(BOOST_STATIC_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/lib/libboost_filesystem.a ABSOLUTE)
SET (BOOST_INCLUDES ${RE2_BUILD})
if ( UNIX )
SET (BOOST_STATIC_LIBRARIES ${BOOST_BUILD}/libboost_filesystem.a)
endif ()
ExternalProject_Add(
boost
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/boost
GIT_REPOSITORY https://github.com/boostorg/boost.git
UPDATE_COMMAND ./bootstrap.sh --with-libraries=filesystem
CONFIGURE_COMMAND ""
BUILD_COMMAND ./b2 tools/bcp link=static install --prefix=${CMAKE_CURRENT_BINARY_DIR}/
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR/include/boost
})
set(Boost_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include/boost)
set(Boost_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/lib/ibboost_filesystem.a)
EDIT
Guys, I want to do this by using git submodules.
I want use boost using submodules. But boost has a lot of submodules and I only want to get submodules from boost that is necessary to boost.filesystem
But When I use boost as submodule in my project and try to include the boost directory in cmake file, this error happen:
CMake Error at CMakeLists.txt:16 (add_subdirectory):
The source directory
/home/lais/testeBoost/lib/boost
does not contain a CMakeLists.txt file.

Does anyone know how to compile Megahal on Ubuntu?

I have been trying to compile megahal for a few hours now and i dont seem to be getting anywhere. Has anyone had success with this?
http://megahal.alioth.debian.org/
I keep getting an error that says :
inlined from ‘load_personality.constprop’ at megahal.c:3283:8,
inlined from ‘change_personality.constprop’ at megahal.c:3332:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:293:2: warning: call to ‘__fread_chk_warn’ declared with attribute warning: fread called with bigger size * nmemb than length of destination buffer
return __fread_chk_warn (__ptr, __bos0 (__ptr), __size, __n, __stream);
^
cc1: some warnings being treated as errors
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Makefile:44: recipe for target 'pythonmodule' failed
make: *** [pythonmodule] Error 1
I have installed python via sudo apt-get and i have been over every thread that talks about "'x86_64-linux-gnu-gcc' but I have found no solution
You are getting these errors just because you don't have the python development headers installed. You can install it using following command
sudo apt-get install python-dev ( for python 2.x )
sudo apt-get install python3-dev ( for python 3 )
you need the python developer module "python-dev".this will help you
error: command 'gcc' failed with exit status 1 while installing eventlet
after upgrading to vivid 15.04 on ubuntu i couldn't compile the module anymore so i tried something else. Since in the main folder there is a directory named Megahal with a Makefile in it, i tried to compile from there. First you need to go to that directory.
cd /home/user/Downloads/megahal-9.1.1/Megahal/
you need to go where you unzipped the archive and there you can read the README file and start compiling.
perl Makefile.PL
i copied the missing files i was able to find to that folder and from there
make
make test
but this didn't work for me and afther that
make install
i had to do
sudo make install
and that is all. unfortunately for me i have a problem with perl i think.
I keep getting this error from the module "PL_thr_key" after i load it to the eggdrop. The eggdrop works normally except for the module. No module, no AI and no fun :(

Error when cross compiling Python for ARM

I'm trying to compile Python (version 3.1.3) for ARM, following this guide.
These are the commands I am issuing (on Ubuntu 12):
CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ AR=arm-linux-gnueabi-ar RANLIB=arm-linux-gnueabi-ranlib ./configure --host --build=x86_64-linux-gnu --prefix=/python
make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-linux-gnueabi-gcc -shared" CROSS_COMPILE=arm-linux-gnueabi- CROSS_COMPILE_TARGET=yes HOSTARCH=x86_64-linux-gnu BUILDARCH=x86_64-linux-gnu
make install HOSTPYTHON=./hostpython BLDSHARED="arm-linux-gnueabi-gcc -shared" CROSS_COMPILE=arm-linux-gnueabi- CROSS_COMPILE_TARGET=yes prefix=~/Python-2.7.2/_install
A few things to notice.
When executing the first command, if --host is set to arm-linux, the command won't execute, telling me that I should use '--host' for cross-compiling. This is why I did not set it to anything.
When running the second line, I get
configure: WARNING: Cache variable ac_cv_host contains a newline.
Failed to configure _ctypes module
Python build finished, but the necessary bits to build these modules
were not found:
_curses _curses_panel _dbm
_gdbm _hashlib _sqlite3
_ssl bz2 ossaudiodev readline zlib To find the necessary bits, look
in setup.py in detect_modules() for the module's name.
Failed to build these modules:
_tkinter
I get a similar error when running the third line, but I guess it's due to the fact that the command above did not work.
I'm trying to see if anyone can help me fix it.
It's much easier to compile natively under QEMU than cross-compile.
Unpack an arm chroot from whichever project you like, e.g. arch linux arm, raspbian, etc.
You already get binary python for arm, but if you really want to compile your own:
Download qemu-user-static (e.g. debian package), unpack that.
Install that single static binary into root of your arm chroot.
Add magic hex to binfmt in proc. Instructions for Debian, Gentoo, genric, List of magic hex sequences. Below are my settings:
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register
export QEMU_CPU=arm926
Optionally, mount --bind /tmp, /proc, /sys, as required.
Enjoy your virtual arm!
I got the same error and just ignored it and carried on with the procedure suggested by
http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
It worked with a hello_world program. You can also run a testall.py file from the _install/lib/Python2.7/ folder.
You can also refer to
http://whatschrisdoing.com/blog/talks/PyConTalk2012.pdf

Categories

Resources