energia / Energia

Fork of Arduino for the Texas Instruments LaunchPad's
http://energia.nu
Other
794 stars 672 forks source link

MSP432: Windows makefile/compile doesn't allow for "\Program Files" #586

Closed WestfW closed 8 years ago

WestfW commented 9 years ago

If I install Energia 0101e0015 in the logical place on a windows system (C:\Program Files\energia-0101e0015), the Makefile-based MSP432 builds will fail due to the space in the pathname:

C:\Program Files\energia-0101E0015\tools\common\bin\make --no-print-directory -C C:\DOCUME~1\Bill\LOCALS~1\Temp\build3847528908447436.tmp\ -f C:\Program Files\energia-0101E0015\hardware\common\Makefile 
C:\Program Files\energia-0101E0015\hardware\common\Makefile:19: C:\Program: No such file or directory
C:\Program Files\energia-0101E0015\hardware\common\Makefile:19: Files\energia-0101E0015/hardware/msp432/targets/MSP-EXP432P401R/Board.mk: No such file or directory
CCROOT C:\Program Files\energia-0101E0015\hardware\tools\lm4f
SDKROOT C:\Program Files\energia-0101E0015\hardware\msp432/CC3200SDK_1.0.0.patch
CLOSURE C:\Program Files\energia-0101E0015\hardware\common
MAINSKETCH sketch_mar27a.cpp
C:\Program Files\energia-0101E0015\hardware\common\Makefile:100: C:\Program: No such file or directory
C:\Program Files\energia-0101E0015\hardware\common\Makefile:100: Files\energia-0101E0015/hardware/msp432/Plat.mk: No such file or directory
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
make: *** No rule to make target `Files\energia-0101E0015/hardware/msp432/Plat.mk'.  Stop.
C:\Program Files\energia-0101E0015\tools\common\bin\make returned 2

This is a common problem mixing unix-like tools with Windows, but usually special care is take to at least support the "Program Files" directory.

rei-vilo commented 9 years ago

The requirement for the names and paths without spaces or special characters, is a limitation due to the GCC tool-chain.

WestfW commented 9 years ago

Note that targets other than MSP432 work fine with an install in "\Program Files", even though they have both source and tools there. It's only the (new) Make-based build that has problems.

rei-vilo commented 9 years ago

That's a limitation of the makefile.

WestfW commented 9 years ago

If you can figure out how to put a "dospath.bat" into a well know executable place (even if the current IDE location has spaces in the dirs), then you can convert the paths to their DOS equivalents in the Makefile...

(This is a concept demonstration, not a patch...)

dospath.bat:

@ECHO OFF
echo %~s1

Changed part of hardware/common/Makefile:

# (if present) include definitions of the macros described above

include Variables.mk

ifeq ($(OS),Windows_NT)
$(shell set CYGWIN = nodosfilewarning)
RM = $(shell rmdir /S /Q build >nul 2>nul)
MKDIR = mkdir
SHELL = C:/Windows/System32/cmd.exe
APPLICATION_PATH := $(shell "c:\bin\dospath" "$(APPLICATION_PATH)")
CLOSURE := $(shell "c:\bin\dospath" "$(CLOSURE)")
SDKROOT := $(shell "c:\bin\dospath" "$(SDKROOT)")
CCROOT := $(shell "c:\bin\dospath" "$(CCROOT)")
else
RM = rm -rf build
MKDIR = mkdir -p
endif

$(info TREEROOT $(TREE_ROOT))
$(info APPLICATION_PATH $(APPLICATION_PATH))

BOARD_DIR := $(APPLICATION_PATH)/hardware/$(PLATFORM)/targets/$(BOARD)
include $(BOARD_DIR)/Board.mk

$(info CCROOT $(CCROOT))
$(info SDKROOT $(SDKROOT))
WestfW commented 9 years ago

You can apparently do this without a .bat file by calling cmd.exe (shell) with an argument like:

cmd /c 'for %I in ("\Program Files\Energia-0101E0015\tools\common\") do @echo %~sI'

But the quoting of quotes and parens from within a Makefile is ... not obvious to me at the moment :-(

robertinant commented 9 years ago

Thanks @WestfW! I'll looked at this a while back and was not able to find a proper work-around. Will look into it again using the hints you posted here.

Thanks!

Robert

WestfW commented 9 years ago

Potentially, if the IDE java code is already parsing pathnames, instead of using just strings, the conversion to the the 8.3 format could be done when writing Variables.mk. http://stackoverflow.com/questions/11038595/java-call-for-windows-api-getshortpathname

KermMartian commented 9 years ago

I've run into this issue as well with the MSP432 and Energia 0101e0016. Is there any potential fix in the pipeline?

Edit: My temporary fix is to put the following in my Makefile: APPLICATION_PATH := C:/Progra~2/Energia CCROOT := C:/Progra~2/Energia/hardware/tools/lm4f

robertinant commented 8 years ago

The build process has completely changed in Energia 18 and fixes the issue with spaces in the path as described in this issue.