[SOLVED] Failed compile. Syntax error during make

Discussion in 'Kernels' started by jaykudo, Jan 13, 2014.

  1. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
    Hi everyone,

    I am trying to compile the kernel and am having some problems. This is my first kernel compile so it is very possible that I am missing something, although I have followed the instructions exactly.

    Looking through the UDOO manual (under Downloads > Documentation) I execute the below commands:

    Code:
    curl http://download.udoo.org/files/crosscompiler/arm-fsl-linux-gnueabi.tar.gz | tar -xzv
    sudo apt-get install build-essential ncurses-dev uboot-mkimage git
    git clone http://github.com/UDOOboard/Kernel_Unico kernel
    cd kernel
    make ARCH=arm UDOO_defconfig
    make ARCH=arm menuconfig
    make -j4 CROSS_COMPILE=../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi- ARCH=arm uImage modules
    
    Up until the actual compilation (last command) all is well. But when I execute the last command I get these errors.

    Code:
    root@udoo:/usr/src/kernel# sudo make -j4 CROSS_COMPILE=../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi- ARCH=arm uImage modules
    ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: 1: ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: Syntax error: "(" unexpected
    make: execvp: /usr/src/kernel/scripts/setsecoversion: Permission denied
      CHK     include/linux/version.h
      CC      scripts/mod/empty.o
    ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: 1: ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: Syntax error: "(" unexpected
    make[2]: *** [scripts/mod/empty.o] Error 2
    make[1]: *** [scripts/mod] Error 2
    make: *** [scripts] Error 2
    make: *** Waiting for unfinished jobs....
    
    Just to confirm. Up until that error, everything was fine. I downloaded the cross-compiler and did a git clone just fine. No issues there. I even deleted the files (the compiler and the kernel) and did it all again because I thought there may have been a corruption.
    The point of this exercise is to build the kernel with the TUN driver installed, so I also tried configuring the TUN driver on and then I also tried just compiling it at vanilla defaults. Same issue still.

    From what I can gather file ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc is a C++ executable. Which would explain why I can't open it up and see any source code to see where the syntax error is...
    When I do a 'file' of it I get
    Code:
    ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.0, stripped
    
    I am very noob here and probably in over my head. So any assistance would be greatly appreciated. Thanks!

    =======

    EDIT: SUCCESS! It's working now. All details below.

    Firstly, the reason why I was getting that error is because I was attempting to cross-compile the kernel on the UDOO itself. Cross-compiler is used to compile a kernel for a different architecture. However, the my OS is already running on the arch that I want to compile so, so removing that option resolved the issue and I was able to make successfully.

    For posterity, all steps I had taken are below.

    Pre-reqs:
    1) You are attempting to compile on the UDOO itself
    2) You are able to boot successfully on a stock SD image and you wish to install the new kernel on the same SD card
    3) You are doing all this on a Quad-core UDOO
    4) The whole point of this exercise (for me) was to enable the TUN/TAP module so I could use Openvpn
    5) Using documentation as a guide: http://www.udoo.org/downloads/
    Boot in to your OS (in my case Linaro Ubuntu 12.04 LTS):
    In menuconfig go to DEVICE DRIVERS > NETWORK DEVICE SUPPORT > UNIVERSAL TUN/TAP DEVICE DRIVER. Press space. Be sure it has <M> beside it. Exit and save config.
    (Note: You could also just edit .config and change "# CONFIG_TUN is not set" to "CONFIG_TUN=m").

    • make -j4 ARCH=arm uImage modules
      make modules_install INSTALL_MOD_PATH=.. ARCH=arm
      cp arch/arm/boot/uImage /boot # (you may want to rename your old kernel, if it is in there. It wasn't for me)
      cd ..
      cp -r lib/modules /lib/
      # Find the /dev name for your SDcard. Mine was /dev/mmcblk0. Be sure to use the card itself (mmcblk0) and not the partition on the card (mmcblk0p1)
      dd if=u-boot-q.imx of=/dev/mmcblk0 bs=512 seek=2
      urname -r
      shutdown -r now
      Once booted do another uname -r. You should be running new kernel. `modprobe tun` to load the TUN driver.

    Done!
     
  2. andypugh

    andypugh New Member

    Joined:
    Nov 28, 2013
    Messages:
    26
    Likes Received:
    0
    Re: Failed compile. Syntax error during make

    The setsecoversion is a permissions thing. I can't recall if it is because the file is owned by root, or if it needs the execute bit set.
    ls -l should make it obvious how it is different from the other files.

    The make command assumes that the cross-compiler is in the directory level below where you are issuing the "make" command. is it there?

    it doesn't take that long to compile the kernel actually on the Udoo. You might need to ununstall uboot tools and reinstall, the installation on the SD card image seems to be borked.
     
  3. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
    Re: Failed compile. Syntax error during make

    Thanks for your help.

    So I removed uboot tools and re-installed it.

    Code:
    root@udoo:/home/ubuntu# sudo apt-get install build-essential ncurses-dev uboot-mkimage git u-boot-tools
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Note, selecting 'libncurses5-dev' instead of 'ncurses-dev'
    git is already the newest version.
    libncurses5-dev is already the newest version.
    u-boot-tools is already the newest version.
    uboot-mkimage is already the newest version.
    build-essential is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.
    root@udoo:/home/ubuntu#
    
    I then fixed the permissions on /usr/src/kernel/scripts/setsecoversion

    Code:
    root@udoo:/usr/src/kernel# /usr/src/kernel/scripts/setsecoversion
    bash: /usr/src/kernel/scripts/setsecoversion: Permission denied
    root@udoo:/usr/src/kernel# ls -l /usr/src/kernel/scripts/setsecoversion
    -rw-r--r-- 1 root root 561 Jan 13 23:56 /usr/src/kernel/scripts/setsecoversion
    root@udoo:/usr/src/kernel# chmod 777 /usr/src/kernel/scripts/setsecoversion
    root@udoo:/usr/src/kernel# /usr/src/kernel/scripts/setsecoversion
    Usage: /usr/src/kernel/scripts/setsecoversion [srctree]
    
    The cross-compiler is also in the correct location relative to the kernel source

    Code:
    root@udoo:/usr/src# lah
    total 24K
    drwxr-xr-x  6 root root   4.0K Jan 14 10:59 .
    drwxr-xr-x 12 root ubuntu 4.0K Jan 12 22:41 ..
    dr-xr-xr-x  7 root root   4.0K Jan 22  2013 arm-fsl-linux-gnueabi
    drwxr-xr-x 25 root root   4.0K Jan 14 10:54 kernel
    drwxr-xr-x 25 root root   4.0K Jan 14 10:59 kernel.old
    drwxr-xr-x 22 root root   4.0K Jan 13 16:00 uboot
    
    But when I try to make, I still get the same error about the syntax (albeit I no longer getting the permission error):

    Code:
    root@udoo:/usr/src/kernel# make -j4 CROSS_COMPILE=../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi- ARCH=arm uImage modules
    ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: 1: ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: Syntax error: "(" unexpected
      CHK     include/linux/version.h
      CC      scripts/mod/empty.o
    ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: 1: ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: Syntax error: "(" unexpected
    make[2]: *** [scripts/mod/empty.o] Error 2
    make[1]: *** [scripts/mod] Error 2
    make: *** [scripts] Error 2
    make: *** Waiting for unfinished jobs....
    
    Any help would be appreciated.
     
  4. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
    Re: Failed compile. Syntax error during make

    Silly question... but because I am compiling this on the UDOO itself, does that mean I do not need to use the cross-compiler? Could I just remove that option when making?
     
  5. andypugh

    andypugh New Member

    Joined:
    Nov 28, 2013
    Messages:
    26
    Likes Received:
    0
    Re: Failed compile. Syntax error during make

    Yes, absolutely. If compiling on the actual Udoo you can delete the cross-compiler and just:

    make -j4 ARCH=arm uImage modules
     
  6. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
    Re: Failed compile. Syntax error during make

    Excellent! And doing that compiled the kernel :) Thanks mate!

    Code:
    Image Name:   Linux-3.0.35-g76d54f2-dirty
    Created:      Tue Jan 14 11:46:52 2014
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    4312996 Bytes = 4211.91 kB = 4.11 MB
    Load Address: 10008000
    Entry Point:  10008000
      Image arch/arm/boot/uImage is ready
    
    Now to boot in to the new kernel :)
     
  7. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
    Re: Failed compile. Syntax error during make

    SUCCESS!!!

    For posterity, I will be editing my initial post with all the steps i've taken.
    Thanks once again for your help Andy.
     
  8. damoreluc

    damoreluc New Member

    Joined:
    Dec 9, 2013
    Messages:
    15
    Likes Received:
    1
    Hi all

    I really appreciate jaykudo's work.
    But following those steps, I'm incurring in this error while trying to install u-boot-tools:

    Code:
    root@udoo:/usr/src# apt-get install build-essential ncurses-dev uboot-mkimage git u-boot-tools
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Note, selecting 'libncurses5-dev' instead of 'ncurses-dev'
    build-essential is already the newest version.
    build-essential set to manually installed.
    git is already the newest version.
    libncurses5-dev is already the newest version.
    uboot-mkimage is already the newest version.
    The following NEW packages will be installed:
      u-boot-tools
    0 upgraded, 1 newly installed, 0 to remove and 24 not upgraded.
    1 not fully installed or removed.
    Need to get 0 B/51.7 kB of archives.
    After this operation, 145 kB of additional disk space will be used.
    Do you want to continue [Y/n]? Y
    (Reading database ... 89614 files and directories currently installed.)
    Unpacking u-boot-tools (from .../u-boot-tools_2011.09-2_armel.deb) ...
    dpkg: error processing /var/cache/apt/archives/u-boot-tools_2011.09-2_armel.deb (--unpack):
     trying to overwrite '/usr/bin/fw_printenv', which is also in package u-boot-env 2013.11
    Processing triggers for man-db ...
    Errors were encountered while processing:
     /var/cache/apt/archives/u-boot-tools_2011.09-2_armel.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    
    The error seems to depend on different versions of fw_printenv.

    Then , while building, I get this error:
    Code:
     UIMAGE  arch/arm/boot/uImage
    "mkimage" command not found - U-Boot images will not be built
    make[1]: *** [arch/arm/boot/uImage] Error 1
    make: *** [uImage] Error 2
    
    Can anyone give me an hint?

    thanks in advance
    Luca
     
  9. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
    I had a similar (but not the same) error when initially installing u-boot-tools. From memory, I removed u-boot-env and either reinstalled it or tried to install u-boot-tools again without reinstalling u-boot-env.
    I suggest you mess around with that and remove the offending packages and then try to install u-boot-tools again.
     
  10. damoreluc

    damoreluc New Member

    Joined:
    Dec 9, 2013
    Messages:
    15
    Likes Received:
    1
    Hi jaykudo
    you made my day! :)

    I removed u-boot-tools, uboot-mkimage and u-boot-env, then reinstalled u-boot-tools and uboot-mkimage.
    This let me rebuild the kernel and add the modules I need.
     
  11. jaykudo

    jaykudo New Member

    Joined:
    Jan 12, 2014
    Messages:
    17
    Likes Received:
    0
    Glad it was useful for you Damoreluc. Always nice to receive feedback :)
     
  12. ciro66

    ciro66 New Member

    Joined:
    Jan 27, 2015
    Messages:
    6
    Likes Received:
    0
    hallo, i have a last problem with this device TUN, when i try
    Code:
    dd if=u-boot-q.imx of=/dev/mmcblk0 bs=512 seek=2
    i have this reply:
    Code:
    dd: opening `u-boot-q.imx': No such file or directory
    can you help me?
    sorry for english
     

Share This Page