[SOLVED]the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Discussions about all things Bitcraze
NickCong
Beginner
Posts: 29
Joined: Sun Oct 15, 2017 12:24 pm

[SOLVED]the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Post by NickCong » Sun Dec 24, 2017 8:11 am

Hi
when i compile the crazyflie-firmware code in the terminl, it output the warning like follow

Code: Select all

nickcong@nickcong-Inspiron-3537:~/crazyflie-firmware$ sudo make
  CLEAN_VERSION
  VTMPL version.c
  CC    version.o
  LD    cf2.elf
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-ctype_.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-errno.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-__call_atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
  COPY  cf2.hex
  COPY  cf2.bin
  DFUse cf2.dfu
Crazyflie 2.0 build!
Build 43:a626925d4b07 (2017.06-43) MODIFIED
Version extracted from git
Crazyloader build!
   text	   data	    bss	    dec	    hex	filename
 139808	   2592	  63240	 205640	  32348	cf2.elf

there are a lot warning ,it is about saying uses 2-byte wchar_t yet the output is to use 4-byte wchar_t ........., so how can i set the 2-byte wchar to 4-byte wchar ??
thank you!
happy christmas!
Last edited by NickCong on Fri Apr 13, 2018 1:00 pm, edited 1 time in total.

tobias
Bitcraze
Posts: 1718
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Post by tobias » Tue Dec 26, 2017 4:21 pm

Can you try with the gcc-arm-none-eabi toolchain that is within the ubuntu repo.

Code: Select all

sudo apt install gcc-arm-none-eabi

arnaud
Bitcraze
Posts: 1738
Joined: Tue Feb 06, 2007 12:36 pm

Re: the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Post by arnaud » Tue Jan 02, 2018 11:46 am

This warning sometime appears with old version of arm-none-eabi-gcc. It will not happen with the gnu arm toolchain: https://developer.arm.com/open-source/g ... /downloads (this is the one we use in our build servers).

NickCong
Beginner
Posts: 29
Joined: Sun Oct 15, 2017 12:24 pm

Re: the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Post by NickCong » Tue Jan 02, 2018 1:56 pm

arnaud wrote:
Tue Jan 02, 2018 11:46 am
This warning sometime appears with old version of arm-none-eabi-gcc. It will not happen with the gnu arm toolchain: https://developer.arm.com/open-source/g ... /downloads (this is the one we use in our build servers).
Hi,Arnaud
accroding your link,i download the latest arm-none-eabi-gcc and switch the gcc version into new,when i input gcc -v in the terminal,it output

Code: Select all

COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/bin/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/lto-wrapper
Target: arm-none-eabi
Configured with: /tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/src/gcc/configure --target=arm-none-eabi --prefix=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native --libexecdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/lib --infodir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/arm-none-eabi --build=x86_64-linux-gnu --host=x86_64-linux-gnu --with-gmp=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-mpfr=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-mpc=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-isl=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-libelf=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for Arm Embedded Processors 7-2017-q4-major' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 
i think i has switch it success,but i try to make again,it occur the same problem,it always say

Code: Select all

warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libc_nano.a(lib_a-strncmp.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
i think when the make,it is still used the /usr/lib/gcc/arm-none-eabi/4.9.3 and not use the latest arm-none-eabi, so what should i do??

arnaud
Bitcraze
Posts: 1738
Joined: Tue Feb 06, 2007 12:36 pm

Re: the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Post by arnaud » Wed Jan 03, 2018 7:26 am

to find which version of GCC is used by the Makefile you can type "which arm-none-eabi-gcc".

To get your version to run you can add its folder to your path first. One solution is to add at the end of the file ~/.bashrc:

Code: Select all

export PATH=/usr/bin/gcc-arm-none-eabi-7-2017-q4-major/bin/:$PATH
Then start a new console and it should work, "which arm-none-eabi-gcc" should point to the right gcc.

As a note: if you want to use gcc from programs like Eclipse you need to add the line to the "~/.profile" file instead, that will only work after log-out log-in but it will have an effect for all software, not only for bash consoles.

NickCong
Beginner
Posts: 29
Joined: Sun Oct 15, 2017 12:24 pm

Re: the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Post by NickCong » Wed Jan 03, 2018 2:52 pm

arnaud wrote:
Wed Jan 03, 2018 7:26 am
to find which version of GCC is used by the Makefile you can type "which arm-none-eabi-gcc".

To get your version to run you can add its folder to your path first. One solution is to add at the end of the file ~/.bashrc:

Code: Select all

export PATH=/usr/bin/gcc-arm-none-eabi-7-2017-q4-major/bin/:$PATH
Then start a new console and it should work, "which arm-none-eabi-gcc" should point to the right gcc.

As a note: if you want to use gcc from programs like Eclipse you need to add the line to the "~/.profile" file instead, that will only work after log-out log-in but it will have an effect for all software, not only for bash consoles.
i arccording you do , i type which arm-none-eabi-gcc,
it display

Code: Select all

/usr/bin/gcc-arm-none-eabi-7-2017-q4-major/bin//arm-none-eabi-gcc
but when i type make,it is still the problem,so i find out the directory of arm-none-eabi-gcc 4.9.3(it is in the /usr/lib/gcc)and remove it directly,and then i make the code,but it display

Code: Select all

CLEAN_VERSION
  CC    list.o
arm-none-eabi-gcc: error trying to exec 'cc1': execvp: No such file or directory
tools/make/targets.mk:26: recipe for target 'list.o' failed
make: *** [list.o] Error 1
when i type whereis gcc,it displays three paths like follow

Code: Select all

nickcong@nickcong-Inspiron-3537:~/Desktop/Target_ThirdYear/crazyflie-firmware$ whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/share/man/man1/gcc.1.gz
but i already add the path("export PATH=/usr/bin/gcc-arm-none-eabi-7-2017-q4-major/bin:$PATH
export TOOLCHAIN=/usr/bin/gcc-arm-none-eabi-7-2017-q4-major") to the ~/.profile and ~/.bashrc and then source it,but it seem not use,
because i delete the arm-none-eabi-4.9.3 before ,so the problem seems become serious,it becoms

Code: Select all

arm-none-eabi-gcc: error trying to exec 'cc1': execvp: No such file or directory
tools/make/targets.mk:26: recipe for target 'list.o' failed
but i really add the gcc-arm-none-eabi-7-2017-q4-major to the path .
i feel breakdown about this.

NickCong
Beginner
Posts: 29
Joined: Sun Oct 15, 2017 12:24 pm

Re: the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Post by NickCong » Thu Jan 04, 2018 9:06 am

arnaud wrote:
Wed Jan 03, 2018 7:26 am
to find which version of GCC is used by the Makefile you can type "which arm-none-eabi-gcc".

To get your version to run you can add its folder to your path first. One solution is to add at the end of the file ~/.bashrc:

Code: Select all

export PATH=/usr/bin/gcc-arm-none-eabi-7-2017-q4-major/bin/:$PATH
Then start a new console and it should work, "which arm-none-eabi-gcc" should point to the right gcc.

As a note: if you want to use gcc from programs like Eclipse you need to add the line to the "~/.profile" file instead, that will only work after log-out log-in but it will have an effect for all software, not only for bash consoles.
Hi,Arnaud:
i seem find out the problem that when i type arm-none-eabi-gcc -v,it display

Code: Select all

gcc version 4.9.3 20150529 (prerelease) (15:4.9.3+svn231177-1)
and i type gcc -v it display

Code: Select all

gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 
,so when i make the code,it always use the gcc version 4.9.3 and not use the version 7.2.1.when i type "arm-none-"and then type the "Tab" key,it display

Code: Select all

arm-none-eabi-addr2line   arm-none-eabi-gcc-7.2.1   arm-none-eabi-ld
arm-none-eabi-ar          arm-none-eabi-gcc-ar      arm-none-eabi-ld.bfd
arm-none-eabi-as          arm-none-eabi-gcc-nm      arm-none-eabi-nm
arm-none-eabi-c++         arm-none-eabi-gcc-ranlib  arm-none-eabi-objcopy
arm-none-eabi-c++filt     arm-none-eabi-gcov        arm-none-eabi-objdump
arm-none-eabi-cpp         arm-none-eabi-gcov-dump   arm-none-eabi-ranlib
arm-none-eabi-elfedit     arm-none-eabi-gcov-tool   arm-none-eabi-readelf
arm-none-eabi-g++         arm-none-eabi-gdb         arm-none-eabi-size
arm-none-eabi-gcc         arm-none-eabi-gdb-py      arm-none-eabi-strings
arm-none-eabi-gcc-4.9.3   arm-none-eabi-gprof       arm-none-eabi-strip
so ,i have the arm-none-eabi-gcc-7.2.1 and 4.9.3,but i don't know change the the 4.9.3 into 7.2.1,so how to change ?
thank you

arnaud
Bitcraze
Posts: 1738
Joined: Tue Feb 06, 2007 12:36 pm

Re: the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Post by arnaud » Mon Jan 08, 2018 3:15 pm

Have you tried to locate your gcc with "which" and add the path as I proposed?

The Crazyflie Makefile will use arm-none-eabi-gcc by default. You can configure which compiler is used by setting the "CROSS_COMPILE" environment variable. Though, if you set the PATH variable as I explained in my last post, it should work.

Edit: Sorry! I missed one message. Does it work if you write: "make CROSS_COMPILE="? in your case it will force using "gcc" instead of "arm-none-eabi-gcc". You could try to re-extract the compiler in another folder because the problem you are experiencing is very strange: if "which" tells you you are using gcc from arm-embedded, this is the one that should run then you type make in the same console.

NickCong
Beginner
Posts: 29
Joined: Sun Oct 15, 2017 12:24 pm

Re: the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Post by NickCong » Tue Jan 09, 2018 4:29 pm

arnaud wrote:
Mon Jan 08, 2018 3:15 pm
Have you tried to locate your gcc with "which" and add the path as I proposed?

The Crazyflie Makefile will use arm-none-eabi-gcc by default. You can configure which compiler is used by setting the "CROSS_COMPILE" environment variable. Though, if you set the PATH variable as I explained in my last post, it should work.

Edit: Sorry! I missed one message. Does it work if you write: "make CROSS_COMPILE="? in your case it will force using "gcc" instead of "arm-none-eabi-gcc". You could try to re-extract the compiler in another folder because the problem you are experiencing is very strange: if "which" tells you you are using gcc from arm-embedded, this is the one that should run then you type make in the same console.
ok,i am not so familiar with the knowledge of
of makefile, so i have not concept about the makefile, may be i need some time to learn about it, thank you for your advice, when i solve this problem,i will tell in this part, it is very nice of you :)

arnaud
Bitcraze
Posts: 1738
Joined: Tue Feb 06, 2007 12:36 pm

Re: the problem in compiling the crazyflie-firmware in terminal in ubuntu16.04

Post by arnaud » Wed Jan 17, 2018 8:39 am

Just to make sure: are you running make in the same console in which you checked the version of the compiler, or are you using an IDE,

Also, in the compiler package there is a 'bin' folder and a 'arm-none-eabi/bin' folder. You need to have the 'bin' folder in your path, not the other one. The 'arm-none-eabi/bin' folder contains executable without prefixes, if you have this one in your path it would explain your problems.

Post Reply