Обсуждение: Statically linking ICU with Postgres
I was able to link ICU library with postgres as shared objects using the configure command: ./configure --prefix=/leoaaryan/postgres-10 ... --with-icu ICU_CFLAGS="-I/leoaaryan/postgres-10/include" ICU_LIBS="-L/leoaaryan/postgres-10/lib -licuuc -licudata -licui18n" Now I'm trying link ICU with postgres as a static library. This is how I have compiled and installed ICU: ./runConfigureICU Linux/gcc --prefix=/leoaaryan/postgres-10 --enable-shared=no --enable-static make make install I can see libicu*.a in the directory /leoaaryan/postgres-10/lib. But I'm not able to make the postgres source code with it. ./configure --prefix=/leoaaryan/postgres-10 ... --with-icu ICU_CFLAGS="-I/leoaaryan/postgres-10/include" ICU_LIBS="-L/leoaaryan/postgres-10/lib" Is there a way to link ICU library to Postgres statically? -- Sent from: http://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html
On Tue, Dec 19, 2017 at 12:10 PM, leoaaryan <leoaaryan@gmail.com> wrote: > I can see libicu*.a in the directory /leoaaryan/postgres-10/lib. But I'm not > able to make the postgres source code with it. > ./configure --prefix=/leoaaryan/postgres-10 ... --with-icu > ICU_CFLAGS="-I/leoaaryan/postgres-10/include" > ICU_LIBS="-L/leoaaryan/postgres-10/lib" > > Is there a way to link ICU library to Postgres statically? Why would you want to do that? This does not improve the user experience and you are asking for more pain with your package management by not relying on what the OS provides. -- Michael
IMO the whole idea behind building Postgres with ICU was to remove the dependency provided by the OS package. Installing ICU as shared object and configuring Postgres with the libicu*.so file may have a dependency on LD_LIBRARY_PATH. In shared object situation un-setting/re-setting the LD_LIBRARY_PATH will give inconsistent behavior. If I'm able to link ICU library to Postgres statically I'll be able to remove these dependencies. I know there are libraries which are statically linked with the Postgres code and even Postgres internally links modules statically. I'm aiming to install ICU outside the Postgres source code directory and then link it statically. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html
I was able to do it. I had to build ICU statically first with --enable-static --enable-shared=no options. During configuring postgres I had to use the right flags for ICU: /configure --prefix=/leoaaryan/postgres-10 ... --with-icu ICU_CFLAGS="-I/leoaaryan/postgres-10/include -DU_STATIC_IMPLEMENTATION" ICU_LIBS="-L/leoaaryan/postgres-10/lib -licui18n -licuuc -licudata -lstdc++" -- Sent from: http://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html