Im compiling a program I made using make and I get this error
c++: error: unrecognized command-line option ‘-target’
make[3]: *** [libs/system/CMakeFiles/system.dir/build.make:76: libs/system/CMakeFiles/system.dir/src/system/syscalls.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:504: libs/system/CMakeFiles/system.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:243: CMakeFiles/image-uefi.dir/rule] Error 2
make: *** [Makefile:137: image-uefi] Error 2
Im running Arch Linux with Clang-13, CMake and all of base-devel installed.
Any help would be appreciated, please dont be condescending I just installed Arch Linux and am getting this error, in Fedora compiling the exact same app provides no error.
The line which created the error is this, it should be the offending linux since the error in question(the top line) complains about -target being unrecognized.
cd /home/user/toy-kernel/build/libs/system && /usr/bin/c++ -I/home/user/toy-kernel/libs/system/src -target x86_64-none-elf -mcmodel=kernel -fno-exceptions -fno-use-cxa-atexit -fno-rtti -nostdlib -ffreestanding -fno-threadsafe-statics -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -mno-3dnow -mno-3dnowa -std=gnu++20 -MD -MT libs/system/CMakeFiles/system.dir/src/system/syscalls.cpp.o -MF CMakeFiles/system.dir/src/system/syscalls.cpp.o.d -o CMakeFiles/system.dir/src/system/syscalls.cpp.o -c /home/user/toy-kernel/libs/system/src/system/syscalls.cpp
In my case, c++ was the g++ compiler instead of the clang compiler, if you are having a similar issue try updating g++ or clang++(on older macs you may need to have to use brew to install those) or going in your /usr/bin directory(for mac and linux, I never used windows cant help you) and replacing the files(though only do that if you absolutely know what your doing!).
Related
I'm trying to upgrade xml-security-c-2.0.2. I extracted the tar file on my linux environment. I exported the following xerces environment variables below before the ./configure command:
Env variables:
export xerces_LIBS=/opt/shibboleth-sp/lib
export xerces_CFLAGS=/opt/shibboleth-sp/include
configure command:
./configure --without-xalan --disable-static --prefix=/opt/shibboleth-sp
Once I run make, I get the following error:
make[2]: Entering directory `/opt/build/xml-security-c-2.0.2/xsec'
g++ -DHAVE_CONFIG_H -I.. -I.. -DXSEC_BUILDING_TOOLS /opt/shibboleth-sp/include -Wall -O2 -DNDEBUG -pthread -MT tools/xtest/xsec_xtest-xtest.o -MD -MP -MF tools/xtest/.deps/xsec_xtest-xtest.Tpo -c -o tools/xtest/xsec_xtest-xtest.o `test -f 'tools/xtest/xtest.cpp' || echo './'`tools/xtest/xtest.cpp
In file included from tools/xtest/xtest.cpp:32:0:
**../xsec/framework/XSECDefs.hpp:63:39: fatal error: xercesc/util/XercesDefs.hpp: No such file or directory
#include <xercesc/util/XercesDefs.hpp>''**'
For whatever reason it cannot find the source file XercesDefs.hpp. This has been an issue for a month or so where we cannot figure out why it isn't finding that source file. When I run a find on this particular file, I get the following path showing it is indeed in multiple locations:
/opt/build/xerces-c-3.2.3/src/xercesc/util/XercesDefs.hpp
/opt/shibboleth-sp/include/xercesc/util/XercesDefs.hpp
Is there something in the compile process that is making this not work or not pick this up? Should I be exporting something else in order to pick up this file?
We currently have version xml-security-c-1.7.3 installed on the machine. Would it be easier to use this version? Is there some sort of bug with 2.0.2 or something that needs to be configured from going from version 1.x to 2.x?
This is all to upgrade shibboleth idp, and installing all the needed dependencies prior to Shibboleth build.
> current OS version Linux version 4.14.214-118.339.amzn1.x86_64
> (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)) #1 SMP
Any help is very much appreciated!
EDIT:
I've exported my CXXFLAGS to point at include however I'm still getting the following error when I issue the make command:
make all-recursive
make[1]: Entering directory `/opt/build/xml-security-c-2.0.2'
Making all in xsec
make[2]: Entering directory `/opt/build/xml-security-c-2.0.2/xsec'
/bin/sh ../libtool --tag=CXX --mode=link g++ /opt/shibboleth-sp/include -Wall /opt/shibboleth-sp/include -O2 -DNDEBUG -pthread -o xsec-xtest tools/xtest/xsec_xtest-xtest.o libxml-security-c.la /opt/shibboleth-sp/lib /opt/apache2_4_46/bin
libtool: link: g++ /opt/shibboleth-sp/include -Wall /opt/shibboleth-sp/include -O2 -DNDEBUG -pthread -o .libs/xsec-xtest tools/xtest/xsec_xtest-xtest.o /opt/shibboleth-sp/lib /opt/apache2_4_46/bin ./.libs/libxml-security-c.so -pthread -Wl,-rpath -Wl,/opt/shibboleth-sp/lib
/opt/shibboleth-sp/include: file not recognized: Is a directory
collect2: error: ld returned 1 exit status
make[2]: *** [xsec-xtest] Error 1
make[2]: Leaving directory `/opt/build/xml-security-c-2.0.2/xsec'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/build/xml-security-c-2.0.2'
make: *** [all] Error 2
What is going on with this?
RHEL 7.2 is the year 2015 update. Current is 7.8 (yum update).
XercesDefs.hpp: No such file
xml-security-c-2.0.2 configure will look in /usr/include, /usr/local/include ! When you have a "hide away" location, the INCLUDE path must be specified : See $ ./configure --help
Example : CXXFLAGS=-I/opt/shibboleth-sp/include , I.e. →
$ ./configure --prefix=/opt/shibboleth-sp CXXFLAGS=-I/opt/shibboleth-sp/include
Bugs : There are no bugs in xml-security-c-2.0.2 . Will compile without errors in EL 7 ( 3 minutes, g++73 (or with the default g++ ver. 4.8 )).
Ref your comment »» I need the .tar.gz files «« : Please follow the link https://ftp.gwdg.de/pub/opensuse/repositories/home%3A/Scott_Cantor/CentOS_7/ → src/
Example $ bash unPack_rpm.sh xml-security-c-2.0.2-4.2.src.rpm and you get xml-security-c-2.0.2-4.2.src/{xml-security-c-2.0.2.tar.bz2 , xml-security-c.spec}
Script unPack_rpm.sh https://drive.google.com/file/d/1q3d9QqrRhEThYByPDgWEaoxHnqWFWqfE/view?usp=sharing
Get build-deps : # yum-builddep xml-security-c.spec
I am new to OpenMP, and my professor gives us a project to do. There are only three files in the folder: a C++ source code a0.cpp, a header a0.h, and a Makefile. When I want to run the code in my terminal, it says:
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
make: *** [a0] Error 1
I am using a Macbook, and I do not know how to fix this. Can you help me? Thanks.
After installing libomp with homebrew using:
brew install libomp
I was able to compile an OpenMP program with this:
clang -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp main.c -o main
If you are using C++, you'd likely want:
clang++ -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp main.cpp -o main
We have software that we distributed to a bunch of Pis that have Raspian Wheezy. Recently, we've added in a bit of code that uses C++ standards that aren't integrated until >=gcc-4.8. If I compile on a newer version of Raspian, there are glibc mismatch errors when running on the Wheezy installed Pis.
Can I get >=gcc-4.8 on one of the Wheezy Pis without also having to install a higher version of glibc (which automatically makes any binary compiled refuse to work on the other Pis)?
Side note:
I've been trying to compile gcc-4.8 but I'm having the worst time because it keeps throwing a bits/predefs.h is missing error. Even though I configured it with --disable-multilib:
make[3]: Entering directory '/root/gcc-4.8/gcc-4.8-20150611/armv7l-unknown-linux-gnueabihf/libgcc'
# If this is the top-level multilib, build all the other
# multilibs.
/root/gcc-4.8/gcc-4.8-20150611/host-armv7l-unknown-linux-gnueabihf/gcc/xgcc -B/root/gcc-4.8/gcc-4.8-20150611/host-armv7l-unknown-linux-gnueabihf/gcc/ -B/usr/local/armv7l-unknown-linux-gnueabihf/bin/ -B/usr/local/armv7l-unknown-linux-gnueabihf/lib/ -isystem /usr/local/armv7l-unknown-linux-gnueabihf/include -isystem /usr/local/armv7l-unknown-linux-gnueabihf/sys-include -g -O2 -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fPIC -fno-inline -I. -I. -I../../host-armv7l-unknown-linux-gnueabihf/gcc -I../.././libgcc -I../.././libgcc/. -I../.././libgcc/../gcc -I../.././libgcc/../include -DHAVE_CC_TLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../.././libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
In file included from /usr/include/stdio.h:28:0,
from ../.././libgcc/../gcc/tsystem.h:87,
from ../.././libgcc/libgcc2.c:27:
/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
#include <bits/predefs.h>
^
compilation terminated.
Makefile:460: recipe for target '_muldi3.o' failed
make[3]: *** [_muldi3.o] Error 1
make[3]: Leaving directory '/root/gcc-4.8/gcc-4.8-20150611/armv7l-unknown-linux-gnueabihf/libgcc'
Makefile:14787: recipe for target 'all-stage1-target-libgcc' failed
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory '/root/gcc-4.8/gcc-4.8-20150611'
Makefile:18655: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory '/root/gcc-4.8/gcc-4.8-20150611'
Makefile:884: recipe for target 'all' failed
make: *** [all] Error 2
This article (https://superuser.com/questions/762274/error-compiling-gcc-on-raspberry-pi) doesn't fix my issue unfortunately.
I'm using eclipse Junior and build my C++ program.
the command line in the console is as following:
make all
Building file: ../src/misc/bt_misc.cpp
Invoking: GCC C++ Compiler
g++ -DNDEBUG=1 -DEPOLL=1 -D__GXX_EXPERIMENTAL_CXX0X__
-I"/home/adtech/workspace/mtracker/src/misc" -I"/home/adtech/workspace/mtracker/src/Tracker" -I"/home/adtech/workspace/mtracker/src/misc/xbt" -I/usr/include -I/usr/lib64/mysql -O0 -g3 -Wall -c -fmessage-length=0 -std=c++0x -MMD -MP -MF"src/misc/bt_misc.d" -MT"src/misc/bt_misc.d" -o "src/misc/bt_misc.o" "../src/misc/bt_misc.cpp"
I got no error during the compilation phase, unfortunately, encouter an error at the end as following:
make: *** [src/Tracker/server.o] Error 1
Could you guys help me explain this error. Thanks so much
That error means that a command it executed (presumably g++ when building server.o) encountered an error. Scroll up and make sure there aren't any errors. The error might not be at the very end if you're running multiple jobs in parallel.
Im trying to build GLib-2.4.0 using the makefile.
I get this error:
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -DG_LOG_DOMAIN=\"GLib\" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -pthreads -g -O2 -Wall -MT gatomic.lo -MD -MP -MF .deps/gatomic.Tpo -c gatomic.c
-fno-common -DPIC -o .libs/gatomic.o
/var/tmp//cctTsmw7.s:103:Incorrect register `%rdx' used with `l' suffix
make[3]: *** [gatomic.lo] Error 1
make[2]: *** [install-recursive] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [install] Error 2
Any ideas?
It's likely that a newer version of glib will fix this problem.
However, if you're stuck with 2.4 for some reason, this was discussed in the gtk-devel-list at http://www.mail-archive.com/gtk-devel-list#gnome.org/msg10924.html ... here is the workaround that was reported there.
Here is the workaround that was successful for two users in that thread:
Ah yes, I think I have stumbled on this as well. This is probably
caused because the default jhbuildrc for the Mac forces a build for
the 486:
When building on intel, force build to be 486, since glib won't
enable asm atomic operations otherwise.
try:
_f = os.popen("uname -p")
if _f.read().startswith("i386"):
append_autogenargs("glib", "--build=i486-apple-darwin")
I changed the last line to:
append_autogenargs("glib", "--build=x86_64-apple-darwin")
And that fixed it for me. (If you have a Mac with a Core2 processor,
the user land will be in 64-bit in Snow Leopard).