Retrieve the compilation options for octave - octave

Is there any simple way to retrieve the compilation options for octave ?
Something similar to python:
import distutils.sysconfig
print(distutils.sysconfig.get_config_var('CONFIG_ARGS'))
>>> '--enable-shared' '--enable-ipv6' '--with-ensurepip=no' <...>
I'm running Ubuntu 16.04

octave_config_info () is very chatty. For example the configure options as you asked on my system:
octave:1> octave_config_info().config_opts
ans = '--disable-gui'
EDIT: as carandraug has pointed out "octave_config_info()" has been deprecated for 4.2. You can see a discussion on the maintainers mailinglist here: http://octave.1599824.n4.nabble.com/quot-features-quot-problems-td4675361.html

Related

DLDT (OpenVINO) install on Ubuntu 18.04 on Raspberry Pi 4 - Cython code error

I am trying to install the DLDT package on Ubuntu 18.04 running on the Raspberry Pi 4. The 2019 branch of DLDT seems to install correctly with some issues but can be rectified. However, the later version (i.e. 2020.3) is giving me the below error:
Error compiling Cython file:
------------------------------------------------------------
...
# Usage example:\n
# ```python
# ie = IECore()
# net = ie.read_network(model=path_to_xml_file, weights=path_to_bin_file)
# ```
cpdef IENetwork read_network(self, model: [str, bytes], weights: [str, bytes] = "", init_from_buffer: bool = "False"):
^
------------------------------------------------------------
/home/ubuntu/dldt/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api.pyx:136:10: Signature not compatible with previous declaration
Error compiling Cython file:
------------------------------------------------------------
...
cdef class LayersStatsMap(dict):
cdef C.IENetwork net_impl
cdef class IECore:
cdef C.IECore impl
cpdef IENetwork read_network(self, model : [str, bytes], weights : [str, bytes] = ?, bool init_from_buffer = ?)
^
------------------------------------------------------------
The CMAKE command I use is:
sudo cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_MKL_DNN=OFF -DENABLE_CLDNN=OFF -DENABLE_GNA=OFF -DENABLE_SSE42=OFF -DTHREADING=SEQ -DENABLE_OPENCV=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.6m.so -DPYTHON_INCLUDE_DIR=/usr/include/python3.6 ..
It seems like there is an issue with the declaration of the function or the usage of it. Is there any advice on this from anybody?
Is this a compatibility issue? Is this related to some Cython version issues? The one I have is: 0.29.21
Would appreciate some help on this. Thanks in advance!
Well it turns out that I had two versions of cython on my RPi (i.e. 0.26 and 0.29) and the cmake was using the older version. Once I updated the cmake to use the 0.29 version everything was fine.
I also downloaded the latest version of DLDT (v 2020.4) and used the same cmake command as earlier. This version of DLDT checks for the minimum required Cython version which is 0.29 and this led me to the answer.
Another option to install and build openvino on Raspberry pi 4,
Download raspian installer 2019 version from https://download.01.org/opencv/2019/openvinotoolkit/R3/
Follow the step given in this link - https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_raspbian.html

Broken pipe issue

I'm trying to learn machine learning using Octave.
OS: Mac, High Sierra 10.13.3
GNU Octave version: 3.8.0
t = [0: 0.01: 0.98];
y1 = sin(2*pi*4*t);
y2 = sin(2*pi*4*t);
plot(t, y1);
hold on;
plot(t, y2, 'r');
figure(1); plot(t,y1);
The first time I tried ran the last line I got: "Qt terminal communication error: select() error 9 Bad file descriptor"
After this I got a broken pipe error, I thought I need to plot both the graphs again before trying "figure(1); plot(y,t1);". But, it didn't work.
Checked whois and printed the values of y1, y2 and t; they do exist. So, my questions are:
Why am I not able to plot the graphs?
How do I solve broken pipe error?
How to solve the Qt terminal communication error?
Coursera's Machine Learning class is still using this version of Octave (3.8.0)
Here is what helped me:
run the following the os x terminal:
brew uninstall gnuplot
brew install gnuplot --with-qt
then create a file in your home directory called .octaverc and add the following to it:
setenv("GNUTERM","qt")
Relaunch octave-cli
Good Luck!
simply close the terminal and relaunch it , and this fixes the issue.
This occurred to me as I tried quitting the gnu-plot instead of using close command causing the pipe linked to gnu be broken.

opencv 3.1 wxwidgets cv::imwrite error

I am building a project using Opencv 3.1 and wxwidgets 3.1. The code I use:
[wxOpenCv Demo1]
I try to add a write frame object, using the function cv::imwrite().
(I changed the c calls to c++ eg: cvQueryFrame( m_pCapture ) to m_pCapture >> m_CurFrame;)
I get this error:
Undefined symbols for architecture x86_64:
"cv::imwrite(cv::String const&, cv::_InputArray const&,
std::vector > const&)", referenced from:
CCamera::SaveFrame() in camera.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Without wxwidgets the opencv functions work fine. So its seems that it has to do with the combination of wxwidgets and opencv.
This works fine with wxwidgets and Opencv:
cv::imshow("tmp",m_CurFrame);
cv::waitKey(4);
// cv::imwrite(Tmp , m_CurFrame);
If I uncomment the last line, I get the error.
OS X: 10 Yosemite and I use the default compiler (Apple LLVM 7.0)
I have no idea what to do about this!
solved the problem (and more) by recompiling wxwidgets 3.1.0 and Opencv 3.1. I used these links to get it going.
Small guide to compiling wxWidgets, Opencv against C++ 11:
Compile wxwidgets 3.1.0: I followed the install.txt for OSX. And tweaked the ../configure call with help from this
I added: --enable-debug and changed the macosx version
../configure --disable-shared --enable-debug --enable-unicode --with-cocoa --with-macosx-version-min=10.7 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk CXXFLAGS="-std=c++0x -stdlib=libc++" CPPFLAGS="-stdlib=libc++" LIBS=-lc++
Then with the help of this page I build a xcode project. Tweaking a few things:
(wxcocoa.xcodeproj and minimal.xcodeproj, and a all new projects)
Add to the Header Search Path: $(WXROOT)/build/osx (to find wx.xcconfig)
base SDK: latest OS X (10.11)
C language dialect: GNU 11(not sure if this is right)
C++ language dialect: GNU++11 [-std=gnu++11]
C++ Standard Library: libc++ (LLVM C++ standard library with C++ 11 support)
placed the WXROOT under “preference->locations->Source Trees. Not important, but seems to be a better location (restart xcode)
in wxcocoa.xcconfig I changed: MACOSX_DEPLOYMENT_TARGET = 10.10
Somehow I have to change the name of the created library from libwx_osx_cocoa_static.a to: lwx_osx_cocoa_static.a (why, I do not know)
I use GNU++ 11 and thus libc++ to be able to use new functionality like “future"
I then added OpenCV to my newly created wxXcode project:
Compile OpenCV following this: (search the web for: howto-install-build-and-use-opencv-macosx-10-10)
Make sure that the SDK is the right version (here was my biggest problem), matching the build of wxWidgets
The compiler settings same as for wxWidgets (see above)
(added:) To do this I added some lines to the CMakeLists.txt in the (Opencv-master folder). Below the line: # OpenCV compiler and linker options
(I found this trick here: search the web for: OpenCV with C++11 on OS X 10.8
message("Setting up Xcode for C++11 with libc++.")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
Then follow this page to update the newly created wxWidgets xcode project (search the web for: howto-setup-xcode-6-1-to-work-with-opencv-libraries)
This should do the trick! I can now combine wxWidgets, OpenCV and the libc++
(multithreading, “future")
I hope this helps.
Please let me know if you found out more!

version node not found for symbol mysql_select_db#libmysqlclient_16

I was trying to build my app on linux using mysql c api, and got this error at link stage, it's working fine on windows. Please help, thanks!
error message:
/bin/ld: myapp.so : version node not found for symbol mysql_select_db#libmysqlclient_16
/bin/ld: failed to set dynamic section sizes: Bad value
OS: CentOS 7, 64-bit, (VM on virtual box)
Mysql: 5.6.24 (community edition, installed via yum)
.bashrc file
export LIBMYSQL_INCLUDE_DIR=/usr/include/mysql
export LIBMYSQL_LIBRARY=/usr/lib64/mysql
export LD_LIBRARY_PATH=/usr/lib64/mysql:$LD_LIBRARY_PATH
cmake file: (variables are set according to environment variables)
FILE(GLOB SRC_MYAPP myapp/*.c myapp/*.h)
INCLUDE_DIRECTORIES(${LIBMYSQL_INCLUDE_DIR})
ADD_LIBRARY(myapp ${SRC_MYAPP})
IF (MSVC_IDE)
TARGET_LINK_LIBRARIES(myapp ${LIBMYSQL_LIBRARY}/libmysql)
ELSE ()
TARGET_LINK_LIBRARIES(myapp ${LIBMYSQL_LIBRARY}/libmysqlclient_r.a)
ENDIF ()
Put #hank 's comment as answer
I suppose you should add link_directories(/usr/lib64/mysql) before add_library and then target_link_libraries(myapp mysqlclient_r) – hank May 12 at 12:50

error installing octcdf-1.1.5

I Have in my Mac:
Octave-3.4.0
Gnuplot 4.2 - that I had to install because I had problems plotting - it wouldn't plot at all.
I need to load a netcdf file, the error that came was:
nc = netcdf('/users/matheuscortezi/Desktop/Pcse005/ocean_avg.nc', 'r')
error: `netcdf' undefined near line 9 column 6
So I think I don't have the netcdf comand installed, and tried installing by typing this on octave:
pkg install -global -forge octcdf
The error message that I receive from that is:
configure: error: in `/var/tmp/oct-t8XcYD/octcdf/src':
configure: error: C compiler cannot create executables
See `config.log' for more details.
the configure script returned the following error: checking for gcc... /usr/bin/gcc-4.2
checking whether the C compiler works... no
error: called from `pkg>configure_make' in file /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/pkg/pkg.m near line 1325, column 9
error: called from:
error: /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/pkg/pkg.m at line 783, column 5
error: /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/pkg/pkg.m at line 354, column 9
I haven't the faintest idea about what I should do. How can I solve this problem with either:
fixing this error, or
installing a netcdf "comand pack" (i don't know the name for that) so I can use netcdf() as in the example given.
Hope I was clear enough.
It seems to me that you installed Octave from the Mac OSX App bundle. That is not recommended at all. You should install from one of the package managers as explained on Octave's wiki. As far as I know, there are 3 options for Mac (see previous link). Just search for one that also has the netcdf package.
Anyway, if you really don't want to install it through a package manager (but seems to me you really should), seems that your problem lies on gcc (the GNU C compiler). do you have it installed at all? Some packages have code in C++ or C and are also dependent on some external libraries.
EDIT using a package manager would have also solved your problem about plotting since it would install gnuplot at same time