cc: unrecognized option '-KPIC' - linux

I have the following in my makefile:
CC = cc -g -KPIC
When I run the makefile, I get the following error.
cc -g -KPIC -DORA817 -DIDA_VERSION='"ISP-RG-V5.10.7GEN2A"' -c -g -DDEBUG -DDEBUGLEVEL=0 -I../include -I../../../include -c \
-o ../obj/checkdate.o ../src/checkdate.c
cc: unrecognized option '-KPIC'
The version of my gcc is gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44).
Any idea why this error occurs?

This error occurs, just as the compiler says, because -KPIC is not a valid option.
Perhaps you meant -fPIC?

Related

Troubleshoot gcc installation

I have the following setup:
I don't have root priviliges, so I usually build my stuff from source to $HOME/.local
System is Debian 3.16.84-1
I wanted to update my gcc installation.
there's version 4.9.2 installed systemwide, and I installed version 8.4.0 some years ago for local user.
Now I try to install the current version 11.2.0
My first try was to do it with version 8.4.0
the following error occurs when running make:
if [ x"-fpic" != x ]; then \
gcc -c -DHAVE_CONFIG_H -g -I. -I../.././libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic -D_GNU_SOURCE -fpic ../.././libiberty/floatformat.c -o
pic/floatformat.o; \
else true; fi
*** Error in `/home/user/.local/libexec/gcc/x86_64-pc-linux-gnu/8.4.0/cc1': free(): invalid next size (fast): 0x0000000002a19c70 ***
../.././libiberty/floatformat.c: In function ‘floatformat_to_double’:
../.././libiberty/floatformat.c:547:2: internal compiler error: Aborted
dto = ldexp (1.0, exponent);
^~~
using 8.9.2 I get a similar error:
if [ x"-fpic" != x ]; then \
gcc -c -DHAVE_CONFIG_H -g -I. -I../.././libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic -D_GNU_SOURCE -fpic ../.././libiberty/floatformat.c -o pic/floatformat.o; \
else true; fi
*** Error in `/usr/lib/gcc/x86_64-linux-gnu/4.9/cc1': free(): invalid next size (fast): 0x0000000003626810 ***
*** Error in `/usr/lib/gcc/x86_64-linux-gnu/4.9/cc1': malloc(): memory corruption: 0x0000000003626850 ***
gcc: internal compiler error: Aborted (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
Makefile:804: recipe for target 'floatformat.o' failed
I have the feeling there's a more general underlying problem somewhere but I have no idea how to troubleshoot.
I can post full logs if needed.

Error when I compile 'hello-world' example from Contiki

I have installed the Contiki OS sources, and the ARM GCC compiler by doing brew install arm-none-eabi-gcc. However, when I try to run the hello world example in Contiki's example folder using the command make TARGET=srf06-cc26xx BOARD=sensortag/cc2650 hello-world.bin CPU_FAMILY=cc26xx, I get the following error message:
CC ../../cpu/cc26xx-cc13xx/lib/cc26xxware/startup_files/ccfg.c
arm-none-eabi-gcc: error: unrecognized -march target: core2
arm-none-eabi-gcc: note: valid arguments are: armv4 armv4t armv5t armv5te armv5tej armv6 armv6j armv6k armv6z armv6kz armv6zk armv6t2 armv6-m armv6s-m armv7 armv7-a armv7ve armv7-r armv7-m armv7e-m armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a armv8-m.base armv8-m.main armv8-r iwmmxt iwmmxt2
arm-none-eabi-gcc: error: missing argument to '-march='
arm-none-eabi-gcc: error: unrecognized command line option '-mssse3'
make: *** [obj_srf06-cc26xx/ccfg.o] Error 1
I triple-checked that the ARM GCC compiler is accessible from the terminal by doing arm-none-eabi-gcc --version, and I can see that it is properly installed:
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
So I am really not sure what might be wrong here. Can anyone help?
My operating system is macOS Mojave Version 10.14.6.
UPDATE: The makefile is given in the example folder (from contiki):
CONTIKI_PROJECT = hello-world
all: $(CONTIKI_PROJECT)
CONTIKI = ../..
include $(CONTIKI)/Makefile.include
UPDATE 2: By adding V=1 in the command, my output is:
arm-none-eabi-gcc -march=core2 -mtune=haswell -mssse3 -ftree-vectorize
-fPIC -fPIE -fstack-protector-strong -O2 -pipe -DCONTIKI=1
-DCONTIKI_TARGET_SRF06_CC26XX=1 -DNETSTACK_CONF_WITH_IPV6=1
-DUIP_CONF_IPV6_RPL=1 -DBOARD_SENSORTAG=1 -DBACKDOOR_IOID=0x00000000
-I../../cpu/cc26xx-cc13xx/lib/cc26xxware -I../../cpu/cc26xx-cc13xx
/lib/cc26xxware/driverlib -I../../cpu/cc26xx-cc13xx/lib/cc26xxware/inc
-mcpu=cortex-m3 -mthumb -mlittle-endian -ffunction-sections -fdata-sections
-fshort-enums -fomit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -O2
-I. -I../../platform/srf06-cc26xx/. -I../../platform/srf06-cc26xx
/sensortag/cc2650 -I../../platform/srf06-cc26xx/sensortag -I../../platform
/srf06-cc26xx/common -I../../cpu/cc26xx-cc13xx/. -I../../cpu/cc26xx-cc13xx/dev
-I../../cpu/cc26xx-cc13xx/rf-core -I../../cpu/cc26xx-cc13xx/rf-core/api -I../../cpu/cc26xx-cc13xx/lib/cc26xxware/startup_files -I../..
/cpu/cc26xx-cc13xx/../arm/common/dbg-io -I../../core/dev -I../../core/lib -I../../core/net -I../../core/net/llsec -I../../core/net/mac -I../..
/core/net/rime -I../../core/net/rpl -I../../core/sys -I../../core/cfs
-I../../core/ctk -I../../core/lib/ctk -I../../core/loader -I../../core/. -I../../core/sys -I../../core/dev -I../../core/lib -I../../core/net/ipv6 -I../../core/net/ip -I../../core/net/rpl -I../../cpu/cc26xx-cc13xx
/lib/cc26xxware/driverlib -I../../core/net -I../../core/net/mac -I../..
/core/net/mac/contikimac -I../../core/net/llsec -I../../platform/srf06-
cc26xx/ -I../.. -DCONTIKI_VERSION_STRING=\"Contiki-3.x-3345-g32b5b17\"
-include "contiki-conf.h" -c ../../cpu/cc26xx-cc13xx/lib/cc26xxware
/startup_files/ccfg.c -o obj_srf06-cc26xx/ccfg.o
UPDATE 3: If I do unset CFLAGS, I get a new error message:
/usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: hello-world.elf section `.interp' will not fit in region `FLASH_CCFG'
/usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: region `FLASH_CCFG' overflowed by 9120 bytes
/usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol ad_strip_dylibs; defaulting to 0000000000000000
collect2: error: ld returned 1 exit status
make: *** [hello-world.elf] Error 1
rm obj_srf06-cc26xx/startup_gcc.o hello-world.co obj_srf06-cc26xx/fault-handlers.o
Here's a consolidation of #kfx's solution (which worked like a charm):
unset CFLAGS
unset LDFLAGS
make clean
This is because there may be some other flags which you accidentally set previously, so you have to unset them in order for the compilation to work.

Could not determine size of CHARACTER while installing openmpi

I am trying to install openmpi on Amazon ec2 instance. I have uninstalled the openmpi installations present in the system using -
yum remove -y openmpi.x86_64 openmpi-devel.x86_64
This removes 2.1.1-1.31.amzn1 version of openmpi and openmpi devel.
I have downloaded the tar file from official openmpi site. When I try running configure, I get the following error -
checking if C and Fortran are link compatible... yes
checking to see if Fortran compiler likes the C++ exception flags... skipped (no C++ exceptions flags)
checking to see if mpifort compiler needs additional linker flags... none
checking if Fortran compiler supports CHARACTER... yes
checking size of Fortran CHARACTER... configure: WARNING: Could not determine size of CHARACTER
configure: WARNING: See config.log for details
configure: error: Cannot continue
Errors in config.log file -
configure:37098: $? = 0
configure:37111: result: yes
configure:37146: checking size of Fortran CHARACTER
configure:37214: /usr/lib/a-4.2.0-py-3.5.3-dl-gpu-full/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -finline-functions -fno-strict-aliasing -I. -c conftest.c
configure:37221: $? = 0
configure:37231: gfortran conftestf.f90 conftest.o -o conftest -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now
/usr/bin/ld: conftest.o: unrecognized relocation (0x29) in section .text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
configure:37238: $? = 1
configure:37259: here is the Fortran program:
program fsize
I have tried with ./configure —disable-fortran as well but I am getting the same error.
Any help will be appreciated.

Yocto Eclipse ADT plugin fails during configure

I'm trying to use the Yocto Project Eclipse ADT plugin using the manual as a reference with a standalone pre-built toolchain created by running bitbake <recipename> -c populate_sdk, then running poky-glibc-x86_64-<recipename>-x86-toolchain-2.0.sh, specifying default locations. I've sourced the environment-setup in opt/poky/2.0. My Toolchain Root Location is pointing to /opt/poky/2.0 and my sysroot is pointing at /opt/poky/2.0/sysroots/x86-poky-linux.
I was able to compile a "Hello, world" program using this enviromnent, but with a larger project I hit errors during the Build Project step.
Here's the relevant part of my config.log:
Configured with: /home/presslertj/poky/build/tmp/work-shared/gcc-5.2.0-r0/gcc-5.2.0/configure --build=x86_64-linux --host=x86_64-pokysdk-linux --target=i586-poky-linux --prefix=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr --exec_prefix=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr --bindir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux --sbindir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux --libexecdir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr/libexec/i586-poky-linux --datadir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr/share --sysconfdir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/etc --sharedstatedir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/com --localstatedir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/var --libdir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr/lib/i586-poky-linux --includedir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr/include --oldincludedir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr/include --infodir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr/share/info --mandir=/opt/poky/2.0/sysroots/x86_64-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/presslertj/poky/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=i586-poky-linux- --without-local-prefix --enable-target-optspace --enable-lto --enable-libssp --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/5.2.0 --with-build-time-tools=/home/presslertj/poky/build/tmp/sysroots/x86_64-linux/usr/i586-poky-linux/bin --with-sysroot=/not/exist --with-build-sysroot=/home/presslertj/poky/build/tmp/sysroots/piu --enable-targets=all --enable-poison-system-directories --with-mpfr=/home/presslertj/poky/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --with-mpc=/home/presslertj/poky/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --enable-nls --enable-__cxa_atexit
Thread model: posix
gcc version 5.2.0 (GCC)
configure:2971: $? = 0
configure:2960: i586-poky-linux-gcc -m32 -march=pentium-m --sysroot=/opt/poky/2.0/sysroots/x86-poky-linux -V >&5
i586-poky-linux-gcc: error: unrecognized command line option '-V'
i586-poky-linux-gcc: fatal error: no input files
compilation terminated.
configure:2971: $? = 1
configure:2960: i586-poky-linux-gcc -m32 -march=pentium-m --sysroot=/opt/poky/2.0/sysroots/x86-poky-linux -qversion >&5
i586-poky-linux-gcc: error: unrecognized command line option '-qversion'
i586-poky-linux-gcc: fatal error: no input files
compilation terminated.
configure:2971: $? = 1
configure:2991: checking whether the C compiler works
configure:3013: i586-poky-linux-gcc -m32 -march=pentium-m --sysroot=/opt/poky/2.0/sysroots/x86-poky-linux -O2 -pipe -g -feliminate-unused-debug-types -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed conftest.c >&5
configure:3017: $? = 0
configure:3065: result: yes
configure:3068: checking for C compiler default output file name
configure:3070: result: a.out
configure:3076: checking for suffix of executables
configure:3083: i586-poky-linux-gcc -m32 -march=pentium-m --sysroot=/opt/poky/2.0/sysroots/x86-poky-linux -o conftest -O2 -pipe -g -feliminate-unused-debug-types -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed conftest.c >&5
configure:3087: $? = 0
configure:3109: result:
configure:3131: checking whether we are cross compiling
configure:3139: i586-poky-linux-gcc -m32 -march=pentium-m --sysroot=/opt/poky/2.0/sysroots/x86-poky-linux -o conftest -O2 -pipe -g -feliminate-unused-debug-types -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed conftest.c >&5
configure:3143: $? = 0
configure:3150: ./conftest
/home/presslertj/workspace/HMM/configure: ./conftest: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
configure:3154: $? = 126
configure:3161: error: in `/home/presslertj/workspace/HMM':
configure:3163: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
I think the most important line of this might be:
/home/presslertj/workspace/HMM/configure: ./conftest: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
Which looks to me like it's looking in the wrong place for ld-linux.so.2.
Also, when running build, Eclipse's terminal spits out the following lines:
ENV key HOST_CC_ARCH is NULL
ENV key TOOLCHAIN_OPTIONS is NULL
ENV key SELECTED_OPTIMIZATION is NULL
ENV key TARGET_ARCH is NULL
ENV key OECMAKE_C_LINK_FLAGS is NULL
ENV key OECMAKE_CXX_LINK_FLAGS is NULL
ENV key STAGING_DIR_HOST is NULL
ENV key STAGING_DIR_NATIVE is NULL
ENV key CROSS_DIR is NULL
ENV key OECMAKE_EXTRA_ROOT_PATH is NULL
ENV key EXTERNAL_TOOLCHAIN is NULL
ENV key STAGING_DATADIR is NULL
I'm guessing that one of these variables needs to be specified so that ld-linux.so.2 is found but I don't know which, and I feel like I might've missed some critical step. What is causing this error? Have I misconfigured my environment?
As read in How to fix /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory:
This will happen only on 64 bit systems, the cause is the fact that 32
bit libraries are missing from the system, so you can easily fix this
issue by installing the 32 bit libraries on your system.
So if you encounter this error /lib/ld-linux.so.2: bad ELF
interpreter: No such file or directory this is how you can fix it:
To fix it:
On any RPM based distribution (CentOS/RedHat/Fedora/Suse/Mandriva):
yum -y install glibc.i686
On any DEB based distribution (Debian/Ubuntu/Mint/Crunchbang):
apt-get update
apt-get install ia32-libs

How to build Python 3.4.2 from source in cygwin?

According to the README in the Python 3.4.2 source package compilation on Cygwin should be as easy as this:
./configure
make
make test
sudo make install
However, the make command fails after a while giving me this output (i have gcc 3.4.4):
$ make
gcc -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/signalmodule.c -o Modules/signalmodule.o
...
./Modules/signalmodule.c: In function ‘fill_siginfo’:
./Modules/signalmodule.c:744:5: error: ‘siginfo_t’ has no member named ‘si_band’
Makefile:1645: recipe for target `Modules/signalmodule.o' failed
make: *** [Modules/signalmodule.o] Error 1
I guess there are some dependencies that I need to compile?
Python does not compile out of the box without additional patches.
I was able to compile Python 3.4.2 on cygwin with the following 2 patches:
http://bugs.python.org/file34693/cygwin_si_band.patch
http://bugs.python.org/file28934/0001-CYGWIN-issue13756-Python-make-fail-on-cygwin.patch

Resources