What does this Ghostscript error message mean? - ghostscript

I get this error message from a Ghostscript call:
Error: /syntaxerror in -file-
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
--nostringval-- --nostringval-- false 1 %stopped_push 1926 1 3 %oparray_pop 1925 1 3 %oparray_
pop 1909 1 3 %oparray_pop 1803 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostr
ingval-- --nostringval-- --nostringval-- 2 %stopped_push
Dictionary stack:
--dict:1169/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)--
Current allocation mode is local
Current file position is 215
GPL Ghostscript 9.05: Unrecoverable error, exit code 1
Does it mean that there is problem in the input Postscript file or does it mean something is wrong with my call or the installation?
The call was:
ps2pdf book.ps book.pdf
The input file book.ps exists in the current directory.
Is there a list of Ghostscript error messages and what they mean somewhere? (Google was not my friend in this case.)

This is not a Ghostscript error message, its a PostScript error message. The PostScript error messages are defined in the PostScript Language Reference Manual. Syntaxerror means pretty much what it says, the PostScript program contained a syntax error.
Things you can try:
Execute Ghostscript on the PostScript file to render the page, does it work ? (You don't say what OS you are suing but something like gs book.ps ought to work)
Try using Ghostscript directly instead of the ps2pdf script which merely wraps it. Again something like gs -sDEVICE=pdfwrite -o book.pdf book.ps
One of these may help by either working or giving more explicit errors.

Related

Strange error on ghostscript conversion ps to pdf

I am using linux (ubuntu 9.26) version of ghostscript. When I try to convert the postscript file into pdf using the following:
$ gs -dNOPAUSE -dBATCH -sOutputFile=test.pdf -sDEVICE=pdfwrite -c . setpdfwrite -f d00040-001.ps
The output I get is the following:
GPL Ghostscript 9.26 (2018-11-20)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /undefined in .
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
--dict:970/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)--
Current allocation mode is local
GPL Ghostscript 9.26: Unrecoverable error, exit code 1
```
Where can I look and how can I debug the above issue?
Leave out the "-c . setpdfwrite -f" from your command line.

ghostscript gives error when converting pdf to ps

I cannot convert pdf to ps or ps to pdf. an example is given below. Please someone help me.
GS>pdf2ps f.pdf
Error: /undefined in pdf2ps
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- %loop_continue --nostringval-- --nostringval-- false 1 %stopped_push .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
--dict:1199/1684(ro)(G)-- --dict:0/20(G)-- --dict:78/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 7
pdf2ps is a shell script, not a PostScript program. You appear to have started the interpreter and reached the interactive prompt, which probably means you started Ghostscript without any arguments on the command line.
Either:
Use the pdf2ps script from the shell, it will launch Ghostscript with default arguments to create a PostScript file from the specified argument
Use Ghostscript with appropriate command line arguments (eg -sDEVICE=ps2write) to do the conversion yourself.
If you choose the latter route you will have to understand at least the basics of the Ghostscript command line options, but it will give you better control.

What does numbers in make[1] make[2] make[3] mean?

For example I get an error like this when running makefile:
make[3]: *** [/home/ziga/Downloads/openwrt/rakun_openwrt/staging_dir/host/stamp/.upx_installed] Error 1
make[2]: *** [tools/upx/install] Error 2
make[1]: *** [/home/ziga/Downloads/openwrt/rakun_openwrt/staging_dir/target-powerpc_uClibc-0.9.33.2/stamp/.tools_install_nynnn] Error 2
What does the number in the square brackets in make[3], make[2] and make[1]. I am not trying to solve this curent error. I am just curious about the syntax.
Basicly it shows the deepth of recursion

make error: "make[1]: *** [directories] Error 1"

When I try to run "make all" on a makefile with some complexity I get this errors:
C:\BITCLOUD\BitCloud_PS_SAM3S_EK_1_10_0\BitCloud_PS_SAM3S_EK_1_10_0\Applications\ZAppSi\Dem o\SEDevice>make all
make -C makefiles/PC -f Makefile_PC_Gcc all APP_NAME=DemoSE
make[1]: Entering directory
'C:/BITCLOUD/BitCloud_PS_SAM3S_EK_1_10_0/BitCloud_PS_SAM3S_EK_1_10_0/Applications/ZAppSi/Demo/SEDevice/makefiles/PC'
A sintaxe do comando está incorrecta.
make[1]: *** [directories] Error 1
make[1]: Leaving directory
'C:/BITCLOUD/BitCloud_PS_SAM3S_EK_1_10_0/BitCloud_PS_SAM3S_EK_1_10_0/Applications/ZAppSi/Demo/SEDevice/makefiles/PC'
make: *** [all] Error 2
where the line
A sintaxe do comando está incorrecta.
translated to english means: "The syntax of the command is incorrect"
I already tried to change the project to different directories, check spaces in file names, using GNU make and also use MinGW make (mingw32-make) and the result is the same with both "make". I also checked for all files that are included in the makefile and they correspond.
Im not an expert in makefiles, so Im asking for help.
What is the main problem that occurs when make throws this type of error?
It is likely not make that throws this error, but a command executed by make returns with a nonzero exit status, in this case with status 1 (due to Error 1); then the top level make stops with Error 2. Note that make by default stops as soon as a command fails.
Since the output doesn't show what command was executed, there is no way to tell what went wrong exactly.
EDIT: from the GNU make manual:
-d Print debugging information in addition to normal processing.
The debugging information says which files are being considered
for remaking, which file-times are being compared and with what
results, which files actually need to be remade, which implicit
rules are considered and which are applied---everything inter‐
esting about how make decides what to do.
--debug[=FLAGS]
Print debugging information in addition to normal processing.
If the FLAGS are omitted, then the behavior is the same as if -d
was specified. FLAGS may be a for all debugging output (same as
using -d), b for basic debugging, v for more verbose basic
debugging, i for showing implicit rules, j for details on invo‐
cation of commands, and m for debugging while remaking make‐
files.
I suggest running make --debug=j to see the commands.

Leaving directory.....?

When I am compiling my code with makefiles (I have 12 makefiles) there is an error telling
make.exe[1]: Leaving directory Error 2 what is the reason for this?
Also what does the "Error 2 or Error 1 " mean?
When make prints "Error 2" in this context it just means that there was an error in a recursive make invocation. You have to look at the error messages preceeding that message to determine what the real problem was, in the submake. For example, given a Makefile like this:
all:
$(MAKE) -f sub.mk
... and a sub.mk like this:
all:
#exit 1
When I run GNU make, it prints the following:
gmake -f sub.mk
gmake[1]: Entering directory `/tmp/foo'
gmake[1]: *** [all] Error 1
gmake[1]: Leaving directory `/tmp/foo'
gmake: *** [all] Error 2
Error 2 tells me that there was an error of some sort in the submake. I have to look above that message, to the Error 1 message from the submake itself. There I can see that some command invoked while trying to build all exited with exit code 1. Unfortunately there's not really a standard that defines exit codes for applications, beyond the trivial "exit code 0 means OK". You have to look at the particular command that failed and check its documentation to determine what the specific exit code means.
These error messages have nothing to do with Unix errno values as others have stated. The outermost "2" is just the error code that make itself assigns when a submake has an error; the inner "1" is just the exit code of a failed command. It could just as easily be "7" or "11" or "42".

Resources