Author Topic: Compiling with Ubuntu and gcc 5.4.1  (Read 4554 times)

m1k6

  • New to the forum
  • *
  • Posts: 17
  • My camera: 1200D
Compiling with Ubuntu and gcc 5.4.1
« on: July 26, 2016, 01:28:05 PM »
Hello everyone.
I'm trying to setup Ubuntu in Virtualbox to compile ML.
I installed Ubuntu 16.04 (LTS) and Mercurial.
To install gcc I followed these instructions (prebuild compiler).
After cloning the repo I adjusted the Makefile.user so it matches the paths.

Now the problem:
When using "make zip/install" to compile ML I get the following error:
Code: [Select]
marvin@Ubuntu-VM:~/magic-lantern/platform/1200D.101$ make zip
../../Makefile.inc:65: remove /home/marvin/magic-lantern/platform/1200D.101/zip
[ RM dir ]  /home/marvin/magic-lantern/platform/1200D.101/zip/
mkdir -p /home/marvin/magic-lantern/platform/1200D.101/zip
[ MKDIR    ]   ML directory structure...
[ AS       ]   entry.o
/bin/sh: 1: /usr/lib/gcc/arm-none-eabi/5.4.1: Permission denied
../../Makefile.filerules:31: the rule for target „entry.o“ failed
make: *** [entry.o] Error 126

My Makefile.user:
Code: [Select]
#User-defined values for ML build system
#Copy me to Makefile.user, keeping ONLY the options that you want to customize

UNAME:=$(shell uname)

ifeq ($(UNAME), Darwin)
# Variable declaration for Mac OS X
UMOUNT=hdiutil unmount
CF_CARD="/Volumes/EOS_DIGITAL"
STAT_CMD=stat -f "%N: %z bytes"
else
# Default settings for remaining operating systems
UMOUNT=umount
# CF_CARD=/media/EOS_DIGITAL
CF_CARD:=$(shell mount | grep -oE "[^ ]+/EOS_DIGITAL[^ ]*")
STAT_CMD=stat -c "%n: %s bytes"
endif

# change this if you have to mount the card every time you run "make install"
# examples:
# MOUNT_CARD=gvfs-mount -d /dev/mmcblk0p1
# MOUNT_CARD=gvfs-mount dav://192.168.0.1/
MOUNT_CARD=

# Supported camera models
SUPPORTED_MODELS:=50D 60D 550D 600D 500D 5D2 5D3 7D 650D 700D EOSM 1100D 1200D 6D

# Supported camera models for "UNIFIED" builds (Digic IV only)
SUPPORTED_UNIFIED_MODELS:=50D 60D 550D 600D 500D 5D2 1100D 1200D

# GCC-related stuff
# for yagarto or the official ARM toolchain use ARM_ABI=none-eabi otherwise use ARM_ABI=elf
ARM_ABI=none-eabi
GCC_VERSION=5.4.1
DIETLIB_VERSION=0.33

NEWLIB_OPT_LEVEL=O3
DIETLIBC_OPT_LEVEL=Os

ARM_PATH=/usr/lib/gcc
ARM_BINPATH=$(ARM_PATH)
ARM_LIBGCC_PATH=$(ARM_PATH)/lib/gcc/arm-$(ARM_ABI)/$(subst -,,$(GCC_VERSION))
NEWLIB_PATH=$(SRC_DIR)/libs/arm-$(ARM_ABI)-$(NEWLIB_OPT_LEVEL)
DIETLIBC_PATH=$(SRC_DIR)/libs/dietlib-$(DIETLIB_VERSION)-$(ARM_ABI)-$(DIETLIBC_OPT_LEVEL)

# Static libraries used
ARM_LIBGCC_A=$(ARM_LIBGCC_PATH)/libgcc.a
NEWLIB_LIBM_A=$(NEWLIB_PATH)/libm.a
NEWLIB_LIBC_A=$(NEWLIB_PATH)/libc.a
DIETLIBC_A=$(DIETLIBC_PATH)/dietlibc.a

ML_LIBC = dietlibc.a newlib-libc.a newlib-libm.a gcc-libgcc.a

CROSS_COMPILE=$(ARM_BINPATH)/arm-$(ARM_ABI)

ifeq ($(OS),Windows_NT)
CC=$(CROSS_COMPILE)gcc$(GCC_VERSION).exe
else
CC=$(CROSS_COMPILE)/$(GCC_VERSION)
endif

OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
AR=$(CROSS_COMPILE)ar
RANLIB=$(CROSS_COMPILE)ranlib
READELF=$(CROSS_COMPILE)readelf
LD=$(CROSS_COMPILE)ld
STRIP=$(CROSS_COMPILE)strip

#
# Host compiler settings
#
HOST_CC=$(shell which gcc)
HOST_LD=$(shell which ld)
HOST_AR=$(shell which ar)

# You can customize CFLAG here
HOST_CFLAGS=-g -O3 -W -Wall -fms-extensions -std=c99
HOST_LFLAGS=
HOST_LIBS=

# large file support
# you can also get them with $(shell getconf LFS_CFLAGS)
HOST_LFS_FLAGS=-DLARGEFILES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64


#
# mingw cross compiler settings
#
MINGW=i686-w64-mingw32
MINGW_GCC=$(MINGW)-gcc
MINGW_AR=$(MINGW)-ar

MINGW_CFLAGS=-g -O3 -W -Wall -fms-extensions -std=c99 -m32
MINGW_LFLAGS=
MINGW_LIBS=
MINGW_LFS_FLAGS=-DLARGEFILES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

#
# Additional binaries
#
CCACHE=ccache
GREP=grep
AWK=awk
PYTHON=python2
RST2LATEX=rst2latex.py

# Naming convention for Magic Lantern builds:
# General rules:
# - Always specify the camera and its firmware version number in the build name (e.g. 550d.fw109)
# - For non-release builds, specify the build date and author's (nick)name.
# - For experimental builds, add a short keyword indicating the particular feature tested.

# Examples for experimental builds:
# magiclantern-2010dec07.550d.fw108.cropmarks.a1ex.zip
# magiclantern-2010nov23.550d.fw108.selectable-audio.piers.zip

# Example for pre-release builds:
# magiclantern-2010dec17.550d.fw109.PRERELEASE.alex.zip

# Release builds:
# magiclantern-0.2.0.rc1.550d.fw109.zip
#~ VERSION=0.2.0.rc1.550d.fw109
BUILDVER=$(shell whoami).$(shell hg id -i -r .)
VERSION:=Nightly.$(shell LC_TIME=EN date +'%Y%b%d').$(MODEL)$(FW_VERSION)

# Build configuration - untested and debug stuff handy for devs
CONFIG_PTP          = n
CONFIG_PTP_CHDK     = n
CONFIG_PTP_ML       = n
ifndef CONFIG_GDB
CONFIG_GDB          = n
endif
CONFIG_GDBSTUB      = n
ifndef CONFIG_CONSOLE
CONFIG_CONSOLE      = y
endif
CONFIG_DEBUGMSG     = 0
CONFIG_CCACHE       = n
CONFIG_TCC          = y
CONFIG_MODULES      = y
CONFIG_TINYPY       = n

# Work in progress - would be nice to run the unmodified autoexec.bin in QEMU, but we are not there yet
# so, for now, we'll just hack the source code to work around the limitations of the emulator
CONFIG_QEMU         = n
CONFIG_QEMU_MENU_SCREENSHOTS = n

# Work in progress - load ML as position-independent code (PIC)
CONFIG_PIC          = n

I hope you can help me. Thanks in advance!
m1k6

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7198
Re: Compiling with Ubuntu and gcc 5.4.1
« Reply #1 on: July 26, 2016, 02:21:35 PM »
If you put sudo before makefile?
Wild guess.

m1k6

  • New to the forum
  • *
  • Posts: 17
  • My camera: 1200D
Re: Compiling with Ubuntu and gcc 5.4.1
« Reply #2 on: July 26, 2016, 03:36:21 PM »
Sudo does not work. Running as root also gives permission denied.  ???
It's a new installation, nothing was changed.

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7198
Re: Compiling with Ubuntu and gcc 5.4.1
« Reply #3 on: July 26, 2016, 08:07:54 PM »
I just googled some and it seems to be a common issue. Check if the answer isn,t already there for you. Good luck

escho

  • Contributor
  • Hero Member
  • *****
  • Posts: 563
Re: Compiling with Ubuntu and gcc 5.4.1
« Reply #4 on: July 27, 2016, 12:16:04 AM »
I´m on OpenSuse, but maybe this run on Ubuntu, too

Try the Linux-tarball from here:
https://launchpad.net/gcc-arm-embedded/+download\

Download it somewhere into your home-dir. Unpack it.

Now tell the makefile.user, where this stuff is. Look into my makefile.user for an example:

Code: [Select]
ARM_PATH=/home/edgar/Programme/MagicLantern/gcc-arm-none-eabi-5_4-2016q2
GCC_VERSION=-5.4.1

HOST_CFLAGS         = -g -O3 -m32 -W -Wall -fms-extensions -std=c99
HOST_LFLAGS         = -m32
CONFIG_SITE         = n
CONFIG_PICOC        = n
CONFIG_TCC          = y
CONFIG_MEMCHECK     = y
CONFIG_MODULES      = y

Maybe, this help.

Edgar
https://sternenkarten.com/
600D, 6D, openSUSE Tumbleweed

milank

  • New to the forum
  • *
  • Posts: 34
  • 5D3, 700D
Re: Compiling with Ubuntu and gcc 5.4.1
« Reply #5 on: July 27, 2016, 03:24:57 PM »
Did you succeed with "make" alone?
If not, try to modify ARM_PATH path in your Makefile.user:
ARM_PATH=/usr

m1k6

  • New to the forum
  • *
  • Posts: 17
  • My camera: 1200D
Re: Compiling with Ubuntu and gcc 5.4.1
« Reply #6 on: July 27, 2016, 11:27:55 PM »
I followed Edgars instructions.
In addition I needed to follow this guideline.
The binaries had problems executing on a 64-bit Ubuntu.

Problem solved.
Thanks for the help!