Skip to content

Unable to use library directory on Windows #280

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

Closed
jgfoster opened this issue Feb 3, 2021 · 11 comments
Closed

Unable to use library directory on Windows #280

jgfoster opened this issue Feb 3, 2021 · 11 comments

Comments

@jgfoster
Copy link
Member

jgfoster commented Feb 3, 2021

On one of my student's Windows machine we find the following:

Bundled gems are installed into `./vendor/bundle`
                           .                  __  ___
                   _, ,_  _| , . * ._   _    /  `  |
                  (_| [ `(_] (_| | [ ) (_)   \__. _|_   v1.3.0

 

Host OS...                                                               windows
Located arduino-cli binary...                     C:\Users\calvo/arduino-cli.exe
Found libraries directory...          C:\Users\calvo\Documents\Arduino/libraries
Environment variable CUSTOM_INIT_SCRIPT...                                    ''
Environment variable USE_SUBDIR...                                            ''
Installing library under test...                                               ✗
This may indicate a problem with your configuration; halting here
Failures: 1
========== Last backend command (if relevant):
There is already a library 'Adafruit BusIO' in the library directory (C:\Users\calvo\Documents\Arduino/libraries/Adafruit_BusIO).  It may need to be removed manually.

Here is the directory on Windows:

$ ls -al C:/Users/calvo/Documents/Arduino/libraries
total 37
drwxr-xr-x 1 calvo 197609  0 Feb  2 13:40 .
drwxr-xr-x 1 calvo 197609  0 Feb  2 13:36 ..
drwxr-xr-x 1 calvo 197609  0 Feb  2 16:08 Adafruit_BusIO
drwxr-xr-x 1 calvo 197609  0 Feb  2 13:19 Adafruit_MAX31865
drwxr-xr-x 1 calvo 197609  0 Jan 24 20:51 Ethernet
drwxr-xr-x 1 calvo 197609  0 Nov 26 17:07 LiquidCrystal
-rw-r--r-- 1 calvo 197609 87 Oct 11 17:01 readme.txt
drwxr-xr-x 1 calvo 197609  0 Jan 24 16:41 RTClib
drwxr-xr-x 1 calvo 197609  0 Jan 28 17:15 TankControllerLib
drwxr-xr-x 1 calvo 197609  0 Oct 11 17:02 USBHost

On my macOS machine we find the following:

                           .                  __  ___
                   _, ,_  _| , . * ._   _    /  `  | 
                  (_| [ `(_] (_| | [ ) (_)   \__. _|_   v1.3.0

Host OS...                                                                   osx
Located arduino-cli binary...                         /Users/jfoster/arduino-cli
Found libraries directory...          /Users/jfoster/Documents/Arduino/libraries
Environment variable CUSTOM_INIT_SCRIPT...                                    ''
Environment variable USE_SUBDIR...                                            ''
Installing library under test...                                               ✓
WARNING... Installed library named 'Adafruit BusIO' has directory name 'Adafruit_BusIO'
Library installed at... /Users/jfoster/Documents/Arduino/libraries/Adafruit_BusIO

================================================================================
Beginning the next phase of testing...                              Unit testing
The set of compilers (1) isn't empty...                                        ✓
Checking g++ version... 
    Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
    Apple clang version 12.0.0 (clang-1200.0.32.29)
    Target: x86_64-apple-darwin19.6.0
    Thread model: posix
    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
...Checking g++ version                                                        ✓
libasan availability for g++...                                             true
Library conforms to Arduino library specification...                         1.5
Wildcard architecture in library.properties, using configured platforms... 
    mega2560
...Wildcard architecture in library.properties, using configured platforms      

Unit testing test.cpp with g++ for mega2560... 

Here is the directory on macOS:

jfoster@ljs Adafruit_BusIO % ll /Users/jfoster/Documents/Arduino/libraries
total 24
drwxr-xr-x@ 12 jfoster  staff   384 Feb  2 16:12 ./
drwxr-xr-x@  4 jfoster  staff   128 Jan 12 10:32 ../
-rw-r--r--@  1 jfoster  staff  6148 Feb  2 16:12 .DS_Store
drwxr-xr-x  19 jfoster  staff   608 Feb  2 16:19 Adafruit_BusIO/
drwxr-xr-x@ 22 jfoster  staff   704 Feb  2 12:41 Adafruit_MAX31865/
drwxr-xr-x  18 jfoster  staff   576 Feb  2 13:00 Blink/
drwxr-xr-x   8 jfoster  staff   256 Jan 12 10:13 Ethernet/
drwxr-xr-x  16 jfoster  staff   512 Dec 19 14:48 LiquidCrystal/
drwxr-xr-x  10 jfoster  staff   320 Jan 12 10:13 RTClib/
drwxr-xr-x@ 31 jfoster  staff   992 Jan 18 08:24 TankControllerLib/
drwxr-xr-x  10 jfoster  staff   320 Jan 12 10:13 TinyWireM/
-rw-r--r--   1 jfoster  staff    87 Dec 19 14:50 readme.txt
jfoster@ljs Adafruit_BusIO % 

So, on Windows it says that the library must be removed (an error), while on macOS it says that the library exists (a warning). When we move the working directory out of C:\Users\calvo\Documents\Arduino/libraries then we no longer get that error. Instead we get the following:

Library conforms to Arduino library specification...                         1.0
No tests directory at... C:\Users\calvo\Documents\Arduino/libraries/Adafruit_BusIO/test
Environment variable EXPECT_UNITTESTS is...                          (NilClass)
Skipping unit tests...
  In case that's an error, displaying contents of base directory:

Interestingly, we are running the same version of Arduino-cli (0.13.0), but his environment thinks that the library conforms to specification 1.0 while mine thinks that the library conforms to specification 1.5.

@jgfoster jgfoster changed the title Unable to use existing directory Unable to use library directory on Windows Feb 3, 2021
@ianfixes
Copy link
Collaborator

ianfixes commented Feb 4, 2021

I should add this to the build output in the future, but what is your working directory?

I'm wondering if there's a bug in the logic of path comparison -- note the mix of forward and backward slashes in C:\Users\calvo\Documents\Arduino/libraries.

@jgfoster
Copy link
Member Author

jgfoster commented Feb 5, 2021

Yes, the working directory started in C:\Users\calvo\Documents\Arduino/libraries. When we moved out then it could not find the tests.

@ianfixes
Copy link
Collaborator

ianfixes commented Feb 5, 2021

The working directory needs to be the library under test itself, what's the name of that library?

@jgfoster
Copy link
Member Author

jgfoster commented Feb 5, 2021

This is for 'Adafruit BusIO'. On my macOS we see the following:

WARNING... Installed library named 'Adafruit BusIO' has directory name 'Adafruit_BusIO'
Library installed at... /Users/jfoster/Documents/Arduino/libraries/Adafruit_BusIO

@ianfixes
Copy link
Collaborator

ianfixes commented Feb 5, 2021

OK, thanks. If you can confirm that you're running the command from C:\Users\calvo\Documents\Arduino/libraries/Adafruit_BusIO then it's a sure sign that the problem is in the pathname logic. I'll see what unit tests I can write for that

@jgfoster
Copy link
Member Author

jgfoster commented Feb 5, 2021

Yes, that is where we ran the command ./scripts/buildAndRun.sh.

@ianfixes ianfixes added this to the 2021 Beta 1 Features milestone Apr 5, 2021
@ianfixes
Copy link
Collaborator

ianfixes commented Apr 5, 2021

😳 Well here's a problem I just fixed 83401aa

@jgfoster
Copy link
Member Author

jgfoster commented Apr 5, 2021

Yes, the Windows workflow should probably run in Windows and not Linux!

@ianfixes
Copy link
Collaborator

ianfixes commented Apr 5, 2021

I can't think of an easy way to unit test this, but I've added 1c53896 in #296 which may avoid the problem by properly ingesting windows paths (the backslashes are the problem). Are you still in a position to reproduce this error?

@jgfoster
Copy link
Member Author

jgfoster commented Apr 5, 2021

This was a couple months ago and we moved this student from Windows to a campus cloud Linux IDE environment, so it would be a bit of work to try to test it manually. I'm content with the changes making some improvements and revisiting the issue if we reproduce it.

@ianfixes
Copy link
Collaborator

I believe that a fix has been merged as part of #334 and was released in v1.4.0.

I added some translations between windows (backslash) and MacOS/Linux (forward slash) paths, and some unit tests. There was some affected code in the library installation, and hopefully this is now fixed. Please file a new issue if not, as several aspects of the runner and architecture have changed.

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

No branches or pull requests

2 participants