Forums » Linux

Linux users: question about your typical setup

Aug 18, 2004 a1k0n link
Hey guys,

I'm overhauling our updater program. Mainly the question I have for all of you is this: is libcurl ( http://curl.haxx.se ) an unreasonable dependency for the updater to have? I think just about every Linux distro comes with this now, and it seems to be the best Linux counterpart to Win32's IE shell extensions and MacOS X's Cocoa/NextStep URL grabbing library.

So, does everyone have this library, or can they suggest any alternatives? Obviously it's really easy to roll our own HTTP grabber too, but people always ask "how do I use a proxy" and other things that could be solved by a centralized library. The support for gzip encoding is very nice too.
Aug 18, 2004 Sheean link
Hmm, seems to be here. (fedora...)
Aug 18, 2004 Grzywacz link
I have it in both Debian unstable and Gentoo (~x86) and it's available in ancient Woody as well... No problems in my case.
Aug 18, 2004 mr_spuck link
Recent Slackware seems to have it too.

Wouldn't the easiest thing be to just link libcurl statically? The library isn't _that_ large.
Aug 18, 2004 AgY link
Present on my lfs, but was a surprise for me :)
Might be some depency.

>Wouldn't the easiest thing be to just link libcurl statically? The library isn't _that_ large.

yeah, but 1,5MB is a lot since the updater itself has 430kb.

Anyway how about two versions? Static and dynamic. I usally prefer statically linked versions (of closed source software) because they tend to run more stable.
Aug 18, 2004 mr_spuck link
> yeah, but 1,5MB is a lot since the updater itself has 430kb.

umm ... libcurl.a is only about 200k.

>Anyway how about two versions? Static and dynamic. I usally prefer
>statically linked versions (of closed source software) because
>they tend to run more stable.

... or at all :)
Aug 18, 2004 a1k0n link
Yeah, I might. The library can vary greatly in size depending on whether it supports SSL/FTP/gopher/etc.. But I guess I could configure my own stripped down copy and statically link it. Maybe I'll just do that.

But I figured since it dynamically links against gtk (statically linking would make it pretty huge..) it might as well link against libcurl. Statically linking gtk actually used to run into several problems, since gtk does some weird module loading stuff.
Aug 18, 2004 a1k0n link
A stripped-down statically linked libcurl is about 110k. Maybe I'll just do that.
Aug 19, 2004 AgY link
yep youre right, without debuging symbols is only has ~200k

ive fiddeled a bit:

-rw-r--r-- 1 againawa root 4708 Aug 19 21:14 libdl.a
-rw-r--r-- 1 againawa root 146944 Aug 19 21:14 libgdk.a
-rw-r--r-- 1 againawa root 97198 Aug 19 21:14 libglib.a
-rw-r--r-- 1 againawa root 4148 Aug 19 21:14 libgmodule.a
-rw-r--r-- 1 againawa root 887394 Aug 19 21:14 libgtk.a

i doubt that ive keeped all needed symbols ... a1k0n may do it better. Important is that you dont force your linker to include all symbols (only the needed) if i remember the things correctly .. there is a option for doing this.

it saves ~500kb on my libgtk :)

- AgY

