Apple LLVM compiler 4.0 error clang - c

Sorry my English is bad, i'm French.
I'm starting in the C language and I meet an error during my building
error: -fobjc-arc is not supported with fragile abi
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
I try to find some solution on the web, but no result..
ProcessPCH /Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Intermediates/PrecompiledHeaders/DevTool-Prefix-btzmnprddvcwlhbcsotsvtjgrmyp/DevTool-Prefix.pch.pth DevTool/DevTool-Prefix.pch normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/Hollisprice/Documents/xCode/DevTool
setenv LANG en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c-header -arch i386 -fmessage-length=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wduplicate-method-match -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-sign-compare -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -fasm-blocks -Wprotocol -Wdeprecated-declarations -mmacosx-version-min=10.8 -g -Wno-sign-conversion "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -iquote /Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Intermediates/DevTool.build/Debug/DevTool.build/DevTool-generated-files.hmap -I/Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Intermediates/DevTool.build/Debug/DevTool.build/DevTool-own-target-headers.hmap -I/Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Intermediates/DevTool.build/Debug/DevTool.build/DevTool-all-target-headers.hmap -iquote /Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Intermediates/DevTool.build/Debug/DevTool.build/DevTool-project-headers.hmap -I/Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Products/Debug/include -I/Library/Frameworks/SDL.framework/Headers -I/Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Intermediates/DevTool.build/Debug/DevTool.build/DerivedSources/i386 -I/Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Intermediates/DevTool.build/Debug/DevTool.build/DerivedSources -F/Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Products/Debug -F/Library/Frameworks --serialize-diagnostics /Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Intermediates/PrecompiledHeaders/DevTool-Prefix-btzmnprddvcwlhbcsotsvtjgrmyp/DevTool-Prefix.pch.dia -c /Users/Hollisprice/Documents/xCode/DevTool/DevTool/DevTool-Prefix.pch -o /Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Intermediates/PrecompiledHeaders/DevTool-Prefix-btzmnprddvcwlhbcsotsvtjgrmyp/DevTool-Prefix.pch.pth -MMD -MT dependencies -MF /Users/Hollisprice/Library/Developer/Xcode/DerivedData/DevTool-dfnxafkbvghokwdpcwpuvrurijwt/Build/Intermediates/PrecompiledHeaders/DevTool-Prefix-btzmnprddvcwlhbcsotsvtjgrmyp/DevTool-Prefix.pch.d
Thank's to help me..

I believe that happens because you are compiling code with ARC for 32-bit x86. You must compile to 64-bit architecture if you want to use ARC.

Related

What kind of syntax is platform.txt from Adafruit_nRF52_Arduino

If someone would please tell me what kind of syntax the following file is?
https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/platform.txt
name=Adafruit nRF52 Boards
version=0.19.0
# Compile variables
# -----------------
compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
compiler.c.cmd=arm-none-eabi-gcc
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD
compiler.c.elf.cmd=arm-none-eabi-gcc
compiler.c.elf.flags=-Ofast -Wl,--gc-sections -save-temps
compiler.S.cmd=arm-none-eabi-gcc
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=arm-none-eabi-g++
compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD
compiler.ar.cmd=arm-none-eabi-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=arm-none-eabi-objcopy
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
compiler.elf2bin.flags=-O binary
compiler.elf2bin.cmd=arm-none-eabi-objcopy
compiler.elf2hex.flags=-O ihex
compiler.elf2hex.cmd=arm-none-eabi-objcopy
compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align --specs=nano.specs --specs=nosys.specs
compiler.size.cmd=arm-none-eabi-size
# this can be overriden in boards.txt
build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float
build.debug_flags=-DCFG_DEBUG=0
# common compiler for nrf
rtos.path={build.core.path}/freertos
nordic.path={build.core.path}/nordic
build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DLFS_NAME_MAX=64 -Ofast {build.debug_flags} "-I{build.core.path}/cmsis/include" "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src"
# usb flags
build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
# These can be overridden in platform.local.txt
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
compiler.cpp.extra_flags=
compiler.S.extra_flags=
compiler.ar.extra_flags=
compiler.elf2bin.extra_flags=
compiler.elf2hex.extra_flags=
# Compile patterns
# ----------------
## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BSP_VERSION="{version}" {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}"
snip
While building my project with Eclipse Arduino I am having issues with the Makefile that gets created from this file in arduinocdt which I am trying to debug.
There is an issue with macro expansion from ARDUINO_BSP_VERSION (solved)
Another issue is with flashing my built firmware.
The file is in fact a Java .properties file and the 3rd party Hardware format specification to be used in Arduino IDE and Eclipse Arduino CDT.

Compiling C file in OS X

I am not familiar with OS X at all, and I need to compile a C file. Here is the code I use in Linux. What is the OS X version of those?
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c myfile.c -o myfile.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -Wl,-z,relro -o myfile.so myfile.o -L/usr/lib64/R/lib -lR
Thanks!
You need to install Xcode, which is free, and will allow you to install gcc just by typing gcc in Terminal. From there on, you can just compile .c files using it. Also, you might want to just type gcc myfile.c -o myfile instead of adding all of those flags, because the OS X filesystem hiearchy is different from that of Linux, and adding those extra flags might make the command not work.

Error in installing ncdf on Linux when ever i want to install ncdf package it show this error

install.packages("ncdf")
* installing source package ‘ncdf’ ...
** package ‘ncdf’ successfully unpacked and MD5 sums checked checking for nc-config... /usr/local/bin/nc-config configure: creating
./config.status config.status: creating src/Makevars
** libs gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ncdf.c -o ncdf.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/local/include
-fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ncdf2.c -o ncdf2.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG
-I/usr/local/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ncdf3.c -o ncdf3.o gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions
-Wl,-z,relro -o ncdf.so ncdf.o ncdf2.o ncdf3.o -L/usr/local/lib -lnetcdf -L/usr/lib/R/lib -lR /usr/bin/ld: /usr/local/lib/libnetcdf.a(attr.o): relocation R_X86_64_32 against
`.rodata' can not be used when making a shared object; recompile with
-fPIC /usr/local/lib/libnetcdf.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status make: *** [ncdf.so] Error 1
ERROR: compilation failed for package ‘ncdf’
* removing ‘/home/ayesha/R/x86_64-pc-linux-gnu-library/3.2/ncdf’
The downloaded source packages are in
'/tmp/RtmpSrzd8P/downloaded_packages'

How to generate debug information with Eclipse

I have a C project that can be built in the command line (Linux Mint) which generates
debug information. I can use GDB to debug it in the command line interface, which I find very tedious.
I have used: sudo make DEBUG=1 in the command line.
I need to debug the same project in Eclipse (GALILEO). I can build it in Eclipse, but no debug information is generated, and I can't debug the code (with the error "No Debugging Information available"). Also can't place any break point in the code.
I have used gcc -g as the compiler invocation command (compiler > -O2 -g -Wall -c -fmessage-length=0)
and make DEBUG=1 in custom build command, with the
linker as "gcc"
Can anyone tell me how to set up the project so that the debug information is generated just like when it was built in the command line.
------------------BUILD OUTPUT------------------------------------------------------------
Build of configuration Default for project yuma **
make DEBUG=1 STATIC=1 all
for dir in libtecla netconf libtoaster; do\
cd $dir && make && cd ..;\
done
make[1]: Entering directory /home/shuser/workspace2/yuma/libtecla'
make[2]: Entering directory/home/shuser/workspace2/yuma/libtecla'
mkdir normal_obj
cp ./keytab.h normal_obj/keytab.h
gcc -c -O -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT="" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SELECT=1 -DHAVE_SYSV_PTY=1 -D_SVID_SOURCE -D_BSD_SOURCE -fpic -o normal_obj/getline.o ./getline.c
[...]
gcc -DLINUX=1 -DGCC=1 -DDEBUG -DHAS_FLOAT=1 -Wall -Wno-long-long -Wformat-y2k -Winit-self -Wswitch-default -Wunused-parameter -Wextra -Wundef -Wshadow -Wpointer-arith -Wwrite-strings -Wbad-function-cast -Wcast-qual -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpacked -Winvalid-pch -Wredundant-decls -Wnested-externs -Winline -std=gnu99 -fPIC -ggdb3 \
-I. -I../agt -I../mgr -I../ncx -I../platform -I../ydump -I/usr/include -I/usr/include/libxml2 -I/usr/include/libxml2/libxml -c -o ../../target/mgr/mgr.o mgr.c
gcc -DLINUX=1 -DGCC=1 -DDEBUG -DHAS_FLOAT=1 -Wall -Wno-long-long -Wformat-y2k -Winit-self -Wswitch-default -Wunused-parameter -Wextra -Wundef -Wshadow -Wpointer-arith -Wwrite-strings -Wbad-function-cast -Wcast-qual -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpacked -Winvalid-pch -Wredundant-decls -Wnested-externs -Winline -std=gnu99 -fPIC -ggdb3 \
-I. -I../agt -I../mgr -I../ncx -I../platform -I../ydump -I/usr/include -I/usr/include/libxml2 -I/usr/include/libxml2/libxml -c -o ../../target/mgr/mgr_cap.o mgr_cap.c
[...]
gcc -ggdb3 -DDEBUG=1 -DLINUX=1 -DGCC=1 -DHAS_FLOAT=1 -Wall -Wno-long-long -Wformat-y2k -Winit-self -Wswitch-default -Wunused-parameter -Wextra -Wundef -Wshadow -Wpointer-arith -Wwrite-strings -Wbad-function-cast -Wcast-qual -Wcast-align -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpacked -Winvalid-pch -Wredundant-decls -Wnested-externs -Winline -std=gnu99 -fPIC \
-I. -I../../netconf/src/platform -I../../netconf/src/ncx -I../../netconf/src/agt -I/usr/include/yuma/platform -I/usr/include/yuma/ncx -I/usr/include/yuma/agt -I/usr/include -I/usr/include/libxml2 -I/usr/include/libxml2/libxml -c -o ../bin/toaster.o toaster.c
----------------------DEBUG CONSOLE---------------------------
No source available for "main() "
[...]
.gdbinit: No such file or directory.
Reading symbols from /home/shuser/yuma-2.2-2/netconf/target/bin/netconfd...(no debugging symbols found)...done.
1-gdb-set confirm off
1^done
(gdb)
2-gdb-set width 0
2^done
[...]
=library-loaded,id="/lib/i386-linux-gnu/libm.so.6",target-name="/lib/i386-linux-gnu/libm.so.6",host-name="/lib/i386-linux-gnu/libm.so.6",symbols-loaded="0",thread-group="i1"
~"Stopped due to shared library event\n"
Stopped due to shared library event
*stopped,thread-id="1",stopped-threads="all",core="0"
22 info sharedlibrary
(gdb)

Failed to compile with distcc, but OK without it

I'm trying to compile RaLink drivers for usb wifi dongle. Without using distcc everything is OK but if i use distcc there is error.
Here make log:
make -C UTIL/
cp -f os/linux/Makefile.6.util /home/tobi/RaLink_driver/UTIL/os/linux/Makefile
make -C /home/tobi/linux/ SUBDIRS=/home/tobi/RaLink_driver/UTIL/os/linux modules
mkdir -p /home/tobi/RaLink_driver/UTIL/os/linux/.tmp_versions
rm -f /home/tobi/RaLink_driver/UTIL/os/linux/.tmp_versions/*
make -f scripts/Makefile.build obj=/home/tobi/RaLink_driver/UTIL/os/linux
mipsel-linux-gcc -Wp,-MD,/home/tobi/RaLink_driver/UTIL/os/linux/../../os/linux/.rt_linux.o.d -nostdinc -Iinclude -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -O2 -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding --trap -Wno-uninitialized -fomit-frame-pointer -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -D__KERNEL__ -I/home/tobi/RaLink_driver/UTIL/include -Wall -O2 -Wundef -Wstrict-prototypes -Wno-trigraphs -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-aliasing -fno-common -fomit-frame-pointer -o -DMODULE -mlong-calls -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(rt_linux)" -D"KBUILD_MODNAME=KBUILD_STR(rtutil3572sta)" -c -o /home/tobi/RaLink_driver/UTIL/os/linux/../../os/linux/.tmp_rt_linux.o /home/tobi/RaLink_driver/UTIL/os/linux/../../os/linux/rt_linux.c
cc1: error: /home/tobi/RaLink_driver/UTIL/os/linux/../../os/linux/.tmp_rt_linux.d: No such file or directory
distcc[29414] ERROR: compile (null) on localhost failed
make[8]: *** [/home/tobi/RaLink_driver/UTIL/os/linux/../../os/linux/rt_linux.o] Error 1
make[7]: *** [_module_/home/tobi/RaLink_driver/UTIL/os/linux] Error 2
Without distcc log is the same but without error
cc1: error: /home/tobi/RaLink_driver/UTIL/os/linux/../../os/linux/.tmp_rt_linux.d: No such file or directory
Can anyone say what is wrong?
gcc's -Wp,MD does not take an argument. I think you might want to change this line:
-Wp,-MD,/home/tobi/RaLink_driver/UTIL/os/linux/../../os/linux/.rt_linux.o.d
to use -Wp,MF:
-Wp,MD -Wp,MF /home/tobi/RaLink_driver/UTIL/os/linux/../../os/linux/.rt_linux.o.d

Resources