libpng
libpng copied to clipboard
Сannot compile lpng1638 and older
[ 1%] Generating pnglibconf.c options.awk: bad line (10): com CMake Error at scripts/gensrc.cmake:68 (message): Failed to generate pnglibconf.tf5
There is no such thing as bad line (10): com
in scripts/options.awk.
Could your source possibly be corrupt?
I download the source from here: https://libpng.sourceforge.io/
I need more context information, because I cannot deduce anything from what you reported so far.
The origin is intact. I was asking about your source, on your machine. What's in your scripts/options.awk, at line 10? Also, on what operating system are you building? Also, what's your build command? Etc.
The correct content of scripts/options.awk is this: https://github.com/pnggroup/libpng/blob/master/scripts/options.awk
As you can see, there is no bad line (10): com
, neither on GitHub, nor at https://libpng.sourceforge.io/
I configure with CMake, specifying only BUILD_TYPE, INSTALL_PREFIX and the path to my zlib build. Then I run make and make install. OS - Manjaro Linux (GCC and Mingw-w64). Version 1.6.37 was built without problems. My options.awk: options.zip
Here is the full text of the error:
[ 1%] Generating pnglibconf.c options.awk: bad line (10): com CMake Error at scripts/gensrc.cmake:68 (message): Failed to generate pnglibconf.tf5
make[2]: *** [CMakeFiles/pnglibconf_c.dir/build.make:75: pnglibconf.c] Ошибка 1 make[1]: *** [CMakeFiles/Makefile2:140: CMakeFiles/pnglibconf_c.dir/all] Ошибка 2 make: *** [Makefile:146: all] Ошибка 2 Press ENTER to exit...
The file options.awk is generated by CMake in the folder "Build", and the source I download from here: http://sourceforge.net/project/showfiles.php?group_id=5624 link on the project home page: https://github.com/glennrp/libpng - libpng.sf.net.
If you do not create the "Build" directory, but compile the library into the source folder, nothing changes, the same error results.
@cosmin: options.awk is the name of the source file (scripts/options.awk) which is reporting the error. You will deduce that I wrote that file. You are looking at an error message: options.awk has detected an error at line "10" of the input. Not line 10 of options.awk (think compiler error messages).
So search for "bad line" in scripts/options.awk; my code was somewhat terse. The error message is at line 500. The comments above may help.
Since it is NR==10 then it's pretty soon into the parse. Shouldn't be hard to find, not.
@jbowler wrong Cosmin. Perhaps @ctruta
There is no such thing as
bad line (10): com
in scripts/options.awk. Could your source possibly be corrupt?
I don't know for sure exactly what command cmake is running but, assuming "scripts/gensrc.cmake" is the same as "scripts/gensrc.cmake.in" the first, preprocessing, command (which generates pnglibconf.tf4 apparently succcessfully) is something like:
awk -f scripts/options.awk out=pnglibconf.tf4 version=search pngconf.h scripts/pnglibconf.dfa pngusr.dfa
Then the one which is failing (as reported by cmake in the OP) will be:
awk -f scripts/options.awk out=pnglibconf.tf5 pnglibconf.tf4
So it would be around line 10 of pnglibconf.tf4 and, since that is derived from scripts/pnglibconf.dfa, that makes sense as line 9 is "version" and both 8 and 10 are "com" (as in comment).
The easiest way to discover what is going on is for @daniilpetrov to supply pnglibconf.tf4 and, to be safe, pngconf.h and pnglibconf.tf5 (they should all be in ${SRCDIR}). There's something weird about the "com" handling (line 203 of scripts/options.awk). It looks like the match is failing. My guess is that the version number line in pngconf.h has a weird line ending but nothing else does, so line 120 of scripts/options.awk ends up with "version" being something that ends in a spurious control character, causing the next line (10) to have something invisible prepended to the "com".
I note that some parts of CMakeLists.txt are apparently trying to do crlf->lf conversion and I note that LANG is set to, I think, "ru". Either could cause problems if it isn't just something weird in the version number from pngconf.h It should be obvious from a careful examination of pnglibconf.tf4, I suggest using od -c