Matlab Mex compilation error - matlab

I’m using the Random Forest library for Matlab (link). I’m using it for classification. On Windows it works very well out of the box (precombiled mex files) but I also want to run it on a CentOS cluster.
I have tried to compile it on the cluster by executing make mex but I’m getting an error. The output is as follows:
rm twonorm_test -rf
rm tempbuild/*.o *.o -rf
rm *~ -rf
rm *.mexw32 twonorm_test -rf
rm *.mexa64 -rf
rm classRF -rf
rm *.exe -rf
echo 'Compiling classTree.cpp'
Compiling classTree.cpp
g++ -fpic -O2 -funroll-loops -msse3 -c src/classTree.cpp -o tempbuild/classTree.o
echo 'Compiling Cokus (random number generator)'
Compiling Cokus (random number generator)
g++ -fpic -O2 -funroll-loops -msse3 -c src/cokus.cpp -o tempbuild/cokus.o
echo 'Compiling rfsub.f (fortran subroutines)'
Compiling rfsub.f (fortran subroutines)
gfortran -O2 -fpic -c src/rfsub.f -o rfsub.o
echo 'Compiling rfutils.cpp'
Compiling rfutils.cpp
g++ -fpic -O2 -funroll-loops -msse3 -c src/rfutils.cpp -o tempbuild/rfutils.o
echo 'Generating Mex'
Generating Mex
mex src/mex_ClassificationRF_train.cpp src/classRF.cpp tempbuild/classTree.o tempbuild/rfutils.o rfsub.o tempbuild/cokus.o -o mexClassRF_train -lgfortran -lm -DMATLAB -g
Unknown MEX argument '-o'.
make: *** [mex_classRF] Error 255
Does somebody knows how to solve this issue? If you want, you can take RF_MexStandalone-v0.02.zip from the above link and then go to randomforest-matlab/RF_Reg_C/Makefile.
Edit: I have change -o to -output but now the output is the following:
rm twonorm_test -rf
rm tempbuild/*.o *.o -rf
rm *~ -rf
rm *.mexw32 twonorm_test -rf
rm *.mexa64 -rf
rm classRF -rf
rm *.exe -rf
echo 'Compiling classTree.cpp'
Compiling classTree.cpp
g++ -fpic -O2 -funroll-loops -msse3 -c src/classTree.cpp -o tempbuild/classTree.o
echo 'Compiling Cokus (random number generator)'
Compiling Cokus (random number generator)
g++ -fpic -O2 -funroll-loops -msse3 -c src/cokus.cpp -o tempbuild/cokus.o
echo 'Compiling rfsub.f (fortran subroutines)'
Compiling rfsub.f (fortran subroutines)
gfortran -O2 -fpic -c src/rfsub.f -o rfsub.o
echo 'Compiling rfutils.cpp'
Compiling rfutils.cpp
g++ -fpic -O2 -funroll-loops -msse3 -c src/rfutils.cpp -o tempbuild/rfutils.o
echo 'Generating Mex'
Generating Mex
mex src/mex_ClassificationRF_train.cpp src/classRF.cpp tempbuild/classTree.o tempbuild/rfutils.o rfsub.o tempbuild/cokus.o -output mexClassRF_train -lgfortran -lm -DMATLAB -g
Building with 'g++'.
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [mex_classRF] Error 255
I did not find an option -std=c++11 in the makefile.

The error is quite self-explanatory: the option -o is not recognized. If you type mex -help you see the options mex accepts. Try to replace -o with -output.
EDIT regarding the std=c++11 option, you are probably using an old version of gcc compiler. You can either change it to std=c++0x which is the equivalent option (but note that some features of the c++11 standard may not be present\implemented), or upgrade to an up-to-date version of gcc.
If you need more help, please report the output of g++ --version.

Related

MySQL Workbench for PostgreSQL - ./psqlodbc.h:41:10: fatal error: 'sql.h' file not found

I am trying to connect to a Postgres db trough MySQL Workbench.
Following the documentation we need to install a driver for psql in our machine.
I am running a MacOS Big Sur 11.2.3.
After run CFLAGS="-arch i386 -arch x86_64" make I'm getting the following error:
/Library/Developer/CommandLineTools/usr/bin/make all-am
source='info.c' object='info.lo' libtool=yes \
depfile='.deps/info.Plo' tmpdepfile='.deps/info.TPlo' \
depmode=gcc3 /bin/sh ./depcomp \
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c -o info.lo `test -f 'info.c' || echo './'`info.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c info.c -MT info.lo -MD -MP -MF .deps/info.TPlo -fno-common -DPIC -o info.lo
In file included from info.c:19:
./psqlodbc.h:41:10: fatal error: 'sql.h' file not found
#include <sql.h>
^~~~~~~
1 error generated.
make[1]: *** [info.lo] Error 1
make: *** [all] Error 2
It seems that the 'sql.h' file is not found.
How to solve this issue?

Installing Neovim through Linuxbrew on AWS

I'm trying to install neovim with linuxbrew on AWS, but I keep getting the following messages, and I can't figure it out :/.
/home/ec2-user/.linuxbrew/bin/libtool: line 10548: /usr/bin/gcc-4.8: No such file or directory
~/dotfiles$ brew install neovim
==> Installing neovim from neovim/neovim
==> Downloading https://github.com/neovim/neovim/archive/v0.1.4.tar.gz
Already downloaded: /home/ec2-user/.cache/Homebrew/neovim-0.1.4.tar.gz
==> Downloading https://github.com/libuv/libuv/archive/v1.8.0.tar.gz
Already downloaded: /home/ec2-user/.cache/Homebrew/neovim--libuv-1.8.0.tar.gz
==> Downloading https://github.com/msgpack/msgpack-c/archive/cpp-1.0.0.tar.gz
Already downloaded: /home/ec2-user/.cache/Homebrew/neovim--msgpack-1.0.0.tar.gz
==> Downloading https://raw.githubusercontent.com/neovim/deps/master/opt/LuaJIT-2.0.4.tar.gz
Already downloaded: /home/ec2-user/.cache/Homebrew/neovim--luajit-2.0.4.tar.gz
==> Downloading https://github.com/keplerproject/luarocks/archive/5d8a16526573b36d5b22aa74866120c998466697.tar.gz
Already downloaded: /home/ec2-user/.cache/Homebrew/neovim--luarocks-998466697.tar.gz
==> Downloading https://github.com/mauke/unibilium/archive/v1.2.0.tar.gz
Already downloaded: /home/ec2-user/.cache/Homebrew/neovim--unibilium-1.2.0.tar.gz
==> Downloading http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.18.tar.gz
Already downloaded: /home/ec2-user/.cache/Homebrew/neovim--libtermkey-0.18.tar.gz
==> Downloading https://github.com/neovim/libvterm/archive/1b745d29d45623aa8d22a7b9288c7b0e331c7088.tar.gz
Already downloaded: /home/ec2-user/.cache/Homebrew/neovim--libvterm-7088.tar.gz
==> Downloading https://github.com/jemalloc/jemalloc/releases/download/4.0.2/jemalloc-4.0.2.tar.bz2
Already downloaded: /home/ec2-user/.cache/Homebrew/neovim--jemalloc-4.0.2.tar.bz2
==> Building third-party dependencies.
==> cmake ../third-party -DUSE_BUNDLED_BUSTED=OFF -DUSE_BUNDLED_LUV=OFF -DUSE_EXISTING_SRC_DIR=ON -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/home/ec2-user/
==> make VERBOSE=1
Last 15 lines from /home/ec2-user/.cache/Homebrew/Logs/neovim/02.make:
libtool: compile: /home/ec2-user/.linuxbrew/bin/gcc-5 -I. -Wall -std=c99 -fPIC -c uninames.c -fPIC -DPIC -o .libs/uninames.o
libtool: compile: /home/ec2-user/.linuxbrew/bin/gcc-5 -I. -Wall -std=c99 -fPIC -c uninames.c -o uninames.o >/dev/null 2>&1
libtool --mode=compile --tag=CC /home/ec2-user/.linuxbrew/bin/gcc-5 -I. -DTERMINFO_DIRS='"/etc/terminfo:/lib/terminfo:/usr/share/terminfo:/usr/lib/terminfo:/usr/local/share/terminfo:/usr/local/lib/terminfo"' -Wall -std=c99 -fPIC -o uniutil.lo -c uniutil.c
libtool: compile: /home/ec2-user/.linuxbrew/bin/gcc-5 -I. -DTERMINFO_DIRS=\"/etc/terminfo:/lib/terminfo:/usr/share/terminfo:/usr/lib/terminfo:/usr/local/share/terminfo:/usr/local/lib/terminfo\" -Wall -std=c99 -fPIC -c uniutil.c -fPIC -DPIC -o .libs/uniutil.o
libtool: compile: /home/ec2-user/.linuxbrew/bin/gcc-5 -I. -DTERMINFO_DIRS=\"/etc/terminfo:/lib/terminfo:/usr/share/terminfo:/usr/lib/terminfo:/usr/local/share/terminfo:/usr/local/lib/terminfo\" -Wall -std=c99 -fPIC -c uniutil.c -o uniutil.o >/dev/null 2>&1
libtool --mode=link --tag=CC /home/ec2-user/.linuxbrew/bin/gcc-5 -L/home/ec2-user/.linuxbrew/lib -Wl,--dynamic-linker=/home/ec2-user/.linuxbrew/lib/ld.so -Wl,-rpath,/home/ec2-user/.linuxbrew/lib -rpath '/tmp/neovim-20160518-12137-13p0ite/neovim-0.1.4/deps-build/usr/lib' -version-info 3:0:3 -o libunibilium.la unibilium.lo uninames.lo uniutil.lo
libtool: link: /usr/bin/gcc-4.8 -shared -fPIC -DPIC .libs/unibilium.o .libs/uninames.o .libs/uniutil.o -L/home/ec2-user/.linuxbrew/lib -Wl,--dynamic-linker=/home/ec2-user/.linuxbrew/lib/ld.so -Wl,-rpath -Wl,/home/ec2-user/.linuxbrew/lib -Wl,-soname -Wl,libunibilium.so.0 -o .libs/libunibilium.so.0.3.0
/home/ec2-user/.linuxbrew/bin/libtool: line 10548: /usr/bin/gcc-4.8: No such file or directory
make[3]: *** [libunibilium.la] Error 127
make[3]: Leaving directory `/tmp/neovim-20160518-12137-13p0ite/neovim-0.1.4/deps-build/build/src/unibilium'
make[2]: *** [build/src/unibilium-stamp/unibilium-build] Error 2
make[2]: Leaving directory `/tmp/neovim-20160518-12137-13p0ite/neovim-0.1.4/deps-build'
make[1]: *** [CMakeFiles/unibilium.dir/all] Error 2
make[1]: Leaving directory `/tmp/neovim-20160518-12137-13p0ite/neovim-0.1.4/deps-build'
make: *** [all] Error 2
READ THIS: https://github.com/Linuxbrew/brew/blob/master/share/doc/homebrew/Troubleshooting.md#troubleshooting
If reporting this issue please do so at (not Homebrew/brew):
https://github.com/neovim/homebrew-neovim/issues
These open issues may also help:
Neovim Fails to Install on Standalone Linuxbrew: libmsgpack.so Error https://github.com/neovim/homebrew-neovim/issues/156
Neovim failing to build with homebrew on OS X 10.9.5 https://github.com/neovim/homebrew-neovim/issues/153
Can't install via homebrew-neovim if luarocks path is set explicitly https://github.com/neovim/homebrew-neovim/issues/149
Error when trying to install neovim in my Ubuntu 14.04 virtual machine. https://github.com/neovim/homebrew-neovim/issues/134
I had the same issue. It is a problem of the libtool formula
https://github.com/Linuxbrew/homebrew-core/issues/376
I fixed by doing
brew update
brew reinstall -s libtool
brew install neovim/neovim/neovim

how to build pipeline_kafka extension

i'm currently trying to compile the pipeline_kafka extension from Github to add it to my pipelinedb instance but i'm running in a problem neither i nor google seems to be able to solve.
when i execute make command i get the following error
stc#vm:~/pipeline_kafka$ make gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -DLINUX_OOM_SCORE_ADJ=0 -fno-omit-frame-pointer -fpic -I. -I./ -I/usr/include/postgresql/9.4/server -I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.6 -c -o pipeline_kafka.o pipeline_kafka.c pipeline_kafka.c:23:40: fatal error: catalog/pipeline_stream_fn.h: No such file or directory #include "catalog/pipeline_stream_fn.h" ^ compilation terminated. : recipe for target 'pipeline_kafka.o' failed make: *** [pipeline_kafka.o] Error 1
does anyone has an idea what to do? I'm running on debian 8.
Does anyone know why this extension is not part of pipelinedb anymore?
cheers and thanks in advance
the reason for the error is my entire approach towards using/installing pipelinedb and pipeline_kafka.
the following script worked for me on a standard Debian 8 installation. Maybe it helps.
Download and install PipelineDB
wget -O pipelinedb_install_package "https://www.pipelinedb.com/download/0.9.1/debian8"
sudo dpkg -i pipelinedb_install_package
mkdir ~/logs
pipeline-init -D ~/data/pipelinedb
pipeline-ctl -D ~/data/pipelinedb -l ~/logs/pipelinedb.log start
sleep 5.0
pipeline pipeline
Download and install pipeline_kafka extension
sudo apt-get install git gcc g++ zlib1g-dev
mkdir ~/git
git clone https://github.com/edenhill/librdkafka.git ~/git/librdkafka
git clone https://github.com/pipelinedb/pipeline_kafka.git >~/git/pipeline_kafka
cd ~/git/librdkafka
./configure --prefix=/usr
make
sudo make install
cd ~/git/pipeline_kafka
./configure
make
sudo make install
pipeline pipeline -c "CREATE EXTENSION pipeline_kafka;"
sed -i 's/#shared_preload_libraries/shared_preload_libraries/' ~/data/pipelinedb/pipelinedb.conf
sed -i "s/shared_preload_libraries = ''/shared_preload_libraries=pipeline_kafka/" ~/data/pipelinedb/pipelinedb.conf

mex cc file in ubuntu

I've download some code online. The makefile is like following:
all: cascade
cascade: cascade.cc model.cc model.h
mex -o cascade \
CXXFLAGS="\$$CXXFLAGS -O3 -march=nocona -fomit-frame-pointer" \
cascade.cc model.cc
clean:
rm *.mex*
I use command !make to run in matlab. But it gives me the following error:
mex -O cascade \
CXXFLAGS="\$CXXFLAGS -O3 -march=nocona -fomit-frame-pointer" \
cascade.cc model.cc
/bin/sh: 1: mex: not found
make: *** [cascade] Error 127
I go to /bin/sh of my system. There is no mex indeed.
What should I do to add mex to /bin/sh.
Thanks

How can I get pkg-config to work within eclipse juno (Mac OS X)?

I try to get gtkmm running within eclipse. This is my makefile (without the cleaning):
all : main.cpp
#export PATH+=/opt/local/bin;
#echo PATH=$(PATH);
g++ -v `pkg-config gtkmm-2.4 --cflags` \
-O0 -g3 -Wall -S \
-o main.o main.cpp;
g++ -v -o main.exe main.o \
`pkg-config gtkmm-2.4 \
--libs` ;
In the Console I get (amongst other output):
PATH=/usr/bin:/bin:/usr/sbin:/sbin
g++ -v `pkg-config gtkmm-2.4 --cflags` \
-O0 -g3 -Wall -S \
-o main.o main.cpp;
/bin/sh: pkg-config: command not found
I did:
ln -s /usr/bin/pkg-config /opt/local/bin/pkg-config
And when I type
/usr/bin/pkg-config
in Terminal, I get:
Must specify package names on the command line
So I assume pkg-config works in the "Terminal" ... But not in eclipse.
What can I do?
Thanks!
Nils
I don't know exactly what solved my Problem, since now, it works.
I guess it was one of the following:
makefile now looks like this:
all: main.cpp
g++ -v `pkg-config gtkmm-2.4 --cflags`-O0 -g3 -Wall -c -o main.o main.cpp;
g++ -v -o main.exe main.o `pkg-config gtkmm-2.4 --libs`
clean:
rm -f main.exe main.o
I have smybolic link towards pkg-config within /bin:
sudo ln -s /opt/local/bin/pkg-config /bin/pkg-config
I installed XQuartz
I updated MacPorts and all outdated ports:
sudo port -v selfupdate
sudo port upgrade outdated