Reputation: 102205
I'm been working on this issue for some time now, and I hope someone can point out what I'm missing.
$ make clean && make libvpnpp.a
c++ -arch x86_64 -arch i386 -I. -I/usr/local/include/ -c VpnInit.cpp
libtool -static -o libvpnpp.a VpnInit.o
libvpnpp.a
make: libvpnpp.a: No such file or directory
make: *** [libvpnpp.a] Error 1
However, when I perform an ls
, the library is there:
$ ls *.a
libvpnpp.a
And it is multiarch:
$ lipo -info libvpnpp.a
Architectures in the fat file: libvpnpp.a are: x86_64 i386
Here are the makefile rules and recipes that are relevant:
IS_DARWIN = $(shell uname -s | $(EGREP) -i -c "Darwin")
ifeq ($(IS_DARWIN),1)
CXXFLAGS += -arch x86_64 -arch i386
AR = libtool
ARFLAGS = -static -o
endif
...
libvpnpp.a: $(VPNPP_LIB_OBJS)
$(AR) $(ARFLAGS) $@ $(VPNPP_LIB_OBJS)
$(RANLIB) $@
...
%.o : %.cpp
$(CXX) $(CXXFLAGS) -I$(VPNPP_INCL) -I$(CRYPTOPP_INCL) -c $<
Why does make
fail with No such file or directory
even though the library is created and exists?
Here's the tail from make -d
:
...
c++ -arch x86_64 -arch i386 -I. -I/usr/local/include/ -c VpnInit.cpp
Putting child 0x7fe669c0ff10 (VpnInit.o) PID 59119 on the chain.
Live child 0x7fe669c0ff10 (VpnInit.o) PID 59119
Reaping winning child 0x7fe669c0ff10 PID 59119
Removing child 0x7fe669c0ff10 PID 59119 from chain.
Successfully remade target file `VpnInit.o'.
Finished prerequisites of target file `libvpnpp.a'.
Must remake target `libvpnpp.a'.
libtool -static -o libvpnpp.a VpnInit.o
Putting child 0x7fe669c111d0 (libvpnpp.a) PID 59127 on the chain.
Live child 0x7fe669c111d0 (libvpnpp.a) PID 59127
Reaping winning child 0x7fe669c111d0 PID 59127
libvpnpp.a
make: libvpnpp.a: No such file or directory
Live child 0x7fe669c111d0 (libvpnpp.a) PID 59138
Reaping losing child 0x7fe669c111d0 PID 59138
make: *** [libvpnpp.a] Error 1
Removing child 0x7fe669c111d0 PID 59138 from chain.
$
Upvotes: 1
Views: 925
Reputation: 72609
This looks like $(RANLIB)
is empty and then the line $(RANLIB) $@
resolves to just libvpnpp.a
. As the first word on a line, the shell wants to execute a program named libvpnpp.a
which it doesn't find (probably because .
is not in PATH
).
Try setting RANLIB=:
in the makefile or as a make variable. Or investigate why RANLIB
isn't set properly.
Upvotes: 1