--To view this discussion on the web visit https://groups.google.com/d/msg/libxbee/-/H55RGoq52-kJ.
You received this message because you are subscribed to the Google Groups "libxbee" group.
To post to this group, send email to lib...@googlegroups.com.
To unsubscribe from this group, send email to libxbee+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/libxbee?hl=en.
#ifdef __MACH__
struct timespec to;
current_utc_time(&to);
while (sem_trywait(&con->callbackSem) != 0) {
if (sem_trywait(&con->callbackSem) == EINVAL) {
ret = XBEE_ESEMAPHORE; // semaphone is invalid
}
sleep(1);
current_utc_time(&to);
if (to.tv_sec > timeout->tv_sec && to.tv_nsec > timeout->tv_nsec) { // timeout break local while
ret = XBEE_ETIMEOUT;
break;
}
}
#else
if (xsys_sem_timedwait(&frame->sem, timeout)) {
if (errno == ETIMEDOUT) {
ret = XBEE_ETIMEOUT;
} else {
ret = XBEE_ESEMAPHORE;
}
}
#endif
Then, actually the code should compile however, as noted before the -fvisibility=hidden somehow makes os x lose symbols during linking.
I added a os.darwin.mk file (a copy from os.unix.mk) where I commented that line out.
I also changed there build and install rules to use a *.darwin.mk which are again copies from the *.unix.mk just with all occuranes of .so replaced by .dylib
In the build.darwin.mk (cat make/build.unix.mk | sed -e 's/\.so/\.dylib/g' > make/build.darwin.mk) I commented out the OBJCOPY lines as OS X does not have OBJCOPY (one can possibly simulate that behavior with dsymutil, strip, nm), furthermore I changed the -soname to -install_name.
To make it use this I also added to make/os_detect.mk:
ifeq ($(shell uname),Linux)
include make/os.linux.mk
# detect freebsd
else ifeq ($(shell uname),FreeBSD)
include make/os.freebsd.mk
# detect windows
else ifeq ($(OS),Windows_NT)
include make/os.windows.mk
# detect os x (darwin)
else ifeq ($(shell uname),Darwin)
include make/os.darwin.mk
This then builds successfully the C part, however the C++ makes problems, it seems to be unable to automatically find all required dependencies which have already been compiled, this might be due to the missing -fvisibility=hidden, I don't know, I was able to get it compile by manually giving all dependent objects to ld:
$(DESTDIR)/$(LIBNAME)p.o: .$(DESTDIR).dir $(BUILDDIR)/__corep.o $(BUILDDIR)/conn.o $(BUILDDIR)/ll.o $(BUILDDIR)/log.o $(BUILDDIR)/thread.o $(BUILDDIR)/ostime.o $(BUILDDIR)/frame.o $(BUILDDIR)/mode.o $(BUILDDIR)/mutex.o $(BUILDDIR)/pkt.o $(BUILDDIR)/tx.o $(BUILDDIR)/rx.o $(BUILDDIR)/xbee.o $(BUILDDIR)/error.o $(BUILDDIR)/__mode.o $(BUILDDIR)/__mode_debug.o $(BUILDDIR)/__mode_net.o $(BUILDDIR)/__mode_xbee1.o $(BUILDDIR)/__mode_xbee2.o $(BUILDDIR)/__mode_xbee5.o $(BUILDDIR)/__mode_xbeeZB.o $(BUILDDIR)/ver.o $(BUILDDIR)/net_io.o $(BUILDDIR)/net_handlers.o $(BUILDDIR)/net_callbacks.o $(BUILDDIR)/net.o $(BUILDDIR)/xsys.o
$(LD) -r -o $@ $(filter %.o,$^)
This then compiles :) (*note the ostime.o is generated by the own implementation of the time function)
This is far from beautiful, but it works.
To unsubscribe from this group and stop receiving emails from it, send an email to libxbee+u...@googlegroups.com.
To post to this group, send an email to lib...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msg/libxbee/-/r9L8IsrqdTIJ.
For more options, visit https://groups.google.com/groups/opt_out.
#ifdef __MACH__
#define MSG_NOSIGNAL SO_NOSIGPIPE
#endif
to net_io.c as MSG_NOSIGNAL is not available on os x, however SO_NOSIGPIPE has similar behavior on os x.
Attached you find a patch which adds what I just described, however I haven't tested anything, I started looking at the project some hours ago.
I create the patch against the following commit: git diff ef897911c54c0d1dfb9454bdffbf10d1bc7fcf70 > os_x.patch
However, as I haven't tested anything (I don't have the xbee1 I have with me right now) I would mark the os x compatability still as broken, mostly because of the workaround to semaphore wait timeout which isn't available on os x...
Have a nice day
Jan
To view this discussion on the web, visit https://groups.google.com/d/msg/libxbee/-/s-cFDm1qkDcJ.
To view this discussion on the web, visit https://groups.google.com/d/msg/libxbee/-/ImZ-SmvpxE4J.
To view this discussion on the web, visit https://groups.google.com/d/msg/libxbee/-/8yITRXDuMBsJ.