[Tile-serving] [mod_tile] OS X Support (#68)

Dane Springmeyer notifications at github.com
Wed Feb 12 00:07:26 UTC 2014


mod_tile used to compile on OS X but recent versions have numerous blocking issues.

Here is a rundown:

#### compile error in `store.h`:

```
In file included from src/store_null.c:1:
In file included from ./includes/store_null.h:8:
./includes/store.h:18:9: error: unknown type name 'off_t'
        off_t     size;    /* total size, in bytes */
        ^
./includes/store.h:19:9: error: unknown type name 'time_t'; did you mean 'size_t'?
        time_t    atime;   /* time of last access */
        ^~~~~~
        size_t
```

Fixable with:

```diff
index 7c3e453..f98575d 100644
--- a/includes/store.h
+++ b/includes/store.h
@@ -6,6 +6,7 @@ extern "C" {
 #endif
 
 #include <stdlib.h>
+#include <sys/types.h>
 #include "render_config.h"
 
 #define STORE_LOGLVL_DEBUG 0
```

#### compile error in src/gen_tile_test.cpp

```
src/gen_tile_test.cpp:112:19: error: use of undeclared identifier 'CLOCK_THREAD_CPUTIME_ID'
    clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time);
                  ^
```

Fixable with:

```diff
diff --git a/src/gen_tile_test.cpp b/src/gen_tile_test.cpp
index 19ff90d..20ca36d 100644
--- a/src/gen_tile_test.cpp
+++ b/src/gen_tile_test.cpp
@@ -42,6 +42,10 @@
 #include <sys/types.h>
 #include <sys/syscall.h>
 #include <stdlib.h>
+#ifdef __MACH__
+#include <mach/clock.h>
+#include <mach/mach.h>
+#endif
 
 #include <mapnik/version.hpp>
 #if MAPNIK_VERSION < 200000
@@ -96,7 +100,17 @@ void *addition_thread(void * arg) {
     enum protoCmd res;
     struct timespec time;
     unsigned int seed = syscall(SYS_gettid);
+    #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
+    clock_serv_t cclock;
+    mach_timespec_t mts;
+    host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
+    clock_get_time(cclock, &mts);
+    mach_port_deallocate(mach_task_self(), cclock);
+    time.tv_sec = mts.tv_sec;
+    time.tv_nsec = mts.tv_nsec;
+    #else
     clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time);
+    #endif
     seed *= (unsigned int)time.tv_nsec;
     pthread_t tid = pthread_self();
 
```

#### compile error in src/gen_tile_test.cpp

```
src/gen_tile_test.cpp:119:18: error: assigning to 'int' from incompatible type 'pthread_t' (aka '_opaque_pthread_t *')
        item->my = tid;
                 ^ ~~~
```

Fixable with:

```diff
-        item->my = tid;
+        item->my = rand_r(&seed);
```

#### libtool sdk issue

```
apxs -c   -I./includes    -lcurl  ./src/mod_tile.c  ./src/sys_utils.c ./src/store.c ./src/store_file.c ./src/store_file_utils.c ./src/store_memcached.c ./src/store_rados.c ./src/store_ro_http_proxy.c ./src/store_ro_composite.c ./src/store_null.c
/usr/share/apr-1/build-1/libtool --silent --mode=compile /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc    -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/local/include -I/usr/include/apache2  -I/usr/include/apr-1   -I/usr/include/apr-1  -I./includes  -c -o ./src/mod_tile.lo ./src/mod_tile.c && touch ./src/mod_tile.slo
env: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc: No such file or directory
apxs:Error: Command failed with rc=65536
````

This can be worked around by doing:

```
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain
```

#### libtool --tag issue

```
/usr/share/apr-1/build-1/libtool --silent --mode=compile /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc    -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/local/include -I/usr/include/apache2  -I/usr/include/apr-1   -I/usr/include/apr-1  -I./includes  -c -o ./src/mod_tile.lo ./src/mod_tile.c && touch ./src/mod_tile.slo
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
apxs:Error: Command failed with rc=65536
```

I don't know about to workaround this. Passing `--tag=CC` fixes the problem, but its unclear to me how to pass it to libtool

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/mod_tile/issues/68
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20140211/cc699901/attachment-0001.html>


More information about the Tile-serving mailing list