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

Error on Mac OSX El Capitan #8

Closed
RaviWoods opened this issue Apr 25, 2017 · 7 comments
Closed

Error on Mac OSX El Capitan #8

RaviWoods opened this issue Apr 25, 2017 · 7 comments

Comments

@RaviWoods
Copy link

Tried to run this on Mac OSX El Capitan (10.11.5), and this error was thrown:

readline.js:73


    terminal = !!output.isTTY;
    
                       ^
                       
TypeError: Cannot read property 'isTTY' of undefined

    at new Interface (readline.js:73:24)
    
    at Object.exports.createInterface (readline.js:39:10)
    
    at clear_pp_portion (/Users/raviwoods/Google_Drive/ICComp/Uni_Year_3/Project/cpp-analysis-for-education/Implementation/project/node_modules/node-c-parser/node_modules/node-c-lexer/lib/cpp-unit.js:40:47)
    
    at /Users/raviwoods/Google_Drive/ICComp/Uni_Year_3/Project/cpp-analysis-for-education/Implementation/project/node_modules/node-c-parser/node_modules/node-c-lexer/lib/cpp-unit.js:23:17
    
    at ChildProcess.exithandler (child_process.js:646:7)
    
    at ChildProcess.emit (events.js:98:17)
    
    at maybeClose (child_process.js:756:16)
    
    at Socket.<anonymous> (child_process.js:969:11)
    
    at Socket.emit (events.js:95:17)
    
    at Pipe.close (net.js:465:12

This used the following JS code:

var parser = require("node-c-parser");

parser.lexer.cppUnit.clearPreprocessors("./return.c", function(err, codeText){
    if(err){
        console.log(err);
    }
    else{
        var tokens = parser.lexer.lexUnit.tokenize(codeText);
        var parse_tree = parser.parse(tokens);
        console.log(parse_tree);
    }
});

And the following C code

int main() {
    return 0;
}
@taufique71
Copy link
Owner

@RaviWoods, Hi. Sorry for this late reply after one and a half years. I don't have any MacOS. So can't try to reproduce the issue in my end. Can you please verify it from your side whether this is a legitimate issue to look at and submit a pull request if any fix is needed?

@lemire
Copy link

lemire commented Jul 25, 2018

I cannot reproduce on macOS High Sierra.

@taufique71
Copy link
Owner

@lemire Do you think the issue should be closed then?

@lemire
Copy link

lemire commented Jul 26, 2018

What I get is this...

> var parser = require("node-c-parser");
undefined
>
> parser.lexer.cppUnit.clearPreprocessors("test.c", function(err, codeText){
...     if(err){
.....         console.log(err);
.....     }
...     else{
.....         var tokens = parser.lexer.lexUnit.tokenize(codeText);
.....         var parse_tree = parser.parse(tokens);
.....         console.log(parse_tree);
.....     }
... });
> { Error: Command failed: cpp test.c e32a1c00-90dd-11e8-a623-25727904756c
In file included from test.c:1:
In file included from /usr/include/stdio.h:64:
In file included from /usr/include/_stdio.h:69:
In file included from /usr/include/Availability.h:206:
/usr/include/AvailabilityInternal.h:33319:2: error: #else after #else
#else
 ^
/usr/include/AvailabilityInternal.h:32675:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12_4
         ^
/usr/include/AvailabilityInternal.h:32592:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12_2
         ^
/usr/include/AvailabilityInternal.h:32513:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12_1
         ^
/usr/include/AvailabilityInternal.h:32438:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12
         ^
/usr/include/AvailabilityInternal.h:32367:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_4
         ^
/usr/include/AvailabilityInternal.h:32300:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_3
         ^
/usr/include/AvailabilityInternal.h:32237:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_2
         ^
/usr/include/AvailabilityInternal.h:32178:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11
         ^
/usr/include/AvailabilityInternal.h:32123:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10_3
         ^
/usr/include/AvailabilityInternal.h:32072:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10_2
         ^
/usr/include/AvailabilityInternal.h:32025:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10
         ^
/usr/include/AvailabilityInternal.h:31982:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9
         ^
/usr/include/AvailabilityInternal.h:31943:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8
         ^
/usr/include/AvailabilityInternal.h:31908:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_7
         ^
/usr/include/AvailabilityInternal.h:31877:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6
         ^
/usr/include/AvailabilityInternal.h:31850:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_5
         ^
/usr/include/AvailabilityInternal.h:31827:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_4
         ^
/usr/include/AvailabilityInternal.h:31808:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_3
         ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

    at ChildProcess.exithandler (child_process.js:291:12)
    at ChildProcess.emit (events.js:182:13)
    at ChildProcess.EventEmitter.emit (domain.js:460:23)
    at maybeClose (internal/child_process.js:961:16)
    at Socket.stream.socket.on (internal/child_process.js:380:11)
    at Socket.emit (events.js:182:13)
    at Socket.EventEmitter.emit (domain.js:460:23)
    at Pipe._handle.close [as _onclose] (net.js:595:12)
  killed: false,
  code: 1,
  signal: null,
  cmd: 'cpp test.c e32a1c00-90dd-11e8-a623-25727904756c' }

@taufique71
Copy link
Owner

This library uses node-c-lexer as dependency. node-c-lexer has a dependency on cpp command for pre-processor expansion. Can you confirm cpp is available on your machine?

@lemire
Copy link

lemire commented Jul 27, 2018

I do:

 $ cpp --version
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@taufique71
Copy link
Owner

@lemire , I guess then there is some issue with MacOS. But the issue is with node-c-lexer library which is a dependency of this project. So reporting it there would be more appropriate. I will request you to create an issue there. I could have created an issue there but as I didn't face the issue from my side I thought more appropriate person would be the one who found it. And I am closing this issue for now.

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