gnustep / apps-gworkspace

GWorkspace is GNUstep's Workspace Manager and offers a File Manager and an optional Desktop with associated services and tools.
http://www.gnustep.org
GNU General Public License v2.0
29 stars 14 forks source link

DBKit linking against installed instead of local copy.... #5

Closed gcasa closed 4 years ago

gcasa commented 4 years ago

Steps:

1) build GWorkspace and install after installing GNUstep 2) make ABI incompatible change 3) rebuild GWorkspace (without doing make uninstall)

Result: you will get an error building fswatcher, since it links with the installed DBKit. Expected: fswatcher should build and link against the built DBKit in the build dir, not the system installed version.

gcasa commented 4 years ago

I've added you here, Richard, it seems this might be an issue with gnustep-make. Riccardo is going to add some additional details.

rmottola commented 4 years ago

I think this is a gnustep-make issue. fswatcher's preable just adds this: ADDITIONAL_TOOL_LIBS += -L../../DBKit/$(GNUSTEP_OBJ_DIR)

However, the actual link line is: ./obj/fswatcher.obj/fswatcher.m.o \ -L/home/multix/GNUstep/Library/Libraries -L/Local/Library/Libraries -L/System/Library/Libraries -L../../DBKit/./obj -lDBKit -lgnustep-base -lobjc -lm

Which shows that installed libraries in all domains are prepended and thus will be given prriority.

rfm commented 4 years ago

Looks like a GWorkspace bug. It appears to be using ADDITIONAL_TOOL_LIBS (which is the variable to specify additional libraries for tools) when it really wants to be using ADDITIONAL_LIB_DIRS (the variable to specify the additional directories that libraries are to be found in).

If you look in rules.make you can see the order of precedence of library directories.

ALL_LIB_DIRS = $(ADDITIONAL_FRAMEWORK_DIRS) $(AUXILIARY_FRAMEWORK_DIRS) \ $(ADDITIONAL_LIB_DIRS) $(AUXILIARY_LIB_DIRS) \ $(GNUSTEP_LIBRARIES_FLAGS) \ $(GNUSTEP_FRAMEWORKS_FLAGS) \ $(SYSTEM_LIB_DIR)

rmottola commented 4 years ago

Thank you @rfm . But is a "daemon" not a tool? Just to understand when ADDITIONAL_TOOL_LIBS is of use.

rfm commented 4 years ago

ADDITIONAL_TOOL_LIBS is for specifying the libraries to link your tool with. You should to use it when you want to link libraries into your tool. In terms of flags, it's for the -l compiler options (lowercase 'l').

ADDITIONAL_LIB_DIRS is for specifying directories the system is to look in for libraries. You should use it when you want the linker to look for libraries in particular directories. In terms of flags, it's for the -L compiler option (uppercase 'L').

GWorkspace is simply using the wrong variable.

rfm commented 4 years ago

I realise I'm more or less repeating what the documentation says, but I'm not sure how to make it clearer. Maybe a more concrete example. -lobjc -lm means link with the 'objc' library and the standard maths library -L/home/mylibs -L/group/lib mean to look for the libraries in '/home/mylibs' before '/group/lib'

rmottola commented 4 years ago

"Repetita juvant" said the latins... now with your example it is clearer to me, the "TOOL_LIBs" is confusing me..... but clear. It is a bug in GWorkspace, I'll fix it and see if it helps Gregory.

rmottola commented 4 years ago

Fixed. @gcasa , please try

gcasa commented 4 years ago

This works now. Closing