Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to compile on Linux (Ubuntu 14.04) #32

Closed
thibaudh opened this issue Jan 29, 2015 · 5 comments
Closed

Fail to compile on Linux (Ubuntu 14.04) #32

thibaudh opened this issue Jan 29, 2015 · 5 comments

Comments

@thibaudh
Copy link

Setup:

  • Linux XXX 3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux.
  • gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2

There are two issues:

make: Entering directory `/home/tbh/test/node-webcl/build'
  CXX(target) Release/obj.target/webcl/src/bindings.o
In file included from /usr/include/X11/Xlib.h:44:0,
                 from /usr/include/GL/glx.h:30,
                 from ../src/common.h:74,
                 from ../src/webcl.h:30,
                 from ../src/bindings.cc:27:
../src/common.h:153:3: error: expected identifier before numeric constant
   None=0,
../src/webcl.cc: In function ‘webcl::WebCLObject* webcl::findCLObj(void*, webcl::CLObjType::CLObjType)’:
../src/webcl.cc:58:20: error: ‘nullptr’ was not declared in this scope
   if(!clid) return nullptr;
@thibaudh
Copy link
Author

Fixed by renaming None to clObjNone and passing --std=c++11 to gcc.
Here is my patch:

diff --git a/binding.gyp b/binding.gyp
index baf7989..8b6fcd0 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -38,7 +38,10 @@
           },
           'libraries': ['-framework OpenGL', '-framework OpenCL']
         }],
-        ['OS=="linux"', {'libraries': ['-lGL', '-lOpenCL']}],
+        ['OS=="linux"', {
+            'libraries': ['-lGL', '-lOpenCL'],
+            'cflags': ['-std=c++11']
+        }],
         ['OS=="win"', {
           'variables' :
             {
diff --git a/src/common.h b/src/common.h
index 6116d9a..7040154 100644
--- a/src/common.h
+++ b/src/common.h
@@ -150,7 +150,7 @@ struct Baton {

 namespace CLObjType {
 enum CLObjType {
-  None=0,
+  clObjNone=0,
   Platform,
   Device,
   Context,
@@ -193,7 +193,7 @@ public:
   }

 protected:
-  WebCLObject() : _type(CLObjType::None)
+  WebCLObject() : _type(CLObjType::clObjNone)
   {}

@mikeseven
Copy link
Owner

I haven¹t tested on Linux but the compiler error seems to be a C++ error.
Make sure you use g++ 4.8 or 4.9. I doubt you need to compile for C++11
(--std=c++11) but try just in case.

-- Mike

From: Thibaud [email protected]
Reply-To: mikeseven/node-webgl
<reply+000c582c32726ebd82b7532ae4f6bc9dd1e4159081306f4092cf0000000110e27ee79
[email protected]>
Date: Thursday, January 29, 2015 at 3:06 PM
To: mikeseven/node-webgl [email protected]
Subject: [node-webgl] Fail to compile on Linux (Ubuntu 14.04) (#32)

Setup:

  • Linux XXX 3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014
    x86_64 x86_64 x86_64 GNU/Linux.
  • gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
    There are two issues:
    make: Entering directory `/home/tbh/test/node-webcl/build'
    CXX(target) Release/obj.target/webcl/src/bindings.o
    In file included from /usr/include/X11/Xlib.h:44:0,
    from /usr/include/GL/glx.h:30,
    from ../src/common.h:74,
    from ../src/webcl.h:30,
    from ../src/bindings.cc:27:
    ../src/common.h:153:3: error: expected identifier before numeric constant
    None=0,
    ../src/webcl.cc: In function Œwebcl::WebCLObject* webcl::findCLObj(void*,
    webcl::CLObjType::CLObjType)¹:
    ../src/webcl.cc:58:20: error: Œnullptr¹ was not declared in this scope
    if(!clid) return nullptr;

    Reply to this email directly or view it on GitHub
    Fail to compile on Linux (Ubuntu 14.04) #32 .

@mikeseven
Copy link
Owner

Ah here you go.

Thanks!

-- Mike

From: Thibaud [email protected]
Reply-To: mikeseven/node-webgl
<reply+000c582c308a699aa6d57abbce5981cdec569dfdfa8e21fc92cf0000000110e27f539
[email protected]>
Date: Thursday, January 29, 2015 at 3:08 PM
To: mikeseven/node-webgl [email protected]
Subject: Re: [node-webgl] Fail to compile on Linux (Ubuntu 14.04) (#32)

Fixed by renaming None to clObjNone and passing --std=c++11 to gcc.
Here is my patch:

diff --git a/binding.gyp b/binding.gyp
index baf7989..8b6fcd0 100644
--- a/binding.gyp+++ b/binding.gyp@@ -38,7 +38,10 @@
},
'libraries': ['-framework OpenGL', '-framework OpenCL']
}],

  •    ['OS=="linux"', {'libraries': ['-lGL', '-lOpenCL']}],+
    

    ['OS=="linux"', {+ 'libraries': ['-lGL', '-lOpenCL'],+
    'cflags': ['-std=c++11']+ }],
    ['OS=="win"', {
    'variables' :
    {
    diff --git a/src/common.h b/src/common.h
    index 6116d9a..7040154 100644
    --- a/src/common.h+++ b/src/common.h@@ -150,7 +150,7 @@ struct Baton {

    namespace CLObjType {
    enum CLObjType {

  • None=0,+ clObjNone=0,
    Platform,
    Device,
    Context,
    @@ -193,7 +193,7 @@ public:
    }

protected:

@thibaudh
Copy link
Author

Actually, this is a node-webCL bug, and not node-webgl. I cliked on the wrong repo when filling the bug report.

@mweitzel
Copy link

@mikeseven @thibaudh so this can be closed, yes?

jingchan pushed a commit to jingchan/headless-gl that referenced this issue Feb 6, 2017
add libxi-dev to linux dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants