Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Linking with --as-needed fails #4

Closed
xmw opened this Issue Aug 9, 2011 · 0 comments

Comments

Projects
None yet
2 participants

xmw commented Aug 9, 2011

Please fix the gcc linker invokation in Makefile, place $(LIBS) behind -o $@, otherwise linking with -Wl,--as-needed (which is used on most distros nowadays) fails.

Error:
x86_64-pc-linux-gnu-gcc -Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgdk_pixbuf_xlib-2.0 -lgdk_pixbuf-2.0 -lm -lgobject-2.0 -lgmodule-2.0 -lpng14 -lgthread-2.0 -lrt -lglib-2.0 -lX11 -L/usr/X11R6/lib -lXmu panel.o misc.o bg.o eggtraymanager.o eggmarshalers.o fixedtip.o main.o gdk-helper.o -o trayer-srg
panel.o: In function handle_error': /var/tmp/portage/x11-misc/trayer-srg-1.1.2/work/trayer-srg-1.1.2/panel.c:409: undefined reference toXGetErrorText'
panel.o: In function panel_set_wm_strut': /var/tmp/portage/x11-misc/trayer-srg-1.1.2/work/trayer-srg-1.1.2/panel.c:66: undefined reference togtk_object_get_type'
/var/tmp/portage/x11-misc/trayer-srg-1.1.2/work/trayer-srg-1.1.2/panel.c:66: undefined reference to g_type_check_instance_cast' /var/tmp/portage/x11-misc/trayer-srg-1.1.2/work/trayer-srg-1.1.2/panel.c:99: undefined reference toXChangeProperty'
/var/tmp/portage/x11-misc/trayer-srg-1.1.2/work/trayer-srg-1.1.2/panel.c:102: undefined reference to XChangeProperty' panel.o: In functionpanel_size_alloc':
/var/tmp/portage/x11-misc/trayer-srg-1.1.2/work/trayer-srg-1.1.2/panel.c:189: undefined reference to gtk_window_get_type' /var/tmp/portage/x11-misc/trayer-srg-1.1.2/work/trayer-srg-1.1.2/panel.c:189: undefined reference tog_type_check_instance_cast'
/var/tmp/portage/x11-misc/trayer-srg-1.1.2/work/trayer-srg-1.1.2/panel.c:189: undefined reference to gtk_window_move' panel.o: In functionpanel_destroy_event':
/var/tmp/portage/x11-misc/trayer-srg-1.1.2/work/trayer-srg-1.1.2/panel.c:150: undefined reference to `gtk_main_quit'
(a ton of similar "undefined reference"s)

Fix

http://git.overlays.gentoo.org/gitweb/?p=dev/xmw.git;a=blob;f=x11-misc/trayer-srg/files/trayer-srg-1.1.2-as-needed.patch;h=851b21f0eabecf83e3c87deeb3eab06c0e0755bd;hb=99bce18f66447dd744e3842af278c9d7b7a5dc39

--- trayer-srg-1.1.2/Makefile
+++ trayer-srg-1.1.2/Makefile
@@ -19,7 +19,7 @@

TARGET = trayer
$(TARGET): $(OBJ)

  • $(CC) $(LDFLAGS) $(LIBS) $(OBJ) -o $@
  • $(CC) $(LDFLAGS) $(OBJ) -o $@ $(LIBS)
    ifeq (,$(DEVEL))
    strip $@
    endif

Arch linux ( http://aur.archlinux.org/packages.php?ID=36049 ) clears the LDFLAGs, which is just wrong, imho.

@ghost ghost assigned sargon Aug 9, 2011

@sargon sargon closed this Aug 9, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment