Graphic_failure in OCaml - ocaml

Here's what I wrote in Ocaml top-level
# #load "graphics.cma";;
# open Graphics;;
# open_graph " 400x600" (* Note the leading space. *);;
But I got the error
Exception: Graphics.Graphic_failure "Cannot open display ".
What I tried
I tried to change the DISPLAY variable of my environnement to :0.0, and the error message becomes "Cannot open display :0.0"
I'm on OSX Capitan V10.11

I guess the problem is you don't have any X11 Windows System (as stated here https://support.apple.com/en-us/HT201341)
You should install XQuartz : http://www.xquartz.org/

Related

"Abort Trap: 6" when attempting OpenCV video capture on macOS Mojave

I've tried on both Python on C++, and every time I call cap.open(0), I get an Abort Trap: 6 error. I haven't been able to find any solutions to this via Google, and have tried reinstalling OpenCV several times now. Any suggestions?
iTerm might be messing things up for you. It worked for me when I used the normal terminal.
Most likely your mac blocks the webcam access.
Check
System Pref -> Security & Privacy -> Privacy -> Camera.
If the app that you try to use is not listed there, opencv produce "Abort trap: 6"
In VSCode:
Do cmd+shift+p
Enter "shell command: Install code in PATH"
Close VS Code
Use sudo code to open VS Code
It will give a warning not to run as a root user
Ignore the warning and run the file, and you will not get the "Abort trap: 6" error anymore.
install code in vsstudio code and then open terminal and type code, it will open visual studio code and it will have all the permisions.

rhel 7.1 octave gnuplot - resolving libGL error: failed to load driver: swrast

I have recently gone through a drill to resolve getting octave on rhel 7.1 to plot using gnuplot. Basically, I was getting the following ugly messages and no plot:
$ export LIBGL_DEBUG=verbose
$ octave
$ GNU Octave, version 3.8.2
octave:1> x = -10:0.1:10; plot(x, sin(x))
libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/swrast_dri.so
libGL: driver does not expose __driDriverGetExtensions_swrast():
/usr/lib64/dri/swrast_dri.so: undefined symbol: __driDriverGetExtensions_swrast
libGL: Can't open configuration file /home/jsaari/.drirc: No such file or directory.
libGL: Can't open configuration file /home/jsaari/.drirc: No such file or directory.
libGL error: failed to load driver: swrast
function is no-op
function is no-op
function is no-op
. . .
I finally came to a resolution after not finding any singular helpful posting.
Apparently there are issues with the OpenGL/Mesa implementation. Also, octave had multiple graphics outputs available and USED to use gnuplot by default. This particular version of octave has "fltk" aka "OpenGL" as the default graphics output. This is easy to overcome by setting the graphics library default.
octave:1> graphics_toolkit()
ans = fltk
octave:2> available_graphics_toolkits()
ans =
{
[1,1] = fltk
[1,2] = gnuplot
}
octave:3> graphics_toolkit("gnuplot")
octave:4> graphics_toolkit()
ans = gnuplot
octave:5> x = -10:0.1:10; plot(x, sin(x))
which now gets me a nice plot.
If this saves somebody the two hours of my life I will never get back again, it was worth posting.

Using Eigen on Mac OS X for XCode

I'm triying to use Eigen on Xcode but I always get the "file not found" error. I installed Eigen using Homebrew, who puts it on
/usr/local/Cellar/eigen/3.2.9
but when adding this path to the "Header Search Paths" I keep getting the "file not found" error. Is there any other way of using Eigen on Xcode?
EDIT: also tried with
/usr/local/Cellar/eigen/3.2.9/include/eigen3
and I keep getting the "file not found" error.
It probably should be
/usr/local/Cellar/eigen/3.2.9/include/eigen3
You need read the detailed error message and compare with the folder above to confirm the not-found file is there.

Trouble with clang_complete, no error and loaded but does not work

I am trying to use clang_complete for vim on Arch Linux. I built vim and vimball plugin from source. I see +python/dyn and +python3/dyn in vim --version output. I use the following .vimrc file :
syntax on
filetype plugin on
let g:clang_complete_copen=1
let g:clang_complete_auto=0
let g:clang_user_options='|| exit 0'
let g:clang_use_library=1
let g:clang_library_path='/usr/lib/libclang.so'
In :scriptnames, I see ~/.vimrc/plugin/clang_complete.vim is loaded.
Overall, it does not work! If I open a C++ file then vim shows incorrect UI behaviour without reporting any error. e.g. cursor is invisible, typing words takes place in wrong positions, no syntax highlight, ... . The cursor remains invisible even after quit.
I think clang library can be loaded since any change in the path makes an error.
Is there any mistake in the above settings?

Sublime text 2 c++ error message (No Disk)

I am running sublime text 2 on windows 8 (The build system is on c++). When I run the program, an error message says g++.exe "There is no disk in the drive. Please insert a disk into drive l:." When I click continue another error message pops up saying cc1plus.exe (Same as before), When I click continue again, another error message pops up collect2.exe (Same as before). When I click continue for the third time It runs the code correctly. Any help would be greatly appreciated!
(My compiler is MinGW)
(My text editor is sublime text 2)
(My OS is Windows 8)
(I have installed MinGW before)
Here is my code: (If that matters)
#include <iostream>
int main()
{
std::cout << "Hello World!";
return 0;
}
For clarification, after I am done with the error messages, the code RUNS and prints "Hello World!".
It appears that this is a known problem with MinGW. Specifically it is thought to be an issue in the GNU binutils gettext package. There's a bug report on it over at SourceForge:
http://sourceforge.net/p/mingw/bugs/2108/
Unfortunately however, there doesn't appear to be an ETA for the fix.