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

Alpine 3.11 image #13

Closed
keeguon opened this issue Jan 24, 2020 · 7 comments · Fixed by #17
Closed

Alpine 3.11 image #13

keeguon opened this issue Jan 24, 2020 · 7 comments · Fixed by #17
Assignees

Comments

@keeguon
Copy link

keeguon commented Jan 24, 2020

Will you be providing Alpine 3.11 based images in the future ?

@chdanielmueller
Copy link
Member

I recently tried to build one without changing the Dockerfile. But unfortunately the build does not work without any changes.

If you are interested in trying to find out the error why it does not build feel free to do so and open a PR. I'm a bit busy at the moment and cannot do it myself

@keeguon
Copy link
Author

keeguon commented Jan 24, 2020

@chdanielmueller I will take a look over the weekend and get back to you ;)

@chdanielmueller
Copy link
Member

Perfect. Thank you

@wanghanlin
Copy link

wanghanlin commented Feb 4, 2020

I'm facing same issue with alpine 3.11, it seems related to g++ 9.2.0 in alpine 3.11.

I tested by changing g++ in Dockerfile to g++==8.3.0-r0 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main and it can build successfully (see log here), tested with docker run google.com - > test.pdf and it's working as expected.

Also libstdc++ and it's dependency libgcc are also using 9.2.0, but since the build is success, I didn't force install 8.3.0 from v3.10 repo.

As this is more like a hack instead of a fix, probably I won't submit a PR for this, but if you'd like to release with alpine 3.11 for other reason (like use a new version of php), I'm happy to commit this change.

@adm-bome
Copy link

I did not solve the problem! But dit some research....

The problem with the 3.11 image of alpine is that it uses g++ 9.20.

QT4.8 in the repository of wkhtmtopdf is not compatible wit gcc9.

This does not solve the problem entirely. The qmake command still gives an error. So wkhtmltopdf can't be build.

To build QT with no errors apply an extra patch qt-gcc9-foreach.patch:

--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -2482,22 +2482,32 @@ typedef uint Flags;

 #endif /* Q_NO_TYPESAFE_FLAGS */

-#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_RVCT)
+#if (defined(Q_CC_GNU) && !defined(Q_CC_RVCT))
 /* make use of typeof-extension */
 template <typename T>
 class QForeachContainer {
 public:
-    inline QForeachContainer(const T& t) : c(t), brk(0), i(c.begin()), e(c.end()) { }
+    inline QForeachContainer(const T& t) : c(t), i(c.begin()), e(c.end()), control(1) { }
     const T c;
     int brk;
     typename T::const_iterator i, e;
+    int control;
 };

+// Explanation of the control word:
+//  - it's initialized to 1
+//  - that means both the inner and outer loops start
+//  - if there were no breaks, at the end of the inner loop, it's set to 0, which
+//    causes it to exit (the inner loop is run exactly once)
+//  - at the end of the outer loop, it's inverted, so it becomes 1 again, allowing
+//    the outer loop to continue executing
+//  - if there was a break inside the inner loop, it will exit with control still
+//    set to 1; in that case, the outer loop will invert it to 0 and will exit too
 #define Q_FOREACH(variable, container)                                \
 for (QForeachContainer<__typeof__(container)> _container_(container); \
-     !_container_.brk && _container_.i != _container_.e;              \
-     __extension__  ({ ++_container_.brk; ++_container_.i; }))                       \
-    for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;}))
+     _container_.control && _container_.i != _container_.e;         \
+     ++_container_.i, _container_.control ^= 1)                     \
+    for (variable = *_container_.i; _container_.control; _container_.control = 0)

 #else

@mareksuscak mareksuscak mentioned this issue Aug 29, 2020
@mareksuscak
Copy link
Contributor

mareksuscak commented Aug 29, 2020

I just submitted 2 PRs that are adding support for Alpine 3.11 and 3.12. I spent this afternoon trying to get wkhtmltopdf 0.12.6 to compile on Alpine 3.11 and 3.12 with the default version of g++ but haven't had much success. However, as a workaround until these issues get sorted out, installing an older version of g++ and stdlibc++ from Alpine 3.10's package repository does the trick.

When you get a chance, could you please build and push these new images @chdanielmueller? Many thanks! 🙏

@chdanielmueller chdanielmueller self-assigned this Sep 8, 2020
@chdanielmueller
Copy link
Member

Hi @mareksuscak

I am currently in the process of building the images in your PRs.
They will probably be up today.
Thank you for your effort.

I also tagged your third PR with "help wanted".
Feel free to open an issue if you think this will get more people to see it.
I would be fine with waiting for wkhtmltopdf 0.12.7 which should include official alpine support:
wkhtmltopdf/packaging#2 (comment)

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

Successfully merging a pull request may close this issue.

5 participants