cc1plus: error: unrecognized command line option "-std=gnu++11" - c++

mac OS X has failed to generate a make file and gives me a problem
DOLATs-MacBook-Air:~ dolatsingh$ cd Documents/ardupilot/ArduCopter/
DOLATs-MacBook-Air:ArduCopter dolatsingh$ make apm2
// BUILDROOT=/var/folders/16/slzp9s_s741cb0cgqtcddc_h0000gn/T/ArduCopter.build HAL_BOARD=HAL_BOARD_APM2 HAL_BOARD_SUBTYPE=HAL_BOARD_SUBTYPE_AVR_APM2 TOOLCHAIN=AVR EXTRAFLAGS=-DGIT_VERSION="705d3d56"
%% AP_State.o
**cc1plus: error: unrecognized command line option "-std=gnu++11"
make: ***** [/var/folders/16/slzp9s_s741cb0cgqtcddc_h0000gn/T/ArduCopter.build/AP_State.o] Error 1
i have checked GCC version and it's 4.2.1

You'll need to upgrade your IDE (if you're using the Arduino IDE).
Since version 1.5.8 of the IDE, GCC has been version 4.8.1. However, you'll need to manually enable it with the command line switch you were using.
If you grab the latest (1.6.2 and above, currently 1.6.9) C++11 is enabled by default.

Related

Valgrind version 3.16.1 - unrecognized command line option '-m64'

I'm trying to compile Valgring3.16.1 with aarch64-linux-gnu-gcc (for xilinx zynq-mp board)
the ./configure stage passed ok.
when I run:
make CC= ..... /bin/aarch64-linux-gnu-gcc
I got this error:
aarch64-linux-gnu-gcc: error: unrecognized command line option '-m64'
How can I fix it?
any help will be appreciated,
Tzipi Kluska
If you need to change compiler or flags, you should do that when you run configure, not when you run make. Otherwise configure sees and detects a different environment than what you get with make.
The docs have the answer you ask for.
-m64 is available for other architectures than AArch64.
If you need the "Machine-Dependent Options" you should read AArch64 options.

ld: file not found: /usr/lib/crt1.o

When trying to compile Fortran using PGI on Mac OS X Sierra, I get the error
ld: file not found: /usr/lib/crt1.o
I found a workaround for older Mac OS X versions (http://www.pgroup.com/userforum/viewtopic.php?t=4578)
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/crt1.o /usr/lib/crt1.o
However, with Sierra, System Integrity Protection prevents writing in /usr/bin. How can I solve this problem?
I tried linking into /usr/local/bin/ (which is permitted), but then, how can I make sure the compiler searches for library in that path?
Installing just the Command Line Tools for Mac OS X solved the problem. Do this in your terminal:
xcode-select --install
Installing Lazarus on MacOS X :
worked for me
http://wiki.lazarus.freepascal.org/Installing_Lazarus_on_MacOS_X#Xcode_5.0.2B_compatibility_.28Mac_OS_X_10.8_and_10.9.29
Solution for command line programs:
The correct answer for me was as explained in this link:
https://medium.com/#kviat/free-pascal-3-0-2-linking-on-macos-sierra-c40706e86fda
After some googling I realized that most libraries were removed from
/usr/lib in macOS Sierra. However this case is handled in FPC, so we
just need to set internal compiler variable MacOSXVersionMin to 10.8
(or later). There is no standard compiler option for it, but after
some search in source code I found the solution: set the environment
variable MACOSX_DEPLOYMENT_TARGET:
You should give the deployment target of MacOS:
MACOSX_DEPLOYMENT_TARGET= XX.XX #for instance 10.15
Solution for generally:
Linking the necessary file to /usr/bin/crt* . As already stated, this linking will be prohibited by MacOs beginning from 10.10. But there is still a way to accomplish this linking procedure and it solves the problem.
1) Reboot the Mac and hold down Command + R keys simultaneously after you hear the startup chime, this will boot Mac OS X into Recovery Mode
2) When the “MacOS Utilities” / “OS X Utilities” screen appears, pull down the ‘Utilities’ menu at the top of the screen instead, and choose “Terminal”
3) Type the following command into the terminal then hit return:
csrutil disable; reboot
4) When you come back, run the command sudo mount -uw /
5) Just run the linking code you want to:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/crt1.o /usr/lib/crt1.o
sources: http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/
https://www.reddit.com/r/MacOS/comments/caiue5/macos_catalina_readonly_file_system_with_sip/
In my case the problem was actually an error on the PGI installation side. PGI seems to be well aware that newer versions of macOS do not have the /usr/lib/crt1.o and that you can't create files there anymore. But it is possible to setup correct environment variables for the PGI compilers and then the linker should use the correct path to the crt1.o.
This configuration should be done automatically during the installation of the PGI compiler suite by running the makelocalrc command and should generate the file /opt/pgi/osx86-64/$PGIVER/bin/localrc. But in my case this step failed silently.
Reasons for failure seem to be:
license agreement for XCode not (yet) accepted, although this error should leave you with a /opt/pgi/osx86-64/$PGIVER/bin/localrc.error, containing some details
XCode version not supported, which seems to leave you with nothing. This is what I got when I ran the makelocalrc script manually:
makelocalrc -x /opt/pgi/osx86-64/19.10
Error: Unsupported XCode version 11
In my case (PGI 19.10, macOS 10.15, XCode 11.2.1) I manually patched the /opt/pgi/osx86-64/19.10/bin/makelocalrc to not error out on XCode 11:
if test $xcodever -gt 11 ; then # <-- was "-gt 10"!
echo " Error: Unsupported XCode version " $xcodever
exit -1
fi
and then re-ran the script after which compilation with PGI compilers (both pgcc and pgfortran) worked:
sudo /opt/pgi/osx86-64/2019/bin/makelocalrc -x /opt/pgi/osx86-64/19.10
Your case may vary, but you might want to check for a /opt/pgi/osx86-64/$PGIVER/bin/localrc.error or the /opt/pgi/osx86-64/$PGIVER/bin/localrc itself and try to manually (re-) generate it if it is not there or if you upgraded XCode/macOS since the installation of the PGI compilers.

How to cross compile alljoyn standard core and service framework?

I have one wifi camera with armv5 processor and want to cross compile and alljoyn standard core, service framework and want to make notification producer application.
But I am stuck while cross compiling alljoyn. I am compiling alljoyn with codesourcery arm cross compiler with gcc version 4.3.3
Initially I have used same command, used to compile standard core and service framework. Just added CROSS_COMPILE and CPU flag for arm and crosscompiler. Here is the command used, compilation process fails with some error related to -std=c++11
command:
scons BINDINGS=cpp WS=off BT=off ICE=off OS=linux CPU=arm CROSS_COMPILE="/home/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-" SERVICES="about,notification,controlpanel,config,onboarding,sample_apps"
error:
....
prints for copying header files to 'build' dir
....
/* On compilation of first cc file */
cc1plus: error: unrecognized command line option "-std=c++11"
scons: ***
[build/linux/arm/debug/obj/services/config/cpp/samples/ConfigClientSample/ConfigClientMain.o] Error 1
After this failure I found following link,
https://wiki.allseenalliance.org/develop/building_and_running
It says that we can compile alljoyn for openwrt on cross compiling. So I have prepared and executed following command:
scons BINDINGS=cpp WS=off BT=off ICE=off OS=openwrt CPU=openwrt TARGET_PATH=/home/CodeSourcery/Sourcery_G++_Lite/bin/ TARGET_CC=arm-none-linux-gnueabi-gcc TARGET_CFLAGS="-std=c++0x" TARGET_CPPFLAGS="-std=c++0x" TARGET_CXX=arm-none-linux-gnueabi-g++ TARGET_LINK=arm-none-linux-gnueabi-gcc TARGET_LINKFLAGS="" TARGET_AR="" TARGET_RANLIB="" STAGING_DIR=/usr/lib/x86_64-linux-gnu SERVICES="about,notification,controlpanel,config,onboarding,sample_apps"
But getting error before compilation starts,
scons: Reading SConscript files ...
Checking c++ compiler support for -std=c++11 flag... no
Checking c++ compiler support for -std=c++0x flag... no
*** Compiler too old to build AllJoyn. Aborting.
So here is my questions,
1. Is it possible to cross compile alljoyn standard client and services without using openwrt?
2. Does cross compiling using openwrt affect any functionality of alljoyn?
3. What should I do to overcome c++11/c++0x error, should I find new gcc version for cross compiling my code.
Please let me know if some one has cross compiled alljoyn standard core and service framework for any platform, please provide me steps/command for that.
Thanks in advance.
Pratik
These steps to cross compile AllJoyn worked for me.
http://itisprakash.blogspot.com/2016/05/cross-compile-alljoyn-for-raspberrypi.html

OCaml compiler build failure

I checkout the latest OCaml source code and try to build on my OS X 10.10 machine
with gcc 4.9.2. I use the following command as suggested here.
$ ./configure && make world
Build gets no error but when I tried the compiler I just build by doing $ ./ocamlc, I get the following error:
Fatal error: unknown C primitive `caml_add_debug_info'
I believe this happens when you use the old bytecode interpreter to run the new compiler. Make sure you're using the new bytecode interpreter (ocamlrun).

How to compile DEC UNIX v4.0 application source code in Linux?

I want to compile a source code but I have trouble in compile.
cc -O2 -Olimit 2000 -g -migrate -assume -Zp1 noaligned_objects ...
cc: error: 2000: No such file or directory
cc: error: noaligned_objects: No such file or directory
cc: error: unrecognized command line option ‘-migrate’
cc: error: unrecognized command line option ‘-assume’
cc: error: unrecognized command line option ‘-Zp1’
Start with compiling it with no system-specific flags (i.e. by using gcc possibly with -I, -L, and -l flags and nothing else). If the program in question is portable enough, then it will be a matter of getting all dependencies available for it.
Once you are able to build it, see if it runs as expected (ignore performance). If it doesn't, that would be a good time to look at the flags you used on DEC to see if it requires any special treatment when building. This is where you either make the program portable or try to get the equivalent behavior using gcc on the target architecture of your choice.
Finally, once the program builds and runs, that would be a good time to see if you want to use any optimization flags (hint: you don't have to. If it runs fine, leave it the way it is).