Failure Compiling nginx 1.22.1 with devtoolset-11 - linux

I am trying to make custon nginx rpm for centos:8 docker image.
The source was got here: http://nginx.org/packages/centos/8/SRPMS/nginx-1.22.1-1.el8.ngx.src.rpm
When building:
# rpmbuild -bb nginx.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.7rNBAj
.....
+ gcc version: 11.2.1 20210728 (Red Hat 11.2.1-1) (GCC)
checking for gcc -pipe switch ... found
checking for --with-ld-opt="-Wl,-z,relro -Wl,-z,now -pie" ... not found
./configure: error: the invalid value in --with-ld-opt="-Wl,-z,relro -Wl,-z,now -pie"
error: Bad exit status from /var/tmp/rpm-tmp.bhezBh (%build)

Related

lld-link cannot find libcmt.lib when cross-compiling

I use the command
clang -v -fuse-ld=lld-link -target x86_64-pc-win32 out.0.ll -o out.exe
to turn LLVM IR code into an executable file
The command works flawlessly on my windows machine, but when I try running it on linux to cross-compile for windows it gives the following error message:
gbr22#instance-1:~/llvmtest$ clang -v -fuse-ld=lld-link -target x86_64-pc-win32 out.0.ll -o out.exe
clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: /usr/bin
"/usr/lib/llvm-7/bin/clang" -cc1 -triple x86_64-pc-windows-msvc19.11.0 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free -disable-llvm-verifier -discard-value-names -main-file-name out.0.ll -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -v -resource-dir /usr/lib/llvm-7/lib/clang/7.0.1 -fdebug-compilation-dir /home/gbr22/llvmtest -ferror-limit 19 -fmessage-length 120 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/out-db8d92.o -x ir out.0.ll
clang -cc1 version 7.0.1 based upon LLVM 7.0.1 default target x86_64-pc-linux-gnu
warning: overriding the module target triple with x86_64-pc-windows-msvc19.11.0 [-Woverride-module]
1 warning generated.
"/usr/lib/llvm-7/bin/lld-link" -out:out.exe -defaultlib:libcmt -libpath:lib/amd64 -nologo /tmp/out-db8d92.o
lld-link: error: could not open libcmt.lib: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How could I resolve this issue?
Here is a link to the file if that helps.

How to Build gcc 4.2.0 in Redhat 7.0 for backward compatibility?

I must compile gcc 4.2.0 as a program dependency to compile (backward compatibility for a Cobol system). I solved some issues, but now is throwing an exception like this:
>/bin/sh ./libtool --tag=GCJ --mode=link /u01/home/app/talka/gcc/gcc-4.2.0/host-x86_64-unknown-linux-gnu/gcc/gcj -B/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/32/libjava/ -B/u01/home/app/talka/gcc/gcc-4.2.0/host-x86_64-unknown-linux-gnu/gcc/ -L/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/32/libjava -ffloat-store -fomit-frame-pointer -g -O2 -m32 -m32 -o jv-convert --main=gnu.gcj.convert.Convert -rpath /usr/local/lib/../lib -shared-libgcc >-L/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/32/libjava/.libs libgcj.la
>
>/u01/home/app/talka/gcc/gcc-4.2.0/host-x86_64-unknown-linux-gnu/gcc/gcj -B/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/32/libjava/ -B/u01/home/app/talka/gcc/gcc-4.2.0/host-x86_64-unknown-linux-gnu/gcc/ -ffloat-store -fomit-frame-pointer -g -O2 -m32 -m32 -o .libs/jv-convert --main=gnu.gcj.convert.Convert -shared-libgcc -L/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/32/libjava -L/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/32/libjava/.libs >./.libs/libgcj.so -L/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/32/libstdc++-v3/src -L/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs -lpthread -lrt -ldl -L/u01/home/app/talka/gcc/gcc-4.2.0/host-x86_64-unknown-linux-gnu/gcc/32 -L/usr/local/lib/../lib -L/lib/../lib -L/usr/lib/../lib -L/u01/home/app/talka/gcc/gcc-4.2.0/host-x86_64-unknown-linux-gnu/gcc -L/usr/local/lib -lgcc_s -lc -lgcc_s -Wl,--rpath -Wl,/usr/local/lib/../lib
>
>./.libs/libgcj.so: undefined reference to `__cxa_call_unexpected'
>
>collect2: ld returned 1 exit status
>
>make[5]: *** [jv-convert] Error 1
>
>make[5]: Leaving directory `/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/32/libjava'
>
>make[4]: *** [all-recursive] Error 1
>
>make[4]: Leaving directory `/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/32/libjava'
>
>make[3]: *** [multi-do] Error 1
>
>make[3]: Leaving directory `/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/libjava'
>
>make[2]: *** [all-multi] Error 2
>
>make[2]: Leaving directory `/u01/home/app/talka/gcc/gcc-4.2.0/x86_64-unknown-linux-gnu/libjava'
>
>make[1]: *** [all-target-libjava] Error 2
>
>make[1]: Leaving directory `/u01/home/app/talka/gcc/gcc-4.2.0'
>
>make: *** [all] Error 2
If we see this log, we can figure out that behavior is about a java lib (gcj) dependecy compilation. I've tried to avoid this java feature compilation with these settings:
sudo ./configure --program-suffix=4.2.0 --without-libjava --without-gcj --disable-libgcj
but it is still compiling GCJ library yet and the problem is still happening.
Our Linux Distribution is Redhat 7.0, and default gcc is 4.8.2 20140120 (Red Hat 4.3.2-16)
I will thank you any help.
GCC-4.2.0 : The bug fix version is gcc-4.2.4 ... Old gcc requires an oldish OS for the build : RHEL 6 → CentOS 6.9 ... But no chance building these old versions on RHEL 7.
Build gcc-4.2.4 :
$ tar xvf gcc-4.2.4.tar.bz2
$ mkdir build-gcc42 && cd build-gcc42/
$ export CC=gcc34 CXX=g++34 && ../gcc-4.2.4/configure --prefix=/usr/local/gcc424 --program-suffix=42 --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit -disable-checking --with-gnu-ld
$ make
Package : gcc42-c++-4.2.4-1.el6.x86_64.rpm (14.9MB) https://drive.google.com/file/d/1eYWk6Nd63xeqqAUoJldNWRuwEGO6cAyv/view?usp=sharing → provides /usr/bin/{ gcc42, g++42 }.
Download, and install: # cd Downloads/ && yum install ./gcc42-c++-4.2.4-1.el6.x86_64.rpm. ... Works perfect with CentOS 7 (RHEL 7).
Other old extra compilers for EL7 are {gcc34, g++34} https://drive.google.com/drive/folders/0B7S255p3kFXNSXBic2V4ekN0Slk?usp=sharing

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

cc: unrecognized option '-KPIC'

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?

Build sqlcipher on ubuntu

Hi I'm trying to build sqlcipher on ubuntu (11.10 minimal). On Mac OS X I had no problems though.
I followed the instructions from sqlcipher.net. First step was configure. I tried to execute configure with the following command:
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
but I got the following error message: "configure: error: C compiler cannot create executables"
In the config.log some lines caught my eyes but I don't know how to fix it:
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
configure:2544: $? = 0
configure:2551: gcc -V >&5
gcc: error: unrecognized option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2555: $? = 4
configure:2578: checking for C compiler default output file name
configure:2600: gcc -DSQLITE_HAS_CODEC -lcrypto conftest.c >&5
/usr/bin/ld: cannot find -lcrypto
collect2: ld returned 1 exit status
Has anybody successfully build sqlcipher on ubuntu yet? Regards
You will need to install the GNU compiler toolchain in order to build from source. Execute the following command in a terminal.
$ sudo apt-get install build-essential

Resources