I cloned grub from Github https://github.com/coreos/grub, however it fails to compile and gives error. The error seems obvious but the point is how the upstream code is not compiling. Am I doing anything wrong?
I did below things to compile :
./autogen.sh
./configure --target=x86_64 --with-platform=efi
make
I get this error :
grub_script.yy.c: In function ‘yy_fatal_error’:
grub_script.yy.c:19:22: error: statement with no effect [-Werror=unused-value]
#define fprintf(...) 0
^
grub_script.yy.c:2367:2: note: in expansion of macro ‘fprintf’
fprintf( stderr, "%s\n", msg );
^
cc1: all warnings being treated as errors
Makefile:35746: recipe for target 'normal_module-grub_script.yy.o' failed
make[3]: *** [normal_module-grub_script.yy.o] Error 1
make[3]: Leaving directory '/tmp/grub-2.02/grub-core'
Makefile:23531: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/tmp/grub-2.02/grub-core'
Makefile:10904: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp/grub-2.02'
Makefile:3130: recipe for target 'all' failed
make: *** [all] Error 2
I tried with gcc 4.8,5 as well as 7, but the same error. My host machine is Ubuntu-18 64-bit.
As #jens comments, the upstream maintainers should fix this build break. On the
face of it the fix seems simple. Meantime a workaround is simple too, and almost certainly safe.
As you see from the failing build log, you get this compilation error only
because the -Werror flag is in effect, to promote all warnings to errors.
The promoted warning that is breaking your build occurs in file grub_script.yy.c at line 2367.
It is in fact innocuous warning. You can cause it not to be promoted in either of two ways:-
The ./configure script has an option --disable-werror, which removes the -Werror
flag from all compilations. So you can run:
$ ./configure --target=x86_64 --with-platform=efi --disable-werror
$ make
This solution will cause no compilation warnings to be promoted to errors, and
is likely what you are "supposed" to be content with. You might prefer a somewhat more focussed workaround that disables
error-promotion only for the type of warning that actually broke your build:
statement with no effect [-Werror=unused-value]
You can accomplish that with:
$ ./configure --target=x86_64 --with-platform=efi CPPFLAGS=-Wno-error=unused-value
$ make
Related
I like to compile and use gdb 9.1. the source is here https://ftp.gnu.org/gnu/gdb/
Plus when I type make in config directory make says make: *** No targets specified and no makefile found. Stop. because there is not make file. on root folder there are Makefile.in and Makefile.tpl and Makefile.def. what are these files. and how can I install gdb 9 from source code.
Update
After the comment changes I made in command by G.M I am getting this error I think almost at the end of compiling process
mv GDBvn.new GDBvn.texi
/home/fawad/Desktop/gdb/gdb/gdb-9.1.1/missing makeinfo --split-size=5000000 --split-size=5000000 -I /home/fawad/Desktop/gdb/gdb
/gdb-9.1.1/gdb/doc/../../readline/readline/doc -I /home/fawad/Desktop
/gdb/gdb/gdb-9.1.1/gdb/doc/../mi -I /home/fawad/Desktop/gdb/gdb/gdb-9.1.1/gdb/doc
-o gdb.info /home/fawad/Desktop/gdb/gdb/gdb-9.1.1/gdb/doc/gdb.texinfo
/home/fawad/Desktop/gdb/gdb/gdb-9.1.1/missing: 81: makeinfo: not found
WARNING: 'makeinfo' is missing on your system.
You should only need it if you modified a '.texi' file, or
any other file indirectly affecting the aspect of the manual.
You might want to install the Texinfo package:
http://www.gnu.org/software/texinfo/
The spurious makeinfo call might also be the consequence of
using a buggy 'make' (AIX, DU, IRIX), in which case you might
want to install GNU make:
http://www.gnu.org/software/make/
make[4]: *** [Makefile:490: gdb.info] Error 127
make[4]: Leaving directory '/home/fawad/Desktop/gdb/gdb/gdb-9.1/build/build/gdb/doc'
make[3]: *** [Makefile:2010: subdir_do] Error 1
make[3]: Leaving directory '/home/fawad/Desktop/gdb/gdb/gdb-9.1/build/build/gdb'
make[2]: *** [Makefile:1655: all] Error 2
make[2]: Leaving directory '/home/fawad/Desktop/gdb/gdb/gdb-9.1/build/build/gdb'
make[1]: *** [Makefile:9564: all-gdb] Error 2
make[1]: Leaving directory '/home/fawad/Desktop/gdb/gdb/gdb-9.1/build/build'
make: *** [Makefile:852: all] Error 2
I am trying to compile Ruby 2.4.5 from source using gcc compiler on AIX 7.1. The configure works fine, but the make fails giving an error C is not a recognized flag. Anybody faced the same issue and managed to compile ruby on AIX 7.1?
Steps followed:
1) ./configure --disable-install-doc CC="gcc" CFLAGS="-maix64 -mminimal-toc" CXX="g++" CXXFLAGS="-maix64 -mminimal-toc" NM="nm -X64" AR="ar -X64" LDFLAGS="-maix64" EXTLDFLAGS=" -- works perfectly fine
2) make - fails with the below error
make: Not a recognized flag: C
usage: make [-einqrst] [-k|-S] [-d[A|adg[1|2]mstv]] [-D variable] [-f makefile] [-j [jobs]] [variable=value ...] [target ...]
make: 1254-004 The error code from the last command is 2.
Stop.
make: 1254-004 The error code from the last command is 2.
Stop.
make: 1254-004 The error code from the last command is 2.
Update :
Switching to GNU make gives the below error:
Making all in man
make[5]: Entering directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1/man'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1/man'
make[5]: Entering directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1'
CC src/prep_cif.lo
CC src/types.lo
CC src/raw_api.lo
CC src/java_raw_api.lo
CC src/closures.lo
CC src/powerpc/ffi_darwin.lo
../../../../ext/fiddle/libffi-3.2.1/src/powerpc/ffi_darwin.c: In function 'ffi_p rep_args':
../../../../ext/fiddle/libffi-3.2.1/src/powerpc/ffi_darwin.c:112:17: warning: un used variable 'abi' [-Wunused-variable]
const ffi_abi abi = ecif->cif->abi;
^
CPPAS src/powerpc/aix.lo
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
Makefile:1335: recipe for target 'src/powerpc/aix.lo' failed
make[5]: *** [src/powerpc/aix.lo] Error 1
make[5]: Leaving directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1'
Makefile:1596: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1'
Makefile:730: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/test/ruby-2.4.5/tst/ext/fiddle/libffi-3.2.1'
Makefile:370: recipe for target 'libffi-3.2.1/.libs/libffi_convenience.a' failed
make[2]: *** [libffi-3.2.1/.libs/libffi_convenience.a] Error 2
make[2]: Leaving directory '/test/ruby-2.4.5/tst/ext/fiddle'
exts.mk:212: recipe for target 'ext/fiddle/all' failed
make[1]: *** [ext/fiddle/all] Error 2
make[1]: Leaving directory '/test/ruby-2.4.5/tst'
uncommon.mk:220: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
The issue is that you are using AIX's built-in copy of make and it does not support the command-line option -C. That option is available in GNU make.
If you run make -v and do not see output like the following then you are not using GNU make:
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
Run the command which make and it will return either /usr/bin/make or /opt/freeware/bin/make (or a similar path outside of /usr/bin):
If it returns /usr/bin/make then you do not have GNU make installed on your system and will need to follow one of several tutorials to get it installed on AIX.
If it returns /opt/freeware/bin/make then you do have GNU make installed, but it's not reflected in $PATH. You can add it to your path temporarily while you compile Ruby by running export PATH=/opt/freeware/bin:$PATH before you run the make command.
Update:
I would encourage you to open a separate question for your current build trouble, since the original question was about the -C flag for make not working on AIX, and now you have a separate question about running GNU make with an entirely different set of issues and possible solutions.
That said, it's possible you may be able to resolve your issue by starting over and running ./configure LIBTOOL='/usr/bin/libtool --tag=CC' (or whatever your path is to libtool). This is based off the following messages:
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
If this doesn't work then you'll probably have to edit the Makefile by looking for those specific invocations of libtool and append --tag=CC to them one by one until you're able to progress beyond these errors.
Both solutions are assuming that the only code being compiled is C. To my knowledge, everything in MRI that needs to be compiled is written in C, but if anything is written in C++ then the libtool invocations would require --tag=CXX. You can read more about tags here.
I have modified the clang. It was working properly. But then I had some git related issues so I cleaned the git and checked out again. Now when I try to run make clean in clang I am getting the following error. How can I fix this?
#A set of warnings here
make[5]: Entering directory `/home/test/llvm/projects/compiler-rt'
make/platform/clang_linux.mk:16: *** "unable to infer compiler target triple for clang". Stop.
make[5]: Leaving directory `/home/test/llvm/projects/compiler-rt'
make[4]: *** [CleanRuntimeLibraries] Error 2
make[4]: Leaving directory `/home/test/llvm/tools/clang/runtime/compiler-rt'
make[3]: *** [compiler-rt/.makeclean] Error 2
make[3]: Leaving directory `/home/test/llvm/tools/clang/runtime'
make[2]: *** [clean] Error 1
make[2]: Leaving directory `/home/test/llvm/tools/clang'
make[1]: *** [clang/.makeclean] Error 2
make[1]: Leaving directory `/home/test/llvm/tools'
make: *** [clean] Error 1
I had this problem, and solved it. My problem was the link for clang failed (error 9) because I didn't have enough memory. It needs about 4 gig of memory to link, and I only had 3.5 total real memory and swap available.
Look just before these errors and possibly, you'll see that the link for clang failed.
ls the clang executable at {your build directory}/Debug+Asserts/bin/clang mine was zero bytes (because of link failure).
It then generated the "unable to infer compiler target triple" because it didn't have a clang to execute.
My solution was to create a swap file (because I didn't have any space to expand my swap partition) following the instructions at geek swap definition
I solved this error by setting the LD_LIBRARY_PATH environment variable correctly. At first, I set it without the lib64.
I installed llvm on my $HOME/local so, the correct LD_LIBRARY_PATH would be.
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH”:$HOME/local/lib:$HOME/local/lib64
I am trying to compile GCC for Cygwin with support for targeting i386-elf so I can compile some simple OSes (search Benu, by l30nard0, on Github). I've successfully compiled the binutils for i386-elf, and compiled all of GCC's floating-point numbers dependencies.
Problem is, it says windows.h can not be found. I do have w32api successfully installed, and tried including each of those one at a time in the include path for GCC, but none of them work. If I try any of them, I get so many errors and warnings that not all will show up in the Cygwin console. The dozens upon dozens of warnings are most if not all unused parameter.
Does anyone know where the problem might lie?
I've wasted the last three entire days of my life trying to get Linux Mint set up with everything I want, but for reasons I shan't go into I gave up on that. I'd love to be able to get just one thing to work so I can enjoy my life again. :) Thanks!
BTW: The configure arguments I used were --target=i386-elf --enable-threads=win32 --enable-languages=c,c++ Was I supposed to use --enable-targets instead?
And here's part of the log:
In file included from ../../../gcc/libgcc/gthr.h:150:0,
from ../../../gcc/libgcc/unwind-dw2.c:38:
./gthr-default.h:541:21: fatal error: windows.h: No such file or directory
compilation terminated.
../../../gcc/libgcc/static-object.mk:17: recipe for target 'unwind-dw2.o' failed
make[2]: *** [unwind-dw2.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from ../../../gcc/libgcc/gthr.h:150:0,
from ../../../gcc/libgcc/unwind-dw2-fde.c:38:
./gthr-default.h:541:21: fatal error: windows.h: No such file or directory
compilation terminated.
../../../gcc/libgcc/static-object.mk:17: recipe for target 'unwind-dw2-fde.o' failed
make[2]: *** [unwind-dw2-fde.o] Error 1
make[2]: Leaving directory '/home/Sean/gccbuild/i386-elf/libgcc'
Makefile:10055: recipe for target 'all-target-libgcc' failed
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory '/home/Sean/gccbuild'
Makefile:870: recipe for target 'all' failed
make: *** [all] Error 2
Remove the --enable-threads=win32 flag; it is intended to specify thread support on the target system, not the build system.
I was trying to set up a toolchain for Mips on Ubuntu, as per the instructions here. However, when I do make CFLAGS="-Os -w", I get an error as follows :-
...
...
fi
echo timestamp > stmp-fixproto
make[2]: *** No rule to make target `/usr/local/bin/mips-elf-as', needed by `stamp-as'. Stop.
make[2]: Leaving directory `/home/mainuser/mips/gcc-obj/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/mainuser/mips/gcc-obj'
make: *** [all] Error 2
How could I go about correcting this error?
Which occurrence of make CFLAGS="-Os -w" is it failing on? From the error message, it looks like mips-elf-as has not been successfully built by the first stage of the process.