In the process of porting an app from linux to osx.
(Thanks to Apple loaning some hardware)
On linux we are using shared libraries, some of which
are dependent on other shared libraries.
So we are using dylibs.
All the code( main application and other libraries) except the two dependent
dynamic
libraries builds without error.
The main app is a commandline image processing executable.
makefiles below.
Think they were originally generated by eclipse.
The problem is the linker can not find the dependent dylib,
where as on linux it finds it no problem.
The dependednt library is in ../../fusion/lib directory, relative to the
directory the
makefile is in.
Have the same directory structure,exactly the same files
just the makefiles differ slightly.
Most likely something really simple and stupid.
Been stuck on this for a while.
One other question is , how to automatically start this terminal app
at startup and automatically restart it, if it terminates for any reason ?
On linux I use inittab for this.
All help greatly appreciated
Thank you
Alex Gibson
This is the linux makefile
__________________________________________________________
ROOT := ..
-include $(ROOT)/makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include $(SUBDIRS:%=%/subdir.mk)
-include objects.mk
ifneq ($(strip $(DEPS)),)
-include $(DEPS)
endif
-include $(ROOT)/makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: liblpr.so
# Tool invocations
liblpr.so: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C Linker'
@echo gcc -nostartfiles -L../../fusion/lib `pkg-config --libs
opencv` -shared -oliblpr.so $(OBJS) $(USER_OBJS) $(LIBS)
@gcc -nostartfiles -L../../fusion/lib `pkg-config --libs
opencv` -shared -oliblpr.so $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(DEPS)$(OBJS)$(LIBRARIES) liblpr.so
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include $(ROOT)/makefile.targets
___________________________________________________________________
This is the mac makefile, that won't work
ROOT := ..
-include $(ROOT)/makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include $(SUBDIRS:%=%/subdir.mk)
-include objects.mk
ifneq ($(strip $(DEPS)),)
-include $(DEPS)
endif
-include $(ROOT)/makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: liblpr.dylib
# Tool invocations
liblpr.dylib: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C Linker'
@echo gcc -nostartfiles -L../../fusion/lib `pkg-config --libs
opencv` -dynamiclib -install_name liblpr.dylib -o liblpr.dylib $(OBJS)
$(USER_OBJS) $(LIBS)
@gcc -nostartfiles -L../../fusion/lib `pkg-config --libs
opencv` -dynamiclib -install_name liblpr.dylib -o liblpr.dylib $(OBJS)
$(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(DEPS)$(OBJS)$(LIBRARIES) liblpr.dylib
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include $(ROOT)/makefile.targets
Alex Gibson - 30 Dec 2006 05:24 GMT
> In the process of porting an app from linux to osx.
> (Thanks to Apple loaning some hardware)
[quoted text clipped - 17 lines]
> directory the
> makefile is in.
The actual errors I'm getting are
/usr/bin/libtool : can't locate file for -lfusion
/usr/bin/libtool : file -lfusion is not an object file(not allowed in a
library)
make: *** [liblpr.dylib] Error 1
So
1. It can't find the file for libfusion
2. It finds the file but as its not an object file it can't link it in ?
How to work around this ?
Want to keep the linux and OSX projects identical except for the makefiles
so as to make things as easy as possible for using and maintaining the
project.
My aim once I have the makefiles working is to start using configure so the
guys working on this
don't need to know/worry about platform issuses like .dylib / .so.
Very glad we switched to linux and OS X from windows.
Alex