How to compile icu statically into Qt 6?
-
Re: Statically compiling ICU on Linux?
I want to compile icu statically into qt so that my app won't search for icu libs.
Should I add
-static-runtimeto my configure command or add cmake options? -
Re: Statically compiling ICU on Linux?
I want to compile icu statically into qt so that my app won't search for icu libs.
Should I add
-static-runtimeto my configure command or add cmake options?Hi,
No, you have to first get or build a static version of ICU and use that one to build Qt.
-
Hi,
No, you have to first get or build a static version of ICU and use that one to build Qt.
-
@SGaist Hi!
I'm building on Debian bookworm and already have libicu-dev installed. What else should I do?@Alxi11 said in How to compile icu statically into Qt 6?:
libicu-dev
This is dev package, not the lib itself. And I'm quite sure the lib itself on Debian is a shared lib, not static. As @SGaist wrote: either you get a static build or build this lib by yourself as static.
-
Re: Statically compiling ICU on Linux?
I want to compile icu statically into qt so that my app won't search for icu libs.
Should I add
-static-runtimeto my configure command or add cmake options?@Alxi11 said in How to compile icu statically into Qt 6?:
I want to compile icu statically into qt so that my app won't search for icu libs.
ICU decides itself if it is static or dynamic. Through package managers you always get dynamic libraries. There is nothing Qt can do about this.
Most likely, you have to compile ICU statically yourself. And then you need to teach Qt to link against the static library. This basically means that you also need to compile Qt yourself and during Qt compilation point it to your static ICU library. Once you have a Qt library compiled to link against a static ICU, you can use that Qt library just like normal inside your own applications.
@Alxi11 said in How to compile icu statically into Qt 6?:
Should I add -static-runtime to my configure command or add cmake options?
-static-runtimeis just about the C or C++ runtime. There is no command to link to a dynamic library as if it where static.Most likely the actual problem you are trying to solve is that not everybody has the right libs installed on their machine. We are using
linuxdeployandlinuxdeployqtto create an AppImage which has all dynamic libraries included (there is also snap and flatpack). Only downside: these check that you are running on an older Linux distro in order to make it compatible with most supported Linux versions out there.