Re: [Vala] Static linking



Abderrahim Kitouni wrote:
the output of pkg-config --cflags --libs <whatever packages you
passed to valac>

if you compile with
valac --pkg gtk+-2.0 -C myprog.vala
the generated code must be compiled with
gcc `pkg-config --cflags --libs gtk+-2.0` myprog.c
(if you haven't passed any --pkg to vala use gobject-2.0)

btw, I think you just need to pass -static to gcc (or -X -static to
valac) to make static binaries. (I'm not sure what is needed for
libraries, but any build tool should allow you to build one).

Thanks for the information! I didn't realize that people might have
thought I wanted to compile the libraries to be separate from the
binaries as static libraries. Nope, I just wanted them compiled into the
executable itself, like you said. Will ar work for statically linking
libraries into a binary, or is that just for making static libraries? If
not, I might need some help with another method, as you may see below:

I tried
valac -X -static --pkg gtk+-2.0 myProgram.vala
and got pages and pages of all kinds of weird errors. I don't know if
that syntax is right. Here's a small portion of the errors I got,
starting from the beginning:

/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libgio-2.0.a(glocalfileinfo.o):
In function `lookup_gid_name':
(.text+0x217f): warning: Using 'getgrgid_r' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libgio-2.0.a(glocalvfs.o):
In function `g_local_vfs_parse_name':
(.text+0x235): warning: Using 'getpwnam' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libglib-2.0.a(gutils.o):
In function `g_get_any_init_do':
(.text+0xf40): warning: Using 'getpwuid' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libglib-2.0.a(gutils.o):
In function `g_get_any_init_do':
(.text+0xf34): warning: Using 'setpwent' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libglib-2.0.a(gutils.o):
In function `g_get_any_init_do':
(.text+0xf4a): warning: Using 'endpwent' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libglib-2.0.a(gutils.o):
In function `g_get_any_init_do':
(.text+0xdd3): warning: Using 'getpwnam_r' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libgio-2.0.a(glocalfileinfo.o):
In function `lookup_uid_data':
(.text+0x1fed): warning: Using 'getpwuid_r' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libgtk-x11-2.0.a(gtkselection.o):
In function `_gtk_selection_incr_event':
…




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]