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

mbed compile not working in cygwin #299

Closed
BlackstoneEngineering opened this issue Jul 29, 2016 · 7 comments
Closed

mbed compile not working in cygwin #299

BlackstoneEngineering opened this issue Jul 29, 2016 · 7 comments

Comments

@BlackstoneEngineering
Copy link

Problem

mbed compile does not work in cygwin. I believe this is due to it grabbing cygwin formatted paths and then calling the compiler in windows context. Thus it is passing linux formatted addresses to a tool that expects windows formatted addresses.

Solution

a) make a more universal call that doesnt pass in linux formatted paths
b) detect cygwin is running and call the cygwin path conversion tool on all addresses
c) grab the paths in a windows context instead of within the cygwin context.

Example

Running mbed build on cmd works just fine, but if i run it in cygwin it returns the following

...
...
Compile: SVC_Table.S
Compile: rt_Event.c
Compile: rt_List.c
Compile: rt_Mailbox.c
Compile: rt_MemBox.c
Compile: rt_CMSIS.c
Compile: rt_Memory.c
Compile: rt_Mutex.c
Compile: rt_OsEventObserver.c
Compile: rt_Semaphore.c
Compile: rt_Robin.c
Compile: rt_System.c
Compile: test_env.cpp
[ERROR] arm-none-eabi-g++.exe: error: /home/ausbla01/mbed/test/mbed-os-example-blinky/mbed-os/libraries/tests/mbed/env/test_env.cpp: No such file or directory
arm-none-eabi-g++.exe: fatal error: no input files
compilation terminated.

[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u /home/ausbla01/mbed/test/mbed-os-example-blinky/mbed-os/tools/make.py -t GCC_ARM -m K64F -c --source . --build ./.build/K64F/GCC_ARM" in "/home/ausbla01/mbed/test/mbed-os-example-blinky"

---

@bridadan
Copy link
Contributor

@BlackstoneEngineering This is a very strange error, since it looks like it was able to compile a few source files before this particular file caused an issue. The stranger thing is, if you're compiling the blinky example, it shouldn't even try to compile that particular file since there's an .mbedignore file in the /libraries folder.

Can you paste the full log of mbed compile -v after deleting your .build folder? I'd be curious to see what commands are being sent to the compiler.

@screamerbg
Copy link
Contributor

Will add to the documentation that cygwin is not supported at this time. PRs welcome! :)

@BlackstoneEngineering
Copy link
Author

BlackstoneEngineering commented Aug 4, 2016

Right, here is the info on the cygpath tool for future reference: https://cygwin.com/cygwin-ug-net/cygpath.html . cygpath comes bundles with cygwin and enables translating file paths between windows / posix formats for use in cygwin.

The problem seems to be the main processs in cygwin runs in cygwin env using POSIX paths, but all subprocesses get spun off into windows environments that need windows paths, thus a posix path is given to a windows path, which promptly blows up.

The solution is

  1. Detect env is cygwin, then convert all paths appropriately using cygpath as needed
  2. Spin up subprocesses in same env as main process, ie when using cygwin put subprocesses into cygwin env as well. Not sure how to do this though.

After discussing with @screamerbg we will not be supporting cygwin at this time, however it is a welcome PR feature update in the future. Low priority for the internal team, but more than welcome as a contribution.

@screamerbg
Copy link
Contributor

Now covered in the Troubleshooting section of mbed CLI documentation.

@mukymuk
Copy link

mukymuk commented Sep 1, 2016

You can sidestep the cygwin path issue by avoiding absolute paths. In mbed-os/tools/settings.py I set ROOT = ".."

@tkstreet
Copy link

As an update to @mukymuk, the settings.py doesn't exist anymore. The relevant code is now contained in ../Python27/Lib/site-packages/mbed/mbed.py

I just added ROOT = ".." after the import statements and then my program compiled.

@bmcdonnell-ionx
Copy link
Contributor

This issue is closed. Should someone remove the "in progress" label?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants