Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fails on Windows #18

Closed
pelikhan opened this issue Oct 2, 2014 · 22 comments
Closed

Compilation fails on Windows #18

pelikhan opened this issue Oct 2, 2014 · 22 comments
Assignees
Labels

Comments

@pelikhan
Copy link

pelikhan commented Oct 2, 2014

Having trouble compiling on Windows. Installed python 2.8.3, ran getplatformio.py, then trying to compile project:

C:\arduino>platformio install atmelavr timsp430 titiva
Installing toolchain-atmelavr package:
Already installed
Installing tool-avrdude package:
Already installed
Installing framework-arduinoavr package:
Already installed
The platform 'atmelavr' has been successfully installed!
C:\arduino>platformio run
Processing myuno environment:
avr-g++ /Fo.pioenvs\myuno\src\sketch.obj /c .pioenvs\myuno\src\sketch.cpp -fno-exceptions -g -Os -ffunction-sections -fdata-sections -MMD -mmcu=atme
a328p /DF_CPU=16000000L /DARDUINO=157 /DARDUINO_AVR_UNO /I.pioenvs\myuno\core /I.pioenvs\myuno\variant
.pioenvs\myuno\src\sketch.cpp:1:21: warning: Arduino.h: No such file or directory
sketch.ino: In function 'void setup()':
sketch.ino:5: error: 'Serial' was not declared in this scope
sketch.ino: In function 'void loop()':
sketch.ino:17: error: 'delay' was not declared in this scope
avr-g++: /Fo.pioenvs\myuno\src\sketch.obj: No such file or directory
avr-g++: /c: No such file or directory
avr-g++: /DF_CPU=16000000L: No such file or directory
avr-g++: /DARDUINO=157: No such file or directory
avr-g++: /DARDUINO_AVR_UNO: No such file or directory
avr-g++: /I.pioenvs\myuno\core: No such file or directory
avr-g++: /I.pioenvs\myuno\variant: No such file or directory
scons: *** [.pioenvs\myuno\src\sketch.obj] Error 1
@ivankravets
Copy link
Member

Thanks a lot for report!

Did you define an Arduino Framework in platformio.ini? Like, framework = arduino.

Can you post here your project's platformio.ini ?

@pelikhan
Copy link
Author

pelikhan commented Oct 2, 2014

Yes I did. The issue looks a problem on how the arguments are passed to the compiler. It seems that it treats each argument as new command (thus ignoring the library includes).

[env:uno]
platform = atmelavr
framework = arduino
board = uno
upload_port = COM3
targets = upload

@ivankravets
Copy link
Member

Nice. Also, please give me a result of this command platformio show atmelavr

@pelikhan
Copy link
Author

pelikhan commented Oct 2, 2014

C:\arduino>platformio show atmelavr
atmelavr    - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework)
----------
Package: toolchain-atmelavr
Alias: toolchain
Location: C:\Users\jhalleux/.platformio\atmelavr\tools\toolchain
Version: 1
----------
Package: tool-avrdude
Alias: uploader
Location: C:\Users\jhalleux/.platformio\atmelavr\tools\avrdude
Version: 1
----------
Package: framework-arduinoavr
Location: C:\Users\jhalleux/.platformio\atmelavr\frameworks\arduino
Version: 4

@ivankravets
Copy link
Member

Thanks. I will test it under virtual W8.1 and post my experience here. Because I didn't think that Windows users will be interested in PlatformIO 😄

@pelikhan
Copy link
Author

pelikhan commented Oct 2, 2014

We are interrested!

@ivankravets
Copy link
Member

I've just installed PlatformIO on Windows 8.1. and successfully compiled the example https://github.com/ivankravets/platformio/tree/develop/examples/arduino-internal-library

Can you send to me@ikravets.com your sketch.ino file? I will retest it with my OS.

Thanks.

@pelikhan
Copy link
Author

pelikhan commented Oct 3, 2014

That's great news! Just sent the zipped folder. It also contains my tiny flask web server that allows a web site to flash the board.

@ivankravets
Copy link
Member

I don't have any problems with your example. See dump below.

  • I've pushed today new version of get-platformio.py script. Can you re-run it again? It should install new version of SCons, like 2.3.4. Check it:
$ scons --version
  • Please run command $ paltformio run directly from cmd, not via your WebScript.

P.S: Can your rewrite your server.py to native WSGI application without any dependencies, like Flask or etc? If yes, then I can include your codet to main repository in to scripts directory. And... Maybe you should rename it to cloud-builder.py or web-builder.py?

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\User>platformio
Usage: platformio-script.py [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  init         Initialize new PlatformIO based project
  install      Install new platforms
  lib          Library Manager
  list         List installed platforms
  run          Process project environments
  search       Search for development platforms
  serialports  List or Monitor Serial ports
  show         Show details about installed platforms
  uninstall    Uninstall platforms
  update       Update installed platforms
  upgrade      Upgrade PlatformIO to the latest version

C:\Users\User>platformio install atmelavr
Installing toolchain-atmelavr package:
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Installing tool-avrdude package:
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Installing framework-arduinoavr package:
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
The platform 'atmelavr' has been successfully installed!

C:\Users\User>E:

E:\>cd "repro.zip Folder"

E:\repro.zip Folder>platformio run
Processing uno environment:
avr-g++ -o .pioenvs\uno\src\sketch.o -c -fno-exceptions -g -Os -ffunction-sectio
ns -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUI
NO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\src\sketch.cp
p
avr-gcc -o .pioenvs\uno\core\WInterrupts.o -c -g -Os -ffunction-sections -fdata-
sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_UNO
 -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\WInterrupts.c
avr-gcc -o .pioenvs\uno\core\hooks.o -c -g -Os -ffunction-sections -fdata-sectio
ns -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_UNO -I.pi
oenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\hooks.c
avr-gcc -o .pioenvs\uno\core\wiring.o -c -g -Os -ffunction-sections -fdata-secti
ons -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_UNO -I.p
ioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\wiring.c
avr-gcc -o .pioenvs\uno\core\wiring_analog.o -c -g -Os -ffunction-sections -fdat
a-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_U
NO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\wiring_analog.c
avr-gcc -o .pioenvs\uno\core\wiring_digital.o -c -g -Os -ffunction-sections -fda
ta-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_
UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\wiring_digital.
c
avr-gcc -o .pioenvs\uno\core\wiring_pulse.o -c -g -Os -ffunction-sections -fdata
-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_UN
O -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\wiring_pulse.c
avr-gcc -o .pioenvs\uno\core\wiring_shift.o -c -g -Os -ffunction-sections -fdata
-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_UN
O -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\wiring_shift.c
avr-g++ -o .pioenvs\uno\core\CDC.o -c -fno-exceptions -g -Os -ffunction-sections
 -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO
_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\CDC.cpp
avr-g++ -o .pioenvs\uno\core\HID.o -c -fno-exceptions -g -Os -ffunction-sections
 -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO
_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\HID.cpp
avr-g++ -o .pioenvs\uno\core\HardwareSerial.o -c -fno-exceptions -g -Os -ffuncti
on-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=15
7 -DARDUINO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core
\HardwareSerial.cpp
avr-g++ -o .pioenvs\uno\core\HardwareSerial0.o -c -fno-exceptions -g -Os -ffunct
ion-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=1
57 -DARDUINO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\cor
e\HardwareSerial0.cpp
avr-g++ -o .pioenvs\uno\core\HardwareSerial1.o -c -fno-exceptions -g -Os -ffunct
ion-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=1
57 -DARDUINO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\cor
e\HardwareSerial1.cpp
avr-g++ -o .pioenvs\uno\core\HardwareSerial2.o -c -fno-exceptions -g -Os -ffunct
ion-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=1
57 -DARDUINO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\cor
e\HardwareSerial2.cpp
avr-g++ -o .pioenvs\uno\core\HardwareSerial3.o -c -fno-exceptions -g -Os -ffunct
ion-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=1
57 -DARDUINO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\cor
e\HardwareSerial3.cpp
avr-g++ -o .pioenvs\uno\core\IPAddress.o -c -fno-exceptions -g -Os -ffunction-se
ctions -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DA
RDUINO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\IPAd
dress.cpp
avr-g++ -o .pioenvs\uno\core\Print.o -c -fno-exceptions -g -Os -ffunction-sectio
ns -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUI
NO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\Print.cp
p
avr-g++ -o .pioenvs\uno\core\Stream.o -c -fno-exceptions -g -Os -ffunction-secti
ons -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDU
INO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\Stream.
cpp
avr-g++ -o .pioenvs\uno\core\Tone.o -c -fno-exceptions -g -Os -ffunction-section
s -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUIN
O_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\Tone.cpp
avr-g++ -o .pioenvs\uno\core\USBCore.o -c -fno-exceptions -g -Os -ffunction-sect
ions -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARD
UINO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\USBCor
e.cpp
avr-g++ -o .pioenvs\uno\core\WMath.o -c -fno-exceptions -g -Os -ffunction-sectio
ns -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUI
NO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\WMath.cp
p
avr-g++ -o .pioenvs\uno\core\WString.o -c -fno-exceptions -g -Os -ffunction-sect
ions -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARD
UINO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\WStrin
g.cpp
avr-g++ -o .pioenvs\uno\core\main.o -c -fno-exceptions -g -Os -ffunction-section
s -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUIN
O_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\main.cpp
avr-g++ -o .pioenvs\uno\core\new.o -c -fno-exceptions -g -Os -ffunction-sections
 -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO
_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\core\new.cpp
avr-ar rcs .pioenvs\uno\libcore.a .pioenvs\uno\core\WInterrupts.o .pioenvs\uno\c
ore\hooks.o .pioenvs\uno\core\wiring.o .pioenvs\uno\core\wiring_analog.o .pioenv
s\uno\core\wiring_digital.o .pioenvs\uno\core\wiring_pulse.o .pioenvs\uno\core\w
iring_shift.o .pioenvs\uno\core\CDC.o .pioenvs\uno\core\HID.o .pioenvs\uno\core\
HardwareSerial.o .pioenvs\uno\core\HardwareSerial0.o .pioenvs\uno\core\HardwareS
erial1.o .pioenvs\uno\core\HardwareSerial2.o .pioenvs\uno\core\HardwareSerial3.o
 .pioenvs\uno\core\IPAddress.o .pioenvs\uno\core\Print.o .pioenvs\uno\core\Strea
m.o .pioenvs\uno\core\Tone.o .pioenvs\uno\core\USBCore.o .pioenvs\uno\core\WMath
.o .pioenvs\uno\core\WString.o .pioenvs\uno\core\main.o .pioenvs\uno\core\new.o
avr-g++ -o .pioenvs\uno\firmware.elf -Os -Wl,--gc-sections -mmcu=atmega328p .pio
envs\uno\src\sketch.o -L.pioenvs\uno .pioenvs\uno\libcore.a -lm
avr-objcopy -O ihex -R .eeprom .pioenvs\uno\firmware.elf .pioenvs\uno\firmware.h
ex
.pioenvs\uno\core\Stream.cpp: In member function 'bool Stream::find(char*)':
.pioenvs\uno\core\Stream.cpp:78: warning: deprecated conversion from string cons
tant to 'char*'
.pioenvs\uno\core\Tone.cpp:119: warning: only initialized variables can be place
d into program memory area

E:\repro.zip Folder>

@pelikhan
Copy link
Author

pelikhan commented Oct 3, 2014

new to python, will take a look at the wsgi.

no luck with the new instructions still failing. Is there a verbose logging mode that I can turn on?

@ivankravets
Copy link
Member

new to python, will take a look at the wsgi.
I'm too new to Python 😄

Did you resolve this issue?

@ivankravets
Copy link
Member

Please reopen this issue if you have a problem.

@pelikhan
Copy link
Author

This issue is still active. Tried on another computer same problem. Is there a logging mode to diagnose this.

@ivankravets ivankravets reopened this Nov 10, 2014
@ivankravets
Copy link
Member

I retested PlatformIO under Win XP/7/8.1. It works perfectly. I see in a log that a few developers use Win Server. I've installed into VM latest Win Server 2012. See the result:

PlatformIO Windows Server 2012

@johannesg
Copy link

I have the same problem, and I think know why it fails. Look carefully at both your console output and you'll see that they differ

@pelikhan:

avr-g++ /Fo.pioenvs\myuno\src\sketch.obj /c .pioenvs\myuno\src\sketch.cpp -fno-exceptions -g -Os -ffunction-sections -fdata-sections -MMD -mmcu=atmea328p /DF_CPU=16000000L /DARDUINO=157 /DARDUINO_AVR_UNO /I.pioenvs\myuno\core /I.pioenvs\myuno\variant

@ivankravets:

avr-g++ -o .pioenvs\uno\src\sketch.o -c -fno-exceptions -g -Os -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_UNO -I.pioenvs\uno\core -I.pioenvs\uno\variant .pioenvs\uno\src\sketch.cpp

The compiler switches of @pelikhan:s (and mine) cmd mixes forward slashes and dashes, while for @ivankravets it only uses dashes. Forward slashes seems to be ignored by the compiler which results in errors.

A wild guess is that this has something to do with regional settings on the windows machine. @pelikhan what regional settings and keyboard layout do you have on your machine? I have swedish settings.

@johannesg
Copy link

I just tried to change regional settings to US with no effect unfortunately...

@johannesg
Copy link

I found this answer on SO: http://stackoverflow.com/a/15597849.

I do have Visual Studio 2013 installed. Could it be that Scons somehow mixes the MSVC build environment and the avr-gcc cross compile environment?

Accoring to the answer I should try to set the build environment using:

env = Environment(tools = ['gcc'])

@johannesg
Copy link

I got it working by changing this line: https://github.com/ivankravets/platformio/blob/release/v0.9.1/platformio/builder/main.py#L53

from this:

tools=["default", "platformio"],

to this:

tools=["default", "gcc", "g++", "ar", "gnulink", "platformio"],

It feels very brute force though so I'm sure there is a better way, but hopefully this might help you find a real solution.

@ivankravets ivankravets added this to the 1.0.0 milestone Dec 10, 2014
@ivankravets ivankravets self-assigned this Dec 10, 2014
@ivankravets
Copy link
Member

@johannesg thanks a lot for you research!!! 👍 I've just installed MSVC and reproduced this bug! 😄

  1. I'm going to re-test your temporary solution (as for me, it looks strange 😄 ). I will contact with SCons developers how we can fix it.
  2. I want to release 0.9.2 today, which will include your solution! 👍

@johannesg
Copy link

Great! Thanks!

@ivankravets
Copy link
Member

@pelikhan, @johannesg try to upgrade via > platformio upgrade. 0.9.2 should fix it. Thanks! 👍

@ivankravets
Copy link
Member

@pelikhan @johannesg - thanks a lot for help! 👍

Finally, fixed in 9e4618c

@ivankravets ivankravets removed this from the 1.0.0 milestone Feb 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants