-
Notifications
You must be signed in to change notification settings - Fork 187
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
Statically compiling with qt/qml for a truly standalone app #174
Comments
I am very interested in how to statically link everything too, but have not had much success in my limited experiments. I hope someone chimes in |
I hope someone will post a solution that works in Windows too...
|
@immesys @neclepsio Did you guys try the above build flags? If you aren't using OSX and have GCC installed then that flag should build the static type for you. My issue I think is because OSX has the Clang "imposter" instead of actual GCC, and Clang doesn't support that library. |
With GCC, I'm still getting:
Seems that QT needs to be compiled statically. Tried to do it but the
|
You need to have Qt statically compiled. I managed to build single static Qt/QML binary for Linux and Windows (i686-w64-mingw32) for my project here https://github.com/gen2brain/cbconvert . You can see build details in gui/make.bash . I also had to fiddle with pkgconfig files a lot. Windows binary is actually a full static binary, Linux binary is not fully static, it doesn't link to static libc and libGL, X libs etc. but it doesn't require Qt, and binary is more portable if you doesn't link libc statically. |
@gen2brain Thanks for your answer! I compiled QT statically, but when I try to build my app I get:
Any clues? |
You need to add missing libs to LDFLAGS, -lqtharfbuzzng -lqtpcre -licuuc , probably more. It will be either -lpcre or -lqtpcre, depends how you built Qt, with system libs or with bundled libs. You can modify pkgconfig files that Qt installed, what you need will probably be in Libs.private: , since this will not be fully static build you need to move some libs from Libs.private to Libs. I never did a full static build on Linux because of libGL but on Windows/mingw you can link to static -lopengl32 . |
The problem is that when I do that, I manage to compile but I get this error at runtime:
|
Ok, you need to modify cpp/modules.cpp, I am not sure now what I added there, here is the whole file:
And to link them check what I did here https://github.com/gen2brain/cbconvert/blob/master/gui/make.bash#L15 |
I have made my app and now I want to run it on another device. My development machine is OSX El Capitan and the test machine is OSX Yosemite.
Using
otool -L
I can see the libraries that it is dynamically linking to:When I run:
go build --ldflags '-extldflags "-static"'
I get:
Is there another way i can do this?
The text was updated successfully, but these errors were encountered: