Error from gawk about backslash line ending when running configure script - awk

I am getting an error when compiling sqlcipher. I'm unable to run ./configure
Could someone help fix the error?
gawk: /mkopcodeh.awk:101: backslash not last character on line.

If anyone else runs into this: the awk error seems to be caused by different line endings. If you check out the sources on Windows, take care to not have the line endings changed to Windows CR/LF. Instead, stick to LF (Unix/Mac format) only. You can also change the encoding of the offending file with any decent editor later on (I just did with Notepad++ using the menu item Edit->EOL conversion).

Related

nand2tetris CPUEmulator says 'Illegal character'

I'm studying the online course from nand2tetris.com through Coursera. When I try to run the nand2tetris CPUEmulator I get the error message 'Illegal character'. Even the simplest program with one command '#0' I get the error message. I tried indenting 0-10 spaces, and I tried the binary version of the command '0000000000000000' and I still get the error message. To run the emulator I'm using a MacBook and I type the command 'CPUEmulator.sh' into the terminal. I'm using TextEdit with Plain Text format. I named the file 'test.hack'. What am I doing wrong?

Error: Bad character (ASCII 0) encountered in BigQuery

I'm trying to upload a CSV file to Bigquery, but I get the following error:
Error: Bad character (ASCII 0) encountered (bigquery)
I've tried the following, but none of this are working:
a) Open the file as save it as "UTF-8" in notepad.
b) Open the file in notepad++ and use the option "Search characters by type" - Non ASCII. Didn't find any character
c) Use notepad++ with the followings regular expressions, didn't find any character:
[^\x00-\x7F] and [^\x1F-\x7F].
d) Use the following command:
gsutil cp gs://bucket_987234/compress_file.gz - | gunzip | tr -d '\000' | gsutil cp - gs://bucket_987234/uncompress_and_clean_file
Didn't work: "tr" is not recognized as a command (I'm using windows 10 and I don't have access to a VM of google.)
d) Open the file and deleted the first row, then it worked. But i've lost a line of data, and I have thousand of files.
The trouble is that I need to automate the "cleaning" of this files.
How can I clean this file in Windows, Any idea about what else can this "ASCII 0" character or how to get rid of it?
Thanks!!
You can use a GitBash on your machine? If you can, I would recommend you using this.
cat -v filename
For example, I have created a file called TESTINGCAT.txt with three lines, which visually has 7 empty spaces. However, if you count spaces with notepad++ you will find just 5 because 2 of those empty spaces are "non-breaking spaces" generated by typing ALT + 0160. Below you can see that I have on Notepad++
However, if I use cat -v TESTINGCAT.txt I can see M-BM- characters, which according to this are non-breaking spaces
Therefore, if you do not have access to a Linux machine, you should try using GitBash to see the hidden characters in your file.

Using cmake to compare_files with different line endings

I'm using cmake to compare two files like this:
cmake -E compare_files file1 file2
The trouble is that file1 and file2 have different line endings. I'm using cmake because I already use that for my build; the above command is in my testing.
I don't need anything special at this point. Just a way to tell the user that the files are different. (Hopefully there are no differences.) If there are differences, I'll just report it at this point and manually inspect more closely.
If there is a convenient way of reporting (e.g., print to screen or write to a file) then I'm open to suggestions on how to make that happen. But I'm really just interested in knowing if there are differences and different line endings are unimportant.
Is there a flag or an option that I'm missing that will ignore the difference in line endings?
Unfortunately it seems to be an unsupported feature (issue is "tracked" here, doesn't look like it will ever be handled).
But there's a workaround: you can use configure_file to create a copy of the files with a uniform row endings before starting the comparison. For example:
configure_file(<input> <output> NEWLINE_STYLE CRLF)
Note that the option COPYONLY is not compatible with NEWLINE_STYLE, so you'll have to take care configure_file doesn't make any unintended variable substitution.
With CMake 3.14 you can now do:
cmake -E compare_files --ignore-eol file1 file2

Accurev: How to keep/promote with a multi line comment from the command line?

How to keep/promote with a multi line comment from the accurev command line?
For example if I try:
accurev stat -n -fl | xargs accurev keep -c "git log 1234..4311"
I simple get the error:
You can not use non-printable characters on the command line: # On
branch master\x0a... AccuRev was unable to understand your command.
I can of course strip out the new lines but then the comment is not really useful.
AccuRev commands that take a -c option for a comment must currently be enclosed in quotes and have no line breaks.
As for the output from git log 1234..4311 that could be captured as a manifest file and kept with the other files.
Dave
I'm not sure about doing it directly from the command-line without any extra step, and I'm hesitant to try anything on my client's AccuRev setup. That said, according to the entry on accurev keep from the CLI manual:
–c <comment>
Specify a comment for the transaction. The next command-line argument should be
a quoted string. Alternatively, the next argument can be in the form
#<comment-file>, which uses the contents of text-file <comment-file> as the
comment.
Default: enter a comment interactively, using the text editor named in
environment variable EDITOR (or a system-dependent default editor).
Reading this, I see two ways you can do what you want from the command line (meaning, not using the GUI).
1.) Pipe or cat your stat info into file, the use the #file syntax to get it into your commit
2.) Get your stat into into your clipboard, then don't give an argument to the keep command, let your editor open up, paste, save, and close.
There may be a way to get this all done via CLI without these middle-steps (perhaps you need to format the \x0a into \r\n or something?), but as I said, I'm unwilling to try it on my AccuRev setup as AccuRev gives me (and everyone else) enough trouble as it is.
HTH

How to use Doxygen with Xcode?

I'm trying to use Doxygen with Xcode. I followed the Apple tutorial. After several mistakes, I builded the project and generated the docs. I discovered that if you save the doxygen.config from Doxygen and you use space " " in the directory name you will have problem and others things.
But there is one last problem:
./search/search.png
./tab_b.gif
./tab_l.gif
./tab_r.gif
./tabs.css
/Developer/usr/bin/docsetutil index com.mycompany.DoxygenExample.docset
2010-03-31 12:30:53.847 docsetutil[46338:807] Error converting XML to CoreData: Error Domain=NSXMLParserErrorDomain Code=76 UserInfo=0x1247d0 "Line 8: Opening and ending tag mismatch: Subnodes line 0 and Node
"
Failed to create docset indexer object
make: *** [docset] Error 1
load documentation set with path "/Users/WB/Library/Developer/Shared/Documentation/DocSets/"
I don't know what is the problem?? Any idea?
I'm using Core Data - sqlite.
The parser is telling you XML is not well formed, but that error usually shows because nothing has been generated BEFORE running docsetutil.
First thing should be to go over the many lines of console output and look for warnings, probably is there. Also look for the docset you generated and right click > Show Contents. If you don't see a lot of html files with the documentation, same thing: you failed at generating documentation and docsetutil has nothing to do. And btw, it's docsetutil who is using CoreData, doesn't matter if you use it on your project or not.
I don't get why Apple doesn't provide a doxygen-like tool more tightly integrated. Or a better code formatter than Crustify. Just take the damn tools and improve them a little bit. Argh!
There is a know bug from generation of Nodes.xml by Doxygen. It is referenced here https://bugzilla.gnome.org/show_bug.cgi?id=671591 and should be corrected in the next doxygen Version (Post V 1.8.0) :
At the end of the Nodes.xml there is an additional
the -silence option is workaround to suppress error, but this param does not allow dosetgeneration to work properly.
$DOXYGEN_PATH $TEMP_DIR/doxygen.config
make -C $TEMP_DIR/DoxygenDocs.docset/html install
Insert following code
Note : The script works in $TEMP_DIR and not in SOURCE_ROOT as AppleScript
$DOXYGEN_PATH $TEMP_DIR/doxygen.config
# make will invoke docsetutil. Take a look at the Makefile to see how this is done.
LINE=`xmllint --c14n $TEMP_DIR/DoxygenDocs.docset/html/Nodes.xml 2>&1 | awk 'NR == 1 {print $1}' | cut -d':' -f 2`
ECHO $LINE
if [ $LINE -gt 0 ]
then
echo "XML Cleaning "
sed -i.bak $LINE'd' $TEMP_DIR/DoxygenDocs.docset/html/Nodes.xml
fi
make -C $TEMP_DIR/DoxygenDocs.docset/html install
NB: awk and sed may certainly be combined in one line.
So the long story short is that the script creates a Doxyfile on the fly, and it does not recursively scan all subdirectories.
Take a look at this post:
http://www.duckrowing.com/2010/03/18/documenting-objective-c-with-doxygen-part-ii/
There's a script included on the second post that is based on Apple's script that shouldn't have this issue.
I use an extended version of the above script but based on the same priniciples. Although everything works fine on another project this time my script fails.
The generation of the docset works fine but the make command produces the following error.
x ./search/search_r.png
2010-07-26 17:36:01.815 docsetutil[8441:903]
Error converting XML to CoreData:
Error Domain=NSXMLParserErrorDomain
Code=76
UserInfo=0x1006105e0
"Line 8: Opening and ending tag mismatch: Subnodes line 0 and Node"
Failed to create docset indexer object
make: *** [docset] Error 1
The make command I use is: make --silent -C "$DOCSET_OUTPUT/html" install.
I added line breaks to the error message for readability.