strip --keep-symbol __gmon_start__ --keep-symbol libgtk-1.2.so.0 --keep-symbol gtk_hseparator_new --keep-symbol gtk_statusbar_push --keep-symbol gtk_button_box_set_layout --keep-symbol gtk_menu_get_type --keep-symbol gtk_main_iteration_do --keep-symbol gtk_scrolled_window_get_type --keep-symbol gtk_text_get_type --keep-symbol gtk_scrolled_window_new --keep-symbol gtk_widget_show --keep-symbol _DYNAMIC --keep-symbol gtk_type_is_a --keep-symbol gtk_hbox_new --keep-symbol gtk_statusbar_get_type --keep-symbol gtk_widget_show_all --keep-symbol gtk_widget_get_colormap --keep-symbol gtk_dialog_new --keep-symbol gtk_progress_configure --keep-symbol gtk_object_get_data --keep-symbol gtk_object_set_data --keep-symbol gtk_progress_get_type --keep-symbol gtk_container_add --keep-symbol gtk_misc_get_type --keep-symbol gtk_window_set_policy --keep-symbol gtk_window_set_position --keep-symbol _init --keep-symbol gtk_timeout_add --keep-symbol gtk_box_get_type --keep-symbol gtk_label_new --keep-symbol gtk_window_new --keep-symbol gtk_hbutton_box_new --keep-symbol gdk_pixmap_colormap_create_from_xpm --keep-symbol gtk_window_get_type --keep-symbol gtk_dialog_get_type --keep-symbol gtk_label_get_type --keep-symbol gtk_scrolled_window_set_policy --keep-symbol gtk_menu_get_attach_widget --keep-symbol gtk_input_add_full --keep-symbol gtk_text_new --keep-symbol gtk_widget_unref --keep-symbol gtk_window_set_title --keep-symbol gtk_box_pack_start --keep-symbol gtk_text_set_editable --keep-symbol gtk_container_set_border_width --keep-symbol gdk_pixmap_unref --keep-symbol gtk_init --keep-symbol gtk_editable_get_chars --keep-symbol gtk_misc_set_padding --keep-symbol g_malloc --keep-symbol gtk_progress_set_format_string --keep-symbol gtk_main_quit --keep-symbol gtk_widget_set_sensitive --keep-symbol gtk_button_box_get_type --keep-symbol gtk_type_check_object_cast --keep-symbol gtk_pixmap_new --keep-symbol gtk_editable_get_type --keep-symbol gtk_main --keep-symbol gdk_pixmap_colormap_create_from_xpm_d --keep-symbol gdk_bitmap_unref --keep-symbol gtk_statusbar_new --keep-symbol gtk_input_remove --keep-symbol gtk_set_locale --keep-symbol _fini --keep-symbol gtk_object_set_data_full --keep-symbol gtk_signal_connect_object --keep-symbol gtk_statusbar_pop --keep-symbol gtk_label_set_justify --keep-symbol gtk_progress_set_show_text --keep-symbol g_strdup --keep-symbol _GLOBAL_OFFSET_TABLE_ --keep-symbol g_log --keep-symbol gtk_widget_destroy --keep-symbol gtk_progress_bar_new --keep-symbol g_list_prepend --keep-symbol gtk_entry_new --keep-symbol gtk_container_get_type --keep-symbol gtk_signal_connect --keep-symbol gtk_button_new_with_label --keep-symbol g_free --keep-symbol gtk_text_insert --keep-symbol gtk_widget_set_usize --keep-symbol gtk_vbox_new --keep-symbol gtk_widget_ref --keep-symbol libgdk-1.2.so.0 --keep-symbol libglib-1.2.so.0 --keep-symbol libdl.so.2 --keep-symbol _IO_stdin_used --keep-symbol libXi.so.6 --keep-symbol libXext.so.6 --keep-symbol libX11.so.6 --keep-symbol libm.so.6 --keep-symbol pthread_create --keep-symbol _ZTVSt9exception --keep-symbol _ZTVSt13bad_exception --keep-symbol _ZTISt13bad_exception --keep-symbol _ZNSt13bad_exceptionD1Ev --keep-symbol _ZN10__cxxabiv119__terminate_handlerE --keep-symbol _ZN10__cxxabiv120__unexpected_handlerE --keep-symbol __new_handler --keep-symbol _ZTVSt9bad_alloc --keep-symbol _ZNSt9bad_allocD1Ev --keep-symbol _ZTISt9bad_alloc --keep-symbol _ZTVSt9type_info --keep-symbol _ZTVSt8bad_cast --keep-symbol _ZTVSt10bad_typeid --keep-symbol _ZTVN10__cxxabiv117__class_type_infoE --keep-symbol _ZTVN10__cxxabiv120__si_class_type_infoE --keep-symbol _ZTVN10__cxxabiv121__vmi_class_type_infoE --keep-symbol libc.so.6 --keep-symbol strcpy --keep-symbol printf --keep-symbol __strtod_internal --keep-symbol stdout --keep-symbol recv --keep-symbol connect --keep-symbol __register_frame --keep-symbol ungetc --keep-symbol __strtoull_internal --keep-symbol pthread_getspecific --keep-symbol strerror --keep-symbol fdopen --keep-symbol memmove --keep-symbol snprintf --keep-symbol __ctype_b --keep-symbol getenv --keep-symbol wcslen --keep-symbol __strtol_internal --keep-symbol fgets --keep-symbol __strtoll_internal --keep-symbol pthread_key_delete --keep-symbol getc --keep-symbol memcpy --keep-symbol setvbuf --keep-symbol execl --keep-symbol islower --keep-symbol feof --keep-symbol malloc --keep-symbol btowc --keep-symbol vsnprintf --keep-symbol __dso_handle --keep-symbol ispunct --keep-symbol socket --keep-symbol select --keep-symbol __frame_state_for --keep-symbol __strtoul_internal --keep-symbol isspace --keep-symbol fflush --keep-symbol __ctype_toupper --keep-symbol wmemcpy --keep-symbol send --keep-symbol abort --keep-symbol wcscoll --keep-symbol chmod --keep-symbol isxdigit --keep-symbol accept --keep-symbol __register_frame_table --keep-symbol rename --keep-symbol __strtold_internal --keep-symbol write --keep-symbol wmemchr --keep-symbol fprintf --keep-symbol strcat --keep-symbol bind --keep-symbol pthread_once --keep-symbol __deregister_frame_info --keep-symbol chdir --keep-symbol fseek --keep-symbol pthread_key_create --keep-symbol memchr --keep-symbol stdin --keep-symbol wait --keep-symbol signal --keep-symbol iswctype --keep-symbol strcoll --keep-symbol isupper --keep-symbol wcsrtombs --keep-symbol wmemset --keep-symbol strncpy --keep-symbol unlink --keep-symbol realloc --keep-symbol towupper --keep-symbol strtok --keep-symbol listen --keep-symbol fork --keep-symbol sscanf --keep-symbol isalpha --keep-symbol execlp --keep-symbol fread --keep-symbol strdup --keep-symbol gettimeofday --keep-symbol localtime --keep-symbol memset --keep-symbol ftell --keep-symbol strxfrm --keep-symbol mbsrtowcs --keep-symbol wctype --keep-symbol time --keep-symbol isgraph --keep-symbol isalnum --keep-symbol isprint --keep-symbol strcmp --keep-symbol pthread_mutex_unlock --keep-symbol gethostbyname --keep-symbol __deregister_frame --keep-symbol fgetc --keep-symbol sprintf --keep-symbol fclose --keep-symbol setlocale --keep-symbol stderr --keep-symbol getsockopt --keep-symbol strftime --keep-symbol wmemcmp --keep-symbol wmemmove --keep-symbol isdigit --keep-symbol fwrite --keep-symbol access --keep-symbol __xstat --keep-symbol __strtof_internal --keep-symbol pthread_mutex_lock --keep-symbol wcsftime --keep-symbol __errno_location --keep-symbol exit --keep-symbol towlower --keep-symbol fopen --keep-symbol iscntrl --keep-symbol fileno --keep-symbol _exit --keep-symbol wctob --keep-symbol __libc_start_main --keep-symbol strlen --keep-symbol wcsxfrm --keep-symbol strchr --keep-symbol fputs --keep-symbol fcntl --keep-symbol __register_frame_info_table --keep-symbol mkdir --keep-symbol __ctype_tolower --keep-symbol __register_frame_info --keep-symbol close --keep-symbol pthread_setspecific --keep-symbol free --keep-symbol _edata --keep-symbol __bss_start --keep-symbol _end --keep-symbol GLIBC_2.2 --keep-symbol GLIBC_2.1 --keep-symbol GLIBC_2.0 *.a

PS: those symbols are from the auto-updater
Aug 19, 2004 a1k0n link
Yeah, but when you statically link gtk, as I said, it tends to mess things up. I think gmodule loads in extra code, and then you start getting glibc version clashes and it makes a big mess.

Stripping the .a files is kind of a moot point, because you can just strip the final compiled binary of -all- symbols at the end.
Aug 20, 2004 AgY link
I prefer removing only the unused symbols.

But anyway the loki installer also uses gtk. I dont know if they link it static or dynamic, you might want to take a look :)

I never heared that anyone had problems using it, except those with a badly broken systems.

http://www.lokigames.com/development/setup.php3
Aug 21, 2004 Turmoyl link
libcurl is not present by default in Mandrake 10, even when the "Development" package group is selected during installation. However, "curl" is. Would that cover the dependencies?

If not, libcurl is easily grabbed via urpmi (Mandrake's package management tool).
Aug 21, 2004 Spider link
curl is not default on a Gentoo install, and will only happen to appear if either a user installs it manually, or some dependency has it.

Also, worth noting is that gtk+-1.2 is being phased out by most(all) distributions due to some pretty nasty bugs. (okay, its been in progress for years now, but right now, only few apps need it)

also, I have proof-of-concept code for dlopen() of gtk+-2.x here , ;)
Aug 22, 2004 a1k0n link
Ok. Then I'll definitely statically link libcurl, since I got it down pretty small. So far the new updater is smaller than the old one anyway. I'll consider upgrading to gtk+-2.x too.

I could dlopen() it, sure, but then I have to do the work of ld-linux and if I can't find the library, then what do I do? I guess it could always fall back to text mode. But I need the bugreporter to work. Blah.

Getting libcurl to interoperate with libgtk (without forking a thread or anything) is a huge pain in the ass, but doable.
Aug 23, 2004 roguelazer link
gtk2 would be nice. I only have 2 or 3 gtk1 apps, and if I reinstall gentoo (which I might because I got a little... overenthusastic with emerge), I probably won't install any of them.
Aug 24, 2004 AgY link
I have some more gtk1 apps. But i dont have gtk2. This is just because i dont have any apps using gtk2 :)
Aug 24, 2004 Icarus link
I don't have libcurl (nothing I have needs it, so far). I have GTK1 and GTK2, and I actually prefer GTK1 apps. I had all manner of problems building GTK2 (actually the problems were with its support libs, pango, etc..) and everything seems slower than GTK1.

I'd rather have a statically linked updater anyway... Lets face it.. anyone who's gonna download over 80Mb+ for Vendetta isn't going to worry too much about a couple of extra Mb for the updater (if it really is that big!).