Error in cross compiling for adding libpcap to mipsel - c++

I compiled C and link libpcap
after adding the library. I use the following line to compile my code.
mipsel-openwrt-linux-gcc -c -Wall -I /home/osboxes/Downloads/OpenWrt-SDK-brcm47xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchai,n-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/include -o sniffex.o sniffex.c
Output:
cc1: error: /home/osboxes/Downloads/OpenWrt-SDK-brcm47xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.3.3/../../../../mipsel-openwrt-linux-uclibc/sys-include: not a directory
cc1: error: /home/osboxes/Downloads/OpenWrt-SDK-brcm47xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin/../lib/gcc/../../lib/gcc/mipsel-openwrt-linux-uclibc/4.3.3/../../../../mipsel-openwrt-linux-uclibc/sys-include: not a directory
I tried also to do it with Makefile

I did something wrong. I find that the SDK was 32 bit and I have 64bit OS then I downloaded 64bit SDK and everything work well.

Related

I get "gcc.exe: fatal error: cannot execute 'cc1plus'" when I try to compile a program in C++ in Windows

I get the error "gcc.exe: fatal error: cannot execute 'cc1plus'" when I want to compile any program in C++. I didn't installed the compiler Mingw-w64, downloaded the zip from winlibs.com and I copied it to "C:". Then I added to the environment variable Path.
I tried to move the library cc1plus.exe.o to the lib folder of Mingw, and used the commands gcc test.cpp -o test.exe and gcc.exe test.cpp -o text.exe.
The OS is Windows.
Thank you.

Issue with Intel compilation on macOS 10.15 Catalina : catastrophic error: cannot open source file "stdlib.h"

I try desperatly to compile with c++ intel compiler (icpc) a simple code that I was used to compile on my previous macBook 10.14.
Now, since Headers don't exist anymore with 10.15 Catalina, the compiler has difficulties to find stdlib.h. Here the output I get :
icpc -std=c++11 -O3 -xHost -fp-model strict -prec-div -prec-sqrt -fma -ftz -mp1 -qopenmp -Wall -c -I/opt/intel/compilers_and_libraries_2020.2.258/mac/mkl/include -mkl=parallel main.cpp -o main.o
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/math.h(301),
from /opt/intel/compilers_and_libraries_2020.2.258/mac/compiler/include/math.h(177),
from /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath(304),
from TSAF.h(1),
from main.cpp(1):
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h(20): catastrophic error: cannot open source file "stdlib.h"
#include_next <stdlib.h>
^
compilation aborted for main.cpp (code 4)
make: *** [Makefile:13: main.o] Error 4
./main_intel.exe: No such file or directory
I tried a lot of potential workarounds from the net but none works. I would like to avoid to create a directory /usr/include/ by removing the security system of my macBook.
I thought maybe this would work by downloading XCode_12.0.1 but same problems remain.
For the moment, I have the version Catalina OS 10.15.7, all has been updated.
EDIT 1: There is something that I don't understand : on my previous macBook 10.14, I didn't need to use the headers of clang c++ for intel compilation.
If anyone could give me a suggestion/clue/track, this would be fine.
Run the command in the Terminal
sudo xcode-select --reset
And then check if proper developer tools are selected instead of the command line tools
xcode-select -p

c++ / g++ - Error: Unknown pseudo-op: `. loc'

I am trying to configure my computer to learn C++.
I have errors and warnings once I run gcc from the terminal to call hello.cpp.
C:\Users\Mathieu>gcc -g hello.cpp -o hello -lm
I am using a Windows computer / windows 7 (64 bits) / IDE: Sublime text or Visual Studio Code.
What I have done so far by looking for solutions in the web:
I have added into the PATH the address of MinGW and I have added ";" before the previous PATH.
I have also been checking all the PATH by using echo %PATH% into the terminal and checking the environmental variables.
By typing g++ or gcc alone in the terminal, I get "fatal error, no input file", which means gcc and g++ are well detected by the computer.
I have checked g++ and gcc versions, there are equal.
gcc (MinGW.org GCC Build-20200227-1) 9.2.0
gcc (MinGW.org GCC Build-20200227-1) 9.2.0
I have also performed #alisonc recommandation found here by reviewing links.
g++ 4.6.1 compiler error: Error: unknown pseudo-op: `.cfi_personality'
C:\Users\Mathieu>ls 'which g++' -al
ls: which g++: No such file or directory
C:\Users\Mathieu>ls 'which gcc' -al
ls: which gcc: No such file or directory
When I have launched the program from the terminal I get a long list of errors. I am just adding 3 lines to illustrate. I am not sure if that is relevant to add everything, please, see a few ones:
C:\Users\Mathieu\AppData\Local\Temp\ccUFD66I.s:6498: Error: Unknown pseudo-op:
.secrel32
C:\Users\Mathieu\AppData\Local\Temp\ccUFD66I.s:153: Warning: Missing string
C:\Users\Mathieu\AppData\Local\Temp\ccUFD66I.s:153: Error: Rest of line ignored.
First ignored character is `3'.'''
May someone help me ?
Thank you in advance
All the best
Mathieu
Try to run:
g++ -g hello.cpp -o hello -lm

Using 32 bit .a library file in 64 bit linux machine

I am trying to use 32 bit .a files in a 64 bit machine. I compiled source code using gcc -m32 option. It gave following error
gcc -m32 *.c -Llib -lquanser_communications -Iinclude -o prg.o`In file included from /usr/include/wchar.h:27:0,
from include/quanser_types.h:16,
from include/quanser_communications.h:16,
from include/quanser_stream.h:11,
from stream_client.c:3:/usr/include/features.h:374:25:
fatal error: sys/cdefs.h: No such file or directory
After searching I got to this and thread and installed libx32gcc-4.8-dev and libc6-dev-i386 packages.
After installing those packages and running compilation gives following error
gcc -m32 *.c -Llib -lquanser_communications -Iinclude -o prg.o
lib/libquanser_communications.a: file not recognized: File truncated
How could I fix this issue ?
Thanks.
You're probably getting this error because your libquanser_communications is 64-bit and not 32-bit. You can't compile 32 bit against 64 bit code.
If you compiled libqunaser yourself, compile it with the -m32 flag (recursively, until you're done with all dependencies).
If not, get the 32 bit version of it

I want to use Clang on Windows to compile 64 bit code from C++ - Getting stdio.h file not found

I have installed the 64 bit MinGW, and put it into the C:\MinGW path. With the 32 bit MinGW I could compile OK, but then when I changed to the 64 bit version, to compile to 64 bit code, I still had problems, getting this error message:
test1.cc:1:10: fatal error: 'stdio.h' file not found
I have run this command to try to compile my example:
clang test1.cc -o test1.exe -v --target=x86_64
Using the below command fixed the issue for me
clang test1.cc -o test1.exe -v --target=x86_64-pc-windows-msvc