When I issue a command like (for example) make -j 4, I get the following error:
warning: jobserver unavailable: using -j1. Add `+' to parent make rule
I am using the developer toolkit from Scientific Linux 6 under RHEL6:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)
I have libmpc 0.8.3 installed:
$ rpm -qa | grep mpc
libmpcdec-1.2.6-6.1.el6.x86_64
libmpc-0.8-3.el6.x86_64
Is there a way to troubleshoot my project's makefile or gcc to determine what is causing the warning and fix it? I do not seem to need the + symbol added to rules when building from OS X via Clang/LLVM. Google searches on the warning text are not returning much information that is apparently useful.
Whenever you run make from inside a makefile you should always use the $(MAKE) variable. Never use the raw, literal command make.
Related
I am currently hunting a bug using git bisect in linux staging-testing tree.
Some commits are giving following errors after I try to build them:
subcmd-util.h:58:31: error: pointer may be used after ‘realloc’ [-Werror=use-after-free]
58 | ret = realloc(ptr, 1);
check.c:2867:58: error: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 9 [-Werror=format-truncation=]
2867 | snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx);
I tried adding -Wno-error=use-after-free to KBUILD_FLAGS in main Makefile, tried adding
KBUILD_CFLAGS += $(call cc-disable-warning, use-after-free)
I even tried removing -Werror from CFLAGS in Makefile in folder where problematic files are located, but nothing worked.
More information:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.artixlinux.org/ --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (GCC)
Linux staging tree: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git.
One of the commits that gives following warnings: 2ab9c9675fe892e7fe9fa8c0a6125e2b40d2889d.
To compile older version of kernel I needed older compiler ("Linux kernel sources are in general not forward-compatible with new compilers"). In my case the kernel version was 5.16.0 and I could compile it with gcc 11. If you have gcc 11 specific warnings then try gcc 10 and so on.
Except CC flags, I also needed set to HOSTCC flags to use gcc-11 compiler:
make HOSTCC=gcc-11 CC=gcc-11
I am trying to compile a Fortran code (package) with gfortran in a Linux server, on which I have no root access.
It has a Makefile and when I run make I get this error
/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
but gcc is already installed on cluster.
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
or libgfortran:
locate libgfortran
/usr/lib/libgfortran.so.3.0.0
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/libgfortran.so
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/libgfortran.spec
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/libgfortranbegin.a
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/32/libgfortran.a
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/32/libgfortran.so
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/32/libgfortranbegin.a
/usr/lib64/libgfortran.so.1
/usr/lib64/libgfortran.so.1.0.0
/usr/lib64/libgfortran.so.3
/usr/lib64/libgfortran.so.3.0.0
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2002.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2003.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2004.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2005.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2006.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2007.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2008.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2009.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2010.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2011.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog-2012.libgfortran.bz2
/usr/share/doc/gcc-gfortran-4.8.5/ChangeLog.libgfortran.bz2
and this is the output of installed package
yum list gcc-gfortran
Failed to set locale, defaulting to C
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Installed Packages
gcc-gfortran.x86_64 4.8.5-16.el7 #local-rhels7.4-x86_64--install-rhels7.4-x86_64
The question is why it can not find libgfortran, while gcc is installed?
I have also tried to update $PATH but it did not change anything.
I am just a user of the server without root access.
When I use -fsanitize=address to link some object into a binary, g++ says the two lib in the title do not exist.
My g++ version is:
$ /opt/rh/devtoolset-2/root/usr/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/opt/rh/devtoolset-2/root/usr/bin/g++
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)
Do I need to manually compile libasan if I use g++?
Sanitizer runtimes typically come in a separate package. E.g. on Debian you'll need to install libasanN ("N" depends on your GCC version).
I can not compile a simple c program without specifying '-march=native', I need to run it as: 'gcc -march=native -o hello hello.c'.
I did:
export CFLAGS='-march=native'
export CXXFLAGS='-march=native'
but didn't help.
user#server:~$ gcc -march=native -Q --help=target
...
-march=corei7-avx
...
Output of gcc -v:
user#server:~$ gcc -v
Using built-in specs.
gcc: error: missing argument to ‘-march=’
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)
Where and how can I add this option to be default?
Two options:
Hard way. You may dump your specs file with gcc -dumpspecs > specs
command. Now put this file to /usr/lib/gcc/x86_64-linux-gnu/4.7/
folder and edit it to add option as described in documentation.
In your case I suggest to start from removing all
march=<something> lines, this might trivially help. But general case is troubles and creativity at this point.
Easy way: rename gcc binary to, say gcc-4.7 and make alias with
alias gcc='gcc-4.7 -march=native'
I have installed gcc-4.6.2 from source, but it can't build 32bit program, it seemed doesn't have 32bit lib. error report by gcc:
/usr/local/gcc-4.6.2/lib/gcc/x86_64-redhat-linux/4.6.2/crtbegin.o: could not read symbols: File in wrong format
my gcc-4.6.2 config is:
Target: x86_64-redhat-linux
Configured with: ../gcc-4.6.2/configure --prefix=/usr/local/gcc-4.6.2 --mandir=/usr/share/man --infodir=/usr/share/info --enable-bootstrap --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --enable-languages=c,c++ --with-gmp=/usr/local/gmp-5.0.1 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-1.0.1 --without-ppl --without-cloog --with-arch-32=i686 --build=x86_64-redhat-linux --disable-multilib
Thread model: posix
Configure and build gcc with:
--enable-multilib --with-multilib-list=m32,m64
Once you install it, you can then compile for 32-bit by passing the "-m32" option to gcc. Note that you will also need 32-bit versions of all needed libraries (like glibc.)