Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

Mac build fails #5

Closed
poussa opened this issue Jun 4, 2015 · 0 comments
Closed

Mac build fails #5

poussa opened this issue Jun 4, 2015 · 0 comments

Comments

@poussa
Copy link

poussa commented Jun 4, 2015

node-gyp rebuild on Mac because 1) the pkg-config commands are not honored. Instead, one needs to use a "xcode_settings" variable and 2) the .so library is not build only the individual .a files. The below hack fixes the issues.

The proper fix is to create OSX dylib file with the content matching the Linux .so file. That is IoTivity issue.

diff --git a/binding.gyp b/binding.gyp
index 099a98c..e543a98 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -3,8 +3,11 @@
                "include_dirs": [
                        "<!(node -e \"require('nan')\")"
                ],
-               "libraries": [ '<!(pkg-config --libs octbstack)' ],
-               "cflags": [ '<!(pkg-config --cflags octbstack)' ]
+               "libraries": [ '<!@(pkg-config --libs octbstack)' ],
+               "cflags": [ '<!(pkg-config --cflags octbstack)' ],
+               "xcode_settings": {
+                       "OTHER_CFLAGS": ['<!(pkg-config --cflags octbstack)']
+               }
        },
        "targets": [
                {
@@ -36,28 +39,52 @@
                        "type": "executable",
                        "sources": [ "c/client.c" ],
                        "libraries": [ '<!(pkg-config --libs glib-2.0)' ],
-                       "cflags": [ '<!(pkg-config --cflags glib-2.0)' ]
+                       "cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
+                       "xcode_settings": {
+                               "OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
+                               "OTHER_LDFLAGS": [
+                                       '-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
+                               ]
+                       }
                },
                {
                        "target_name": "client.observe",
                        "type": "executable",
                        "sources": [ "c/client.observe.c" ],
                        "libraries": [ '<!(pkg-config --libs glib-2.0)' ],
-                       "cflags": [ '<!(pkg-config --cflags glib-2.0)' ]
+                       "cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
+                       "xcode_settings": {
+                               "OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
+                               "OTHER_LDFLAGS": [
+                                       '-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
+                               ]
+                       }
                },
                {
                        "target_name": "server",
                        "type": "executable",
                        "sources": [ "c/server.c" ],
                        "libraries": [ '<!(pkg-config --libs glib-2.0)' ],
-                       "cflags": [ '<!(pkg-config --cflags glib-2.0)' ]
+                       "cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
+                       "xcode_settings": {
+                               "OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
+                               "OTHER_LDFLAGS": [
+                                       '-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
+                               ]
+                       }
                },
                {
                        "target_name": "server.observable",
                        "type": "executable",
                        "sources": [ "c/server.observable.c" ],
                        "libraries": [ '<!(pkg-config --libs glib-2.0)' ],
-                       "cflags": [ '<!(pkg-config --cflags glib-2.0)' ]
+                       "cflags": [ '<!(pkg-config --cflags glib-2.0)' ],
+                       "xcode_settings": {
+                               "OTHER_CFLAGS": ['<!(pkg-config --cflags glib-2.0)'],
+                               "OTHER_LDFLAGS": [
+                                       '-loctbstack', '-lconnectivity_abstraction', '-lc_common', '-lcoap'
+                               ]
+                       }
                }
        ]
 }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant