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

RPi Imager 1.6.1 can't be built on Ubuntu 18.04 #200

Closed
lurch opened this issue Mar 31, 2021 · 3 comments
Closed

RPi Imager 1.6.1 can't be built on Ubuntu 18.04 #200

lurch opened this issue Mar 31, 2021 · 3 comments

Comments

@lurch
Copy link
Contributor

lurch commented Mar 31, 2021

I followed the instructions in the README but it fails with a build error:

/home/andrew/github/raspberrypi/rpi-imager/downloadthread.cpp: In member function ‘bool DownloadThread::_customizeImage()’:
/home/andrew/github/raspberrypi/rpi-imager/downloadthread.cpp:935:45: error: ‘class QString’ has no member named ‘back’
             if (!folder.isEmpty() && folder.back() == '\\')
                                             ^~~~
CMakeFiles/rpi-imager.dir/build.make:254: recipe for target 'CMakeFiles/rpi-imager.dir/downloadthread.cpp.o' failed
make[3]: *** [CMakeFiles/rpi-imager.dir/downloadthread.cpp.o] Error 1

Looks like QString.back() was added in Qt 5.10, but Ubuntu 18.04 only includes Qt 5.9.5

@maxnet
Copy link
Collaborator

maxnet commented Mar 31, 2021

Looks like QString.back() was added in Qt 5.10, but Ubuntu 18.04 only includes Qt 5.9.5

Just replace it with .right(1) for now.

Not sure if we can keep supporting 5.9.5 in the long run.
Some changes needed to move to Qt 6 do not work in 5.9.5 Somewhat related issue: #134

@lurch
Copy link
Contributor Author

lurch commented Mar 31, 2021

Ah, before seeing your reply I just fixed it with:

diff --git a/downloadthread.cpp b/downloadthread.cpp
index 1fa0e5c..010aa54 100644
--- a/downloadthread.cpp
+++ b/downloadthread.cpp
@@ -932,7 +932,7 @@ bool DownloadThread::_customizeImage()
         for (auto mp : mountpoints)
         {
             folder = QString::fromStdString(mp);
-            if (!folder.isEmpty() && folder.back() == '\\')
+            if (!folder.isEmpty() && folder.at(folder.size() - 1) == '\\')
                 folder.chop(1);
             configFilename = folder+"/config.txt";
 

@lurch
Copy link
Contributor Author

lurch commented Mar 31, 2021

...but it also builds with the slightly simpler:

diff --git a/downloadthread.cpp b/downloadthread.cpp
index 1fa0e5c..fe04290 100644
--- a/downloadthread.cpp
+++ b/downloadthread.cpp
@@ -932,7 +932,7 @@ bool DownloadThread::_customizeImage()
         for (auto mp : mountpoints)
         {
             folder = QString::fromStdString(mp);
-            if (!folder.isEmpty() && folder.back() == '\\')
+            if (!folder.isEmpty() && folder.right(1) == '\\')
                 folder.chop(1);
             configFilename = folder+"/config.txt";
 

😄

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