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

Error installing and including libraries into IDE 2.0.1 #1609

Closed
3 tasks done
ProfSchneider opened this issue Nov 1, 2022 · 1 comment
Closed
3 tasks done

Error installing and including libraries into IDE 2.0.1 #1609

ProfSchneider opened this issue Nov 1, 2022 · 1 comment
Assignees
Labels
conclusion: duplicate Has already been submitted type: imperfection Perceived defect in any part of project

Comments

@ProfSchneider
Copy link

ProfSchneider commented Nov 1, 2022

Describe the problem

I want to include a sort algorithm into IDE 2.0.1. First I found "QuickSortLib" in the Library Manager, installed 1.2.0 but found no example under examples. I opened the example QuickSortInt.ino and compiling led to the error:

D:\SVN\AlphaBot\Demos\Arduino\libraries\QuickSortLib\examples\QuickSortInt\QuickSortInt.ino: In function 'void setup()':
D:\SVN\AlphaBot\Demos\Arduino\libraries\QuickSortLib\examples\QuickSortInt\QuickSortInt.ino:30:2: error: 'template<class T> class QuickSort' used without template parameters
  QuickSort::SortAscending(values100, 0, values100Length - 1);
  ^~~~~~~~~

exit status 1

Compilation error: 'template<class T> class QuickSort' used without template parameters

Then I included ArduinoSort.zip (via Sketch > Include Library > Add .ZIP Library...)
Result: no example, I opened a new sketch and inserted #include <ArduinoSort.h>
Error:

Der Sketch verwendet 444 Bytes (1%) des Programmspeicherplatzes. Das Maximum sind 32256 Bytes.
Globale Variablen verwenden 9 Bytes (0%) des dynamischen Speichers, 2039 Bytes für lokale Variablen verbleiben. Das Maximum sind 2048 Bytes.
grpc: error while marshaling: string field contains invalid UTF-8

Compilation error: grpc: error while marshaling: string field contains invalid UTF-8

I did the same in IDE 1.8.19 and everything works fine.
How can I use librarys in IDE 2.0.1

To reproduce

  1. Install QuickSortLib via manager

  2. Check examples

  3. run demo

  4. install ArduinoSort.zip (https://github.com/emilv/ArduinoSort)

  5. Check examples

  6. run demo

Expected behavior

Serial output of SortArray.ino:

Not sorted:
3
1
4711
2
0
sortArray:
0
1
2
3
4711
sortArrayReverse:
4711
3
2
1
0
Largest: 4711
Done! Sleep and repeat...

Arduino IDE version

2.0.1

Operating system

Windows

Operating system version

10

Additional context

Arduino Uno

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@ProfSchneider ProfSchneider added the type: imperfection Perceived defect in any part of project label Nov 1, 2022
@per1234
Copy link
Contributor

per1234 commented Nov 1, 2022

Hi @ProfSchneider. You are reporting multiple unrelated problems here:

I found "QuickSortLib" in the Library Manager, installed 1.2.0 but found no example under examples

I wasn't able to reproduce this, but there is a known bug where the examples menu is intermittently not populated: #262

I'll provide instructions for the workaround:

  1. Select File > Quit from the Arduino IDE menus.
  2. Start Arduino IDE.

You should now find that the library's examples are listed under the File > Examples > QuickSortLib menu.


D:\SVN\AlphaBot\Demos\Arduino\libraries\QuickSortLib\examples\QuickSortInt\QuickSortInt.ino:30:2: error: 'template<class T> class QuickSort' used without template parameters
  QuickSort::SortAscending(values100, 0, values100Length - 1);
  ^~~~~~~~~

This is caused by a change the author of the "QuickSortLib" library made evidently with the intent of using the "class template argument deduction" feature added in the C++17 standard:

luisllamasbinaburo/Arduino-QuickSort@b267f1f

The "Arduino AVR Boards" platform of the Uno uses the C++11 standard, so it is expected that any code using the feature will fail to compile. That will happen no matter which version of the Arduino IDE you are using to compile the code.

A pull request was been submitted to revert that change so that the examples will compile once more:

luisllamasbinaburo/Arduino-QuickSort#2

However, since it has not received any attention from the library author in over two years, you should not hope too much for it to be accepted anytime soon. Fortunately, the fix is trivial so you can simply apply it to the example sketch yourself:

https://github.com/luisllamasbinaburo/Arduino-QuickSort/pull/2/files#diff-955ad4d68e6cdfafc71f3308e6ff9549860139fee7422d8b31eb9bdf42273877R40

QuickSort<int>::SortAscending(values100, 0, values100Length - 1);

So we can see this is not a problem with Arduino IDE 2.x, but instead a problem with the library.


I included ArduinoSort.zip (via Sketch > Include Library > Add .ZIP Library...)
Result: no example,

This is a known bug: #659

I'll provide instructions for the workaround:

  1. Select File > Quit from the Arduino IDE menus.
  2. Start Arduino IDE.

You should now find that the library's example is listed under the File > Examples > ArduinoSort menu.


grpc: error while marshaling: string field contains invalid UTF-8

Compilation error: grpc: error while marshaling: string field contains invalid UTF-8

This is a bug in Arduino IDE 2.x and/or Arduino CLI: arduino/arduino-cli#1907

I will provide you with instructions for the workaround:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Note the path shown in the "Sketchbook location" field.
  3. Find the folder that contains the installation of the "ArduinoSort" library. It will be under the libraries subfolder of the sketchbook path.
  4. Open the library.properties file you find there in any text editor.
  5. Change line 4 of that file from this:
    maintainer=Emil Vikstr�m
    
    to this:
    maintainer=Emil Vikstrom
    
  6. Save the file.

You should now be able to compile sketches using library without getting that "grpc: error while marshaling: string field contains invalid UTF-8" error.


It is best to have only a single issue per subject so we can consolidate all relevant discussion to one place, so I'll go ahead and close this in favor of the previous issues about the defects you encountered.

If you end up with additional information to share, feel free to comment in the other threads.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2022
@per1234 per1234 self-assigned this Nov 1, 2022
@per1234 per1234 added the conclusion: duplicate Has already been submitted label Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants