Summary: I can plot a 3D surface on Windows 7, I used to be able to plot the same on Mageia 4, when I upgraded to Mageia 5 I get "Error: Command crashed: filename-1.asy" and using dmsg I see a segmentation fault.
Please help!!!
Detail:
GENERAL
Thank you for looking at this. :0)
The error I get from TexStudio is "Error: Command crashed: asy -noprc minimal3D-1.asy" (or "Error: Command crashed: asy filename-1.asy" if I don't use -noprc)
dmesg | grep asy
[ 1159.645219] asy[28118]: segfault at 1b150 ip 00007f6a4a0f2f61 sp 00007ffe09692fe0 error 4 in i965_dri.so[7f6a49ff5000+559000]
Please note three things:
1) My asymptote code works perfectly on Windows 7 (the problem is with a Linux implementation only) e.g. see pdf
2) My asymptote code used to work perfectly on Mageia 4; i.e. before I did a clean install of Mageia 5 (I have NOT changed the asymptote code)
3) Asymptote 2D works perfectly on both OSs (the problem just concerns 3D rendering on Mageia 5)
My thoughts:
- I think I am missing a dependency or some setting is wrong somewhere.
- It's not a Mageia 5 problem.
- It's not a TeXstudio problem.
- It's not a a bug in Asymptote
asymptote is started with either:
asy ?m.asy
or
asy -noprc ?m.asy
PDF viewer (and likewise PS, DVI) is set to either:
okular %.pdf > /dev/null
or
evince %.pdf > /dev/null
Build is set to:
txs:///asy-pdf-chain
Asymptote PDF chain is set to either:
txs:///latexmk | txs:///asy | txs:///latexmk | txs:///view-pdf
or
txs:///pdflatex | txs:///asy | txs:///pdflatex | txs:///view-pdf
%%Description: Everything under control
%Options: KBD=VOID; STD=VOID; LANG=BRITISH; FMT=LATEX; HYPHEN=LATEX;
\documentclass[12pt]{article}
\usepackage{gensymb}
\usepackage{adjustbox}
\usepackage{wrapfig}
\usepackage[paper=a4paper]{geometry} %[margin=0.5in] shrinks margins to 0.5in
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[inline]{asymptote}
\begin{document}
\section{Plot of a pole and a zero}
\begin{equation}
G(s)=\frac{s+1}{s-1}
\end{equation}
We plot the function $G(s)$ for all values of $s=\sigma+j\omega$ over the range $(-2.5,-1.5)\le(\sigma, j\omega)\le(2.5,1.5)$. The input' values are plotted in the normal complex plane, theoutput' values are gain (height) and phase (colour.)
There is an inherent ambiguity in how to measure $\pm 180\degree$. It is this that is responsible for the phase discontinuity. We have chosen the interval $-\pi\le\theta\le\pi$ but we could equally have chosen $0\le\theta\le2\pi$ or even $0\ge\theta\ge-2\pi$.
size(200,300,keepAspect=false);
currentprojection=orthographic(-4,-2,40);
currentlight=Viewport;
//currentlight=(10,10,20);
int N=100;
real eps=0.01;
real large=1/eps;
//
pair zero = (-1,0);
pair Gnum(pair snum) {return (snum.x - zero.x, snum.y - zero.y);}
//
pair pole = (1,0);
pair Gden(pair sden) {return (sden.x - pole.x, sden.y - pole.y);}
//
draw(-3X -- 4X, arrow=Arrow3(emissive(black)), L=Label("$\sigma$",position=EndPoint, align=W));
draw(-2Y -- 2.5Y,arrow=Arrow3(emissive(black)), L=Label("$j\omega$", position=EndPoint));
draw(-1.5Z -- 80Z, arrow=Arrow3(emissive(black)), L=Label("$|G|$",position=EndPoint));
//
//
pair G(pair s) {
real theta, theta1, theta2;
real gain;
if (abs(ypart(Gnum(s))) > 0 && abs(xpart(Gnum(s))) >0 ) {theta1 = degrees(atan2(ypart(Gnum(s)),xpart(Gnum(s))));}
if (abs(ypart(Gden(s))) > 0 && abs(xpart(Gden(s))) >0 ) {theta2 = degrees(atan2(ypart(Gden(s)),xpart(Gden(s))));}
theta=theta1+theta2;
if (length(Gden(s)) > eps) {
gain = length(Gnum(s))/length(Gden(s));
}
else {
gain = large;
};
pair z=(gain,theta);
return (z);
}
// write(G(z));
real fx(pair s) {return (xpart(G(s)));}
real fy(triple v) {return (ypart(G((v.x,v.y))));}
//
pen[] Palette=Rainbow();
surface surf=surface(fx,(-2,-1.5),(2.5,1.5),N,Spline);
surf.colors(palette(surf.map(fy),Palette));
draw(surf,render(compression=Low,merge=true));
\end{asy}
\caption{$G(s)= (s+1)/(s-1)$ plotted in the $s$-plane}
\subcaption*{(Colours are phase angles using atan2$(\omega,\sigma)$. Green =0\degree)}
\label{fig:poleZeroPlot}
\end{center}
\end{figure}
\end{document}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Since it is a 3D rendering, could you precise the version
of Ghostscript (there are some recent changes in asymptote
to support recent version of Ghostscript, but linux distributions
have in general older version).
The error message seems to be related to Direct Rendering,
could you verify that 3D rendering is ok with another software ?
(perhaps glxgears can help).
O.G.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Found the problem: It's a KDE4 / Plasma thing. My code works perfectly under Bodhi Linux (on a very old PC). So it's nothing to do with TeXstudio settings, Asymptote, Ghostscript or anything else. See https://bugs.freedesktop.org/show_bug.cgi?id=86281
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Summary: I can plot a 3D surface on Windows 7, I used to be able to plot the same on Mageia 4, when I upgraded to Mageia 5 I get "Error: Command crashed: filename-1.asy" and using dmsg I see a segmentation fault.
Please help!!!
Detail:
GENERAL
Thank you for looking at this. :0)
The error I get from TexStudio is "Error: Command crashed: asy -noprc minimal3D-1.asy" (or "Error: Command crashed: asy filename-1.asy" if I don't use -noprc)
dmesg | grep asy
[ 1159.645219] asy[28118]: segfault at 1b150 ip 00007f6a4a0f2f61 sp 00007ffe09692fe0 error 4 in i965_dri.so[7f6a49ff5000+559000]
Please note three things:
1) My asymptote code works perfectly on Windows 7 (the problem is with a Linux implementation only) e.g. see pdf
2) My asymptote code used to work perfectly on Mageia 4; i.e. before I did a clean install of Mageia 5 (I have NOT changed the asymptote code)
3) Asymptote 2D works perfectly on both OSs (the problem just concerns 3D rendering on Mageia 5)
My thoughts:
- I think I am missing a dependency or some setting is wrong somewhere.
- It's not a Mageia 5 problem.
- It's not a TeXstudio problem.
- It's not a a bug in Asymptote
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SETTINGS WITHIN TEXSTUDIO (which uses TeXlive):
asymptote is started with either:
asy ?m.asy
or
asy -noprc ?m.asy
PDF viewer (and likewise PS, DVI) is set to either:
okular %.pdf > /dev/null
or
evince %.pdf > /dev/null
Build is set to:
txs:///asy-pdf-chain
Asymptote PDF chain is set to either:
txs:///latexmk | txs:///asy | txs:///latexmk | txs:///view-pdf
or
txs:///pdflatex | txs:///asy | txs:///pdflatex | txs:///view-pdf
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FROM THE ASYMPTOTE DOCUMENTATION:
1. CONFIG FILE
~/.asy/config.asy is:
import settings;
settings.outformat="pdf";
batchView=false;
interactiveView=true;
batchMask=false;
interactiveMask=true;
gs="/usr/bin/gsc";
pdfviewer="evince";
also tried other settings including:
gs="gs"; \eventually points to gsc as above
pdfviewer="okular";
INSTALLATION CHECK
TeXstudio 2.9.4 (hg :)
Using Qt Version 4.8.6, compiled with Qt 4.8.6 R
Asymptote 2.32 and xasy both installed.
The known 3D "bug" occurs if the following is missing:
/usr/share/texmf-dist/tex/latex/media9/media9.sty
it is not missing.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LAPTOP COMPUTER:
Linux version: Mageia 5, with KDE desktop
Linux localhost 3.19.8-desktop-3.mga5 #1 SMP Sat Jun 13 17:05:48 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
free
total used free shared buffers cached
Mem: 5988648 2070372 3918276 87980 57792 758644
-/+ buffers/cache: 1253936 4734712
Swap: 4191920 0 4191920
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CODE:
%%Description: Everything under control
%Options: KBD=VOID; STD=VOID; LANG=BRITISH; FMT=LATEX; HYPHEN=LATEX;
\documentclass[12pt]{article}
\usepackage{gensymb}
\usepackage{adjustbox}
\usepackage{wrapfig}
\usepackage[paper=a4paper]{geometry} %[margin=0.5in] shrinks margins to 0.5in
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[inline]{asymptote}
\begin{document}
\section{Plot of a pole and a zero}
\begin{equation}
G(s)=\frac{s+1}{s-1}
\end{equation}
We plot the function $G(s)$ for all values of $s=\sigma+j\omega$ over the range $(-2.5,-1.5)\le(\sigma, j\omega)\le(2.5,1.5)$. The
input' values are plotted in the normal complex plane, the
output' values are gain (height) and phase (colour.)There is an inherent ambiguity in how to measure $\pm 180\degree$. It is this that is responsible for the phase discontinuity. We have chosen the interval $-\pi\le\theta\le\pi$ but we could equally have chosen $0\le\theta\le2\pi$ or even $0\ge\theta\ge-2\pi$.
\begin{figure}
\begin{center}
\begin{asy}
import graph3;
import palette;
size(200,300,keepAspect=false);
currentprojection=orthographic(-4,-2,40);
currentlight=Viewport;
//currentlight=(10,10,20);
int N=100;
real eps=0.01;
real large=1/eps;
//
pair zero = (-1,0);
pair Gnum(pair snum) {return (snum.x - zero.x, snum.y - zero.y);}
//
pair pole = (1,0);
pair Gden(pair sden) {return (sden.x - pole.x, sden.y - pole.y);}
//
draw(-3X -- 4X, arrow=Arrow3(emissive(black)), L=Label("$\sigma$",position=EndPoint, align=W));
draw(-2Y -- 2.5Y,arrow=Arrow3(emissive(black)), L=Label("$j\omega$", position=EndPoint));
draw(-1.5Z -- 80Z, arrow=Arrow3(emissive(black)), L=Label("$|G|$",position=EndPoint));
//
//
pair G(pair s) {
real theta, theta1, theta2;
real gain;
if (abs(ypart(Gnum(s))) > 0 && abs(xpart(Gnum(s))) >0 ) {theta1 = degrees(atan2(ypart(Gnum(s)),xpart(Gnum(s))));}
if (abs(ypart(Gden(s))) > 0 && abs(xpart(Gden(s))) >0 ) {theta2 = degrees(atan2(ypart(Gden(s)),xpart(Gden(s))));}
theta=theta1+theta2;
if (length(Gden(s)) > eps) {
gain = length(Gnum(s))/length(Gden(s));
}
else {
gain = large;
};
pair z=(gain,theta);
return (z);
}
// write(G(z));
real fx(pair s) {return (xpart(G(s)));}
real fy(triple v) {return (ypart(G((v.x,v.y))));}
//
pen[] Palette=Rainbow();
surface surf=surface(fx,(-2,-1.5),(2.5,1.5),N,Spline);
surf.colors(palette(surf.map(fy),Palette));
draw(surf,render(compression=Low,merge=true));
\end{asy}
\caption{$G(s)= (s+1)/(s-1)$ plotted in the $s$-plane}
\subcaption*{(Colours are phase angles using atan2$(\omega,\sigma)$. Green =0\degree)}
\label{fig:poleZeroPlot}
\end{center}
\end{figure}
\end{document}
Hello
Since it is a 3D rendering, could you precise the version
of Ghostscript (there are some recent changes in asymptote
to support recent version of Ghostscript, but linux distributions
have in general older version).
The error message seems to be related to Direct Rendering,
could you verify that 3D rendering is ok with another software ?
(perhaps glxgears can help).
O.G.
Sorry about the delay and thank you for replying.
- The Ghostscript version is 9.14
- I will try "Blender" to check whether 3D animations can be done
Found the problem: It's a KDE4 / Plasma thing. My code works perfectly under Bodhi Linux (on a very old PC). So it's nothing to do with TeXstudio settings, Asymptote, Ghostscript or anything else. See https://bugs.freedesktop.org/show_bug.cgi?id=86281