I download iasl 20190509 version in Ubunt18.04.5 LTS. When I use "make iasl" command to build the package, I get this error:
$ make iasl
make[1]: Entering directory 'acpica-unix2-20190509/generate/unix/iasl'
- bison obj/aslcompiler.y
acpica-unix2-20190509/generate/unix/iasl/obj/aslcompiler.y:1.1: error: syntax error, unexpected end of file
mv: cannot stat 'obj/AslCompiler.LLW4kB/y.tab.h': No such file or directory
Makefile:322: recipe for target 'obj/aslcompiler.y.h' failed
make[1]: *** [obj/aslcompiler.y.h] Error 1
make[1]: Leaving directory 'acpica-unix2-20190509/generate/unix/iasl'
generate/unix/Makefile.common:7: recipe for target 'iasl' failed
make: *** [iasl] Error 2
Please help me fix this error.
Please help me build iasl.
CodePudding user response:
The solution was to retry the make
but making sure that the build directory is clean first:
$ make clean && make
Here's my best guess as to what happened:
- An attempt was made to build the software package.
- That attempt failed because the
m4
tool had not previously been installed. - OP installed m4, and reran the build with
make
. - Because of an inadequacy in the provided
Makefile
,make
did not attempt to runm4
again. (See below.) Consequently, processing of the file supposedly generated bym4
failed.
This software package relies on m4
to create the source for bison
by interpolating various component files. (Yacc/Bison doesn't have an include
feature, so m4
is the usual solution.) However, the command to run m4
is roughly (with paths simplified):
$ m4 aslparser.y > aslcompiler.y
When the shell executes this command, it creates or truncates aslcompiler.y
before even attempting to invoke m4
. If it turns out that m4
can't be found, or if m4
produces some sort of error, you end up with an empty or partial output file.
The make
target aslcompiler.y
is satisfied by this artefact, since make
only cares that the target was created later than its dependencies. So the next invocation of make
goes on to the next step (bison aslcompiler.y
), which fails because aslcompiler.y
is empty.
The Makefile
would have been better written to use a command like:
$ m4 aslparser.y > /tmp/aslcompiler.y && mv /tmp/aslcompiler.y aslcompiler.y
in order to avoid creating the target if m4
failed. Of course, that's not your responsibility. It could be reported as a bug to the iASL project. (The Makefile
already uses this strategy to safely handle the files generated by Bison, so it's not really anything new.)