The unique trouble with ninja during building chromium. (ninja: error: toolchain.ninja: lexing error) - build

I compile chromium from source code. I use a command gn args out/mybuild. The list of arguments:
proprietary_codecs=true
ffmpeg_branding="Chrome"
is_debug = false
dcheck_always_on = false
is_official_build = true
enable_nacl=false
blink_symbol_level=0
v8_symbol_level=0
chrome_pgo_phase = 0
The result is
Generating files...
Done. Made 18307 targets from 3100 files in 4850ms
Next step is autoninja -C out/mybuild chrome. Output is
ninja: Entering directory `out/mybuild'
ninja: error: toolchain.ninja:309: lexing error
I open the toolchain.ninja file with the error:
307 rule __base_build_date___build_toolchain_linux_clang_x64__rule
308 command = python3 ../../build/write_build_date_header.py gen/base/generated_build_date.h 1666540117\
309 \^[\[\?1034h
310 description = ACTION //base:build_date(//build/toolchain/linux:clang_x64)
308 and 309 lines are split. There are a lot of strings to be split like previous two. What type of formatting should I use? Or is there other reason?

The content of line 309 most likely shouldn't be there. It loks like some of the commands "gn gen" runs end up with trailing garbage. One reason for that could be if your python executable is a wrapper script that decorates output. I'd suggest trying
gn gen out/mybuild --script-executable=/usr/bin/python3.8
(or a different plain Python3 binary)
If it's not helping, I'd recommend adding something like
print(build_timestamp)
at the bottom of build/timestamp.gni, re-run gn, and see what it prints out, to try and figure out where the extra content comes from.

Related

How to resolve rmarkdown to latex errors involving tikz devices

I am trying to compile an rmarkdown document that includes a geographic plot into a PDF file. Here is a MWE:
---
title: "Problems with maps in tikz"
output: pdf_document
---
```{r setup, include=FALSE}
library(ggplot2)
library(sf)
```
## sf:png
Builds find when `nctikz` chunk is excluded.
```{r nc}
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
ggplot(nc) +
geom_sf(aes(fill = AREA))
```
## sf:tikz
This graphic fails to build.
```{r nctikz, dev = 'tikz'}
ggplot(nc) +
geom_sf(aes(fill = AREA))
```
I am compiling this document using the "Knit" button in RStudio. I'm going to discuss each of the errors / warnings I get when I compile the document in case one leads to the others.
tinytex
Every time I try to run a chunk that includes dev = 'tikz', tinytex will try to reinstall the pgf TeX package, then discover it's already there, then give up trying to link it. I'm able to build document with non-geographic tikz outputs, however, so I've mostly just accepted this fact.
tlmgr search --file --global '/tikzlibrarytopaths.code.tex'
Trying to automatically install missing LaTeX packages...
tlmgr install pgf
tlmgr: package repository http://mirror.utexas.edu/ctan/systems/texlive/tlnet (not verified: gpg unavailable)
tlmgr install: package already present: pgf
tlmgr path add
add_link_dir_dir: /usr/local/share/info/dir exists; not making symlink.
Invalid characters
Tikz (in knitr) seems unable to handle the degree symbol as part of a tex file. As a note, the nctikz-1.tex object can be built by pdflatex without issue.
! Package inputenc Error: Invalid UTF-8 byte "B0.
Quitting from lines 24-27 (test.Rmd)
Error: Failed to compile test_files/figure-latex/nctikz-1.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See nctikz-1.log for more info.
Underscore in filepath
I can get around the invalid characters error by suppressing the axis titles theme(axis.text = element_blank()) on my plot, but this then introduces another error dealing with bringing in a file.
! Missing $ inserted.
<inserted text>
$
l.3975 ...72.27pt,interpolate=true]{nctikz-1_ras1}
};
Quitting from lines 24-27 (test.Rmd)
The full line that generates this error is
\node[inner sep=0pt,outer sep=0pt,anchor=south west,rotate= 0.00] at (423.16, 120.24) {
\pgfimage[width= 14.45pt,height= 72.27pt,interpolate=true]{nctikz-1_ras1}};
The image it's trying to reference is barely an image (I think it's for the legend).
Environment
I am building this document on MacOS with a whole pile of libraries. In an effort to isolate the issue, I also attempted to build the document on Rstudio.cloud (Ubuntu) in a brand new project. In this environment, only the issue with the math environment / underscore occurs.
! Missing $ inserted.
<inserted text>
$
l.4049 ...72.27pt,interpolate=true]{nctikz-1_ras1}
};
Quitting from lines 26-28 (test.Rmd)
Error: Failed to compile test_files/figure-latex/nctikz-1.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See nctikz-1.log for more info.
Not a full answer, but I would like to document my current state:
It makes sense to enable debugging by adding
```{r, include=FALSE}
options(tinytex.verbose = TRUE)
```
to the Rmd file as suggested.
The pgf issue is sort of a red herring. With debugging we see that it happens after some other error occurs (illegal character or underscore in file path). The corresponding regular expression was recently introduced and should probably be extended to check for actual error messages from Tikz/pgf.
I can reproduce the illegal character on Debian Linux. Somehow ° is written as 0xB0, i.e. Latin-1 encoded instead of UTF-8. I am not sure why/where this is happening. BTW, I can process the resulting tex file directly with pdflatex only from RStudio, since that re-encodes the 0xB0 as a question mark. If I use pdflatex via Emacs or directly on the command line, I get the same error message.
Removing the degree symbol from the output via
```{r nctikz, dev = 'tikz'}
ggplot(nc) +
theme(axis.text = element_blank()) +
geom_sf(aes(fill = AREA))
```
I can reproduce the "underscore in file path" issue. With debugging turned on, one sees that the issue is again somewhere else:
Package pgf Warning: File "nctikz-1_ras1" not found when defining image "pgflas
timage". Tried all extensions in ".pdf:.jpg:.jpeg:.png:" on input line 3975.
! Missing $ inserted.
<inserted text>
$
l.3975 ...72.27pt,interpolate=true]{nctikz-1_ras1}
};
! ==> Fatal error occurred, no output PDF file produced!
The file nctikz-1_ras1.png that is present in the same directory as nctikz-1.tex is not found. One can reproduce this issue directly using
tinytex::latexmk("<path>/nctikz-1.tex", install_packages = FALSE, clean = FALSE)
However, if one changes to the directory first, no such error occurs:
setwd("<path>")
tinytex::latexmk("./nctikz-1.tex", install_packages = FALSE, clean = FALSE)

Cannot run Doxygen from Meson on a C++ project

I cannot run Doxygen through Meson's configuration.
This is the related code in meson.build:
doxygen = find_program('doxygen')
...
run_target('docs', command : 'doxygen ' + meson.source_root() + '/Doxyfile')
The doxygen executable is successfully found:
Program doxygen found: YES (/usr/bin/doxygen)
However, when launched, I get this error message:
[0/1] Running external command docs.
Could not execute command "doxygen /home/project/Doxyfile". File not found.
FAILED: meson-docs
Running it manually from the command line it works:
/usr/bin/doxygen /home/project/Doxyfile
doxygen /home/project/Doxyfile
What is wrong in my meson.build configuration?
According to reference manual,
command is a list containing the command to run and the arguments to
pass to it. Each list item may be a string or a target
So, in your case the whole string is treated by meson as command, i.e. tool name, not as command + arguments. So, try this:
run_target('docs', command : ['doxygen', meson.source_root() + '/Doxyfile'])
Or it could be better to use directly the result of find_program():
doxygen = find_program('doxygen', required : false)
if doxygen.found()
message('Doxygen found')
run_target('docs', command : [doxygen, meson.source_root() + '/Doxyfile'])
else
warning('Documentation disabled without doxygen')
endif
Note that if you want to improve docs generation with support of Doxyfile.in, take a look at custom_target() instead and example like this.

How to run opencv sample surf matcher?

I tried to run this sample code from opencv but I'm confused as to how to run it. It only shows this help message:
Usage: surf_matcher[options]
Available options:
Usage: surf_matcher_2.exe [params]
--cpu_mode, -m (value:false)
run without OpenCL
-h, --help (value:false)
print help message
-l, --1eft (value: box.png)
specify left image
-o, --output (value: SURF output . jpg)
specify output save path
-r, --right (value: box in scene.png)
specify right image
From my basic understanding of arguments, I tried many kinds of input arguments as follows:
-l box.png -r box_in_scene.png
--left box.png --right box_in_scene.png
--l box.png --r box_in_scene.png
But it still did not work. It did have this error but built successfully:
Severity Code Description Project File Line Suppression State
Error (active) the default constructor of "SURFMatcher<cv::BFMatcher>" cannot be referenced -- it is a deleted function surf_matcher_2 c:\Users\user\Documents\Visual Studio 2015\Projects\surf_matcher_2\surf_matcher_2\surf_matcher_2.cpp 195
I got it to run a long time ago but replicating the old project didn't work either.
The syntax to use for CommandLineParser is a bit different. You need to put = after the option. Like this:
-l=box.png -r=box_in_scene.png -o=out.png
or
--left=box.png --right=box_in_scene.png --output=out.png
Be sure to put the correct path for the images.

openssl-1.0.1f msys/mingw64 build fail

I am getting an error building openssl-1.0.1f with msys/mingw64:
installing libcrypto.a
/bin/sh: line 5: mingw64bin/ranlib.exe: No such file or directory
installing libssl.a
/bin/sh: line 5: mingw64bin/ranlib.exe: No such file or directory
make: *** [install_sw] Error 1
when I run .Configure I get:
ENGINES_OBJ =
PROCESSOR =
RANLIB =\mingw64\bin/ranlib.exe
ARFLAGS =
PERL =perl
Soooooo seems pretty easy I just need to change the backslashes to slashes
I open .Configure and search for Ranlib and I get:
my $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib];
Farther down:
\$\(CROSS_COMPILE\)$cc/;
s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/;
s/^NM=\s*/NM= \$\(CROSS_COMPILE\)/;
s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/;
Oookkeeee why not change \s*/RANLIB= \$(CROSS_COMPILE)/; to \s*/RANLIB= /$/(CROSS_COMPILE)/;
Scalar found where operator expected at ./Configure line 1619, near "s/^RANLIB=\s*/RANLIB= /$/"
Backslash found where operator expected at ./Configure line 1619, near "CROSS_COMPILE\"
syntax error at ./Configure line 1619, near "s/^RANLIB=\s*/RANLIB= /$/"
Execution of ./Configure aborted due to compilation errors.
How I feel:
http://i0.kym-cdn.com/photos/images/original/000/234/765/b7e.jpg
For those still wondering, yes I am a beginner.
Soooo my questions:
Is ranlib path the real problem here? If so, how can I make msys see slashes instead of backslashes? If you know the answer, do you think you can use concise and clear explanations?
I suspect you are trying to build OpenSSL not from the MSYS console.
You should run these commands from the MSYS console (to start it, use C:\msys64\msys.bat):
perl Configure mingw64 --prefix=/wherever-you-need-to-put-it
make
make test
make install
P.S. MSYS should be configured for using MinGW: you should create a file C:\msys64\etc\fstab with a line like this (adjust the first part if it is different on your machine).
c:/mingw64 /mingw

How to generate a C++ header with Apache Avro (python script)

I am interested in generating a C++ header using Apache Avro's code generation tool (i.e. the python script). According to the documentation it should be fairly easy to do, but I don't usually use python, so things look kinda strange to me.
The instructions state:
To generate the code is a two step process:
precompile < imaginary > imaginary.flat
The precompile step converts the schema into an intermediate format that is used by the code generator. This intermediate file is just a text-based representation of the schema, flattened by a depth-first-traverse of the tree structure of the schema types.
python scripts/gen-cppcode.py --input=example.flat --output=example.hh –-namespace=Math
This tells the code generator to read your flattened schema as its input, and generate a C++ header file in example.hh. The optional argument namespace will put the objects in that namespace...
My Issue (no, I can't see a doctor or use a cream for it):
I don't see anything that explains in details how to precompile. The documentation makes it seem like if I just type "precompile" in the command prompt and supply the command line arguments, then things would magically work, but precompile is not a valid Windows command. So what's the proper way to precompile on Windows? If anybody knows how to do it, then PLEASE let me know!
I also tried to run the gen-cppcode.py script, but it gets an error in line 316 (which, I suspect, may be happening because I didn't precompile the schema):
def doEnum(args):
structDef = enumTemplate;
typename = args[1]
structDef = structDef.replace('$name$', typename)
end = False
symbols = '';
firstsymbol = '';
while not end:
line = getNextLine()
if line[0] == 'end': end = True
elif line[0] == 'name':
if symbols== '' :
firstsymbol = line[1]
else :
symbols += ', '
symbols += line[1]
else: print "error" // <-- Syntax Error: invalid syntax
structDef = structDef.replace('$enumsymbols$', symbols);
structDef = structDef.replace('$firstsymbol$', firstsymbol);
addStruct(typename, structDef)
return (typename,typename)
About the only way I figured to do this is to:
Download VirtualBox.
Install Ubuntu (or another distro).
Download Avro.
Install cmake.
Install the C++ compilers (build essential).
Install boost, flex, bison (sudo apt-get install boost flex bison); btw, you will specifically need these boost libraries:
-- regex
-- filesystem
-- system
-- program_options
Build Avro:
$ tar xf avro-cpp-1.5.1.tar.gz
$ cd avro-cpp-1.5.1
$ cmake -G "Unix Makefiles"
$ make -j3
$ build/precompile file.input file.flatoutput
You can now generate a header file (still in the terminal window of the VM):
python scripts/gen-cppcode.py --input=example.flat --output=example.hh
Note that even after you generate the C++ file, you will still be unable to build with it in Windows (even if you have the right dependency includes to the avro-cpp-1.5.1/api. Avro has dependencies on GNU libraries (such as sys/uio.h) and I'm not sure how to specifically resolve them yet.
I found that it is required python version 2 to run gen-cppcode.py
https://www.python.org/downloads/