changing $(PATH) in Makefile has no effect (OS X)

support for the ARM toolchain
Post Reply
ischeriad
Posts: 3
Joined: Thu Jun 10, 2010 1:12 pm

changing $(PATH) in Makefile has no effect (OS X)

Post by ischeriad » Thu Jun 10, 2010 1:46 pm

Hello, I am new to this forum.

I am trying to get the devkitARM to work on OS X 10.6 for GBA development. I have hardly any experience with makefiles and I stumble on what seems a trivial thing. Searching the forums has not helped me. I have installed current Apple Developer Tools, make is GNU Make 3.81.

I have downloaded devkitARM, libgba and gba-expamples and extracted them to /opt/devkitpro/... according to this Getting Started page.

Also I have added these lines to my ~/.profile:

Code: Select all

export DEVKITPRO=/opt/devkitpro
export DEVKITARM=$DEVKITPRO/devkitARM
Now, I have a Makefile which includes the following lines (one example of the Tonc tutorial):

Code: Select all

PATH := $(DEVKITARM)/bin:$(PATH)
PREFIX := arm-eabi-
CC := $(PREFIX)gcc
When executing make, I get the following error:

Code: Select all

make: arm-eabi-gcc: No such file or directory
This is strange, because when I echo the PATH from within the Makefile, it has prepended /opt/devkitpro/devkitARM/bin as desired.

What works is when I prepend the PATH before calling make like this:
$ export PATH=$DEVKITARM/bin:$PATH
$ make
or if I set the PATH in my ~/.profile. But this is only a workaround as I understand it.

The examples of devkitpro (I put them here /opt/devkitpro/examples/gba) compile fine, but I see no reason why the above method does not work.

Thanks.

User avatar
vuurrobin
Posts: 219
Joined: Fri Jul 11, 2008 8:49 pm
Location: The Netherlands
Contact:

Re: changing $(PATH) in Makefile has no effect (OS X)

Post by vuurrobin » Thu Jun 10, 2010 7:50 pm

I don't know much about how make works with environment variables, but have you tried putting "export PATH := $(DEVKITARM)/bin:$(PATH)" in your makefile?

also, wouldn't it be easier to just take the makefile from the examples?

ischeriad
Posts: 3
Joined: Thu Jun 10, 2010 1:12 pm

Re: changing $(PATH) in Makefile has no effect (OS X)

Post by ischeriad » Thu Jun 10, 2010 11:36 pm

Yes, I have tried that, it doesn't work.

I would like to understand the difference between the Makefiles, I'm here to learn after all ;).

WinterMute
Site Admin
Posts: 1856
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: changing $(PATH) in Makefile has no effect (OS X)

Post by WinterMute » Sat Jun 12, 2010 1:22 pm

It's probably best if you show us the whole Makefile you're trying to use, I can't get this to fail on 10.5.

Code: Select all

export PATH	:=	$(DEVKITARM)/bin:$(PATH)

PREFIX	:=	arm-eabi-
CC	:=	$(PREFIX)gcc

all:	gcc_version
	@echo $(PATH)

gcc_version:
	@$(CC) -v
Help keep devkitPro toolchains free, Donate today

Personal Blog

ischeriad
Posts: 3
Joined: Thu Jun 10, 2010 1:12 pm

Re: changing $(PATH) in Makefile has no effect (OS X)

Post by ischeriad » Sat Jun 12, 2010 6:40 pm

Thank you for your short example, WinterMute. I still don't know why, but it fails with the following error:
$ make
make: arm-eabi-gcc: No such file or directory
make: *** [gcc_version] Error 1
If I modify your example to echo the $(PATH) before executing the compiler, and even show me which compiler it is going to use, I get the following:

Code: Select all

PATH   :=   $(DEVKITARM)/bin:$(PATH)
export PATH

PREFIX   :=   arm-eabi-
CC   :=   $(PREFIX)gcc

all:   gcc_version

gcc_version:
       @echo $(PATH)
       which $(CC)
       @$(CC) -v
$ make
/opt/devkitpro/devkitARM/bin:/sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin
which arm-eabi-gcc
/opt/devkitpro/devkitARM/bin/arm-eabi-gcc
make: arm-eabi-gcc: No such file or directory
make: *** [gcc_version] Error 1
Of course, /opt/devkitpro/devkitARM/bin/arm-eabi-gcc does exist. This makes absolutely no sense to me.

WinterMute
Site Admin
Posts: 1856
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: changing $(PATH) in Makefile has no effect (OS X)

Post by WinterMute » Fri Jun 18, 2010 3:35 pm

That's really quite odd, I'm at a bit of a loss to explain this one. It seems like the error may be coming from arm-eabi-gcc rather than make.

How did you extract the devkitARM archive? I've seen some odd issues caused by gui archive tools in the past, it might be worth extracting again using the command line.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Parasyte
Posts: 1
Joined: Tue Nov 18, 2014 9:47 am

Re: changing $(PATH) in Makefile has no effect (OS X)

Post by Parasyte » Tue Nov 18, 2014 10:15 am

I just want to bump a really old thread here, and let you know that I have this issue as well (on OS X Yosemite)

Using the minimal example Makefile (above) fails. I have changed the executable name to arm-none-eabi-gcc for recent devkitARM releases.

It works if I set the PATH variable in the command directly:

Code: Select all

export PATH   :=   $(DEVKITARM)/bin:$(PATH)

PREFIX   :=   arm-none-eabi-
CC   :=   $(PREFIX)gcc

all:   gcc_version
    @echo $(PATH)

gcc_version:
    @PATH=$(PATH) $(CC) -v
It also works if I change the shell to /bin/bash (default is /bin/sh)

Code: Select all

export PATH   :=   $(DEVKITARM)/bin:$(PATH)

SHELL := /bin/bash

PREFIX   :=   arm-none-eabi-
CC   :=   $(PREFIX)gcc

all:   gcc_version
    @echo $(PATH)

gcc_version:
    @$(CC) -v
On that note, there is a rule in devkitARM/base_tools that sets the shell variable to /bin/bash for an older version of OSX only: http://sourceforge.net/p/devkitpro/buil ... base_tools

Code: Select all

#---------------------------------------------------------------------------------
# change shell on Snow Leopard
#---------------------------------------------------------------------------------
UNAME_S	:=	$(shell uname -s)
UNAME_R	:=	$(shell uname -r)

ifneq (,$(findstring Darwin,$(UNAME_S)))
	ifneq (,$(findstring 10.8.0,$(UNAME_R)))
		export SHELL=/bin/bash
	endif
endif
I patched my base_tools file locally and now the Makefiles all work as expected:

Code: Select all

#---------------------------------------------------------------------------------
# change shell on Mac OS X
#---------------------------------------------------------------------------------
UNAME_S	:=	$(shell uname -s)

ifneq (,$(findstring Darwin,$(UNAME_S)))
	export SHELL=/bin/bash
endif
WinterMute: Please push this fix upstream? :D

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests