gcc include /usr/include/algorithm

Issue #24 resolved
Aaron Bartell created an issue

I am starting to dig deeper into gcc compiles using ibmichroot. My current en devour is compiling node-inspector. I eventually hope to combine the steps I take into a xxxx.lst file (probably the gcc one).

To compile Node.js modules the following are needed:

  • Python 2.7 (perzl)
  • gcc (perzl)

The compile goes fine until I get to other includes, like algorithm.

$ npm install node-inspector

> v8-profiler@5.3.2 preinstall /home/USRAB3L5/nodejs_sqlite3/node_modules/node-inspector/node_modules/v8-profiler
>  


> v8-debug@0.5.4 preinstall /home/USRAB3L5/nodejs_sqlite3/node_modules/node-inspector/node_modules/v8-debug
>  

npm WARN optional dep failed, continuing default-browser-id@1.0.2

> utf-8-validate@1.2.1 install /home/USRAB3L5/nodejs_sqlite3/node_modules/node-inspector/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

gmake: Entering directory '/home/USRAB3L5/nodejs_sqlite3/node_modules/node-inspector/node_modules/ws/node_modules/utf-8-validate/build'
  CXX(target) Release/obj.target/validation/src/validation.o
In file included from ../src/validation.cc:15:0:
../node_modules/nan/nan.h:48:21: fatal error: algorithm: No such file or directory
 #include <algorithm>

So I went searching and found /QSYS.LIB/QSYSINC.LIB/STD.FILE/ALGORITHM.MBR and copied it to the IFS similar to what we do for ruby-ibm_db:

$ system -v "CPY OBJ('/QSYS.LIB/QSYSINC.LIB/STD.FILE/ALGORITHM.MBR') TODIR('/usr/include') TOCCSID(*STDASCII) DTAFMT(*TEXT) REPLACE(*YES)"
$ mv /usr/include/ALGORITHM.MBR /usr/include/algorithm

Copy and rename (mv) is successful. I run the install again and get errors from the algorithm include.

% npm install node-inspector
> v8-profiler@5.3.2 preinstall /home/USRAB3L5/nodejs_sqlite3/node_modules/node-inspector/node_modules/v8-profiler
>  
> v8-debug@0.5.4 preinstall /home/USRAB3L5/nodejs_sqlite3/node_modules/node-inspector/node_modules/v8-debug
>  

npm WARN optional dep failed, continuing default-browser-id@1.0.2

> utf-8-validate@1.2.1 install /home/USRAB3L5/nodejs_sqlite3/node_modules/node-inspector/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

gmake: Entering directory '/home/USRAB3L5/nodejs_sqlite3/node_modules/node-inspector/node_modules/ws/node_modules/utf-8-validate/build'
  CXX(target) Release/obj.target/validation/src/validation.o
In file included from ../node_modules/nan/nan.h:48:0,
                 from ../src/validation.cc:15:
/usr/include/algorithm:5:26: error: #endif without #if
                         #endif /* defined(__COMPILER_VER__) */                                                          
                          ^
/usr/include/algorithm:8:24: error: #endif without #if
                       #endif /* defined(__MVS__) */                                                                     
                        ^
/usr/include/algorithm:26:6: error: #error This file to be used only with IBM VisualAge C++ v4 and later compilers
 #    error\                                                                                                             
      ^

I am not sure if I can copy the algorithm file to here without it being illegal, but there is a lot of interesting stuff in the top of it (i.e. significantly indented 'if' statements with question marks in front of them).

##Should I be pulling includes from somewhere else?

Comments (8)

  1. Former user Account Deleted

    Welcome to IBM i ... cough ... shipped with xlC (pay for compiler).

    bash-4.3$ ls /QOpenSys/xlcpp/opt/IBM/xlC/13.1.0/include/algorithm
    /QOpenSys/xlcpp/opt/IBM/xlC/13.1.0/include/algorithm
    
    /**********************************************************************/
    /*  <algorithm> header file                                           */
    /*                                                                    */
    /**********************************************************************/
    /*                                                                    */
    /*   Licensed Materials - Property of IBM.                            */
    /*   IBM XL C/C++ for AIX, V13.1 (5725-C72, 5765-J07)                 */
    /*                                                                    */
    /*   Copyright IBM Corp. 1991, 2013.                                  */
    /*   US Government Users Restricted Rights -                          */
    /*   Use, duplication or disclosure restricted by                     */
    /*   GSA ADP Schedule Contract with IBM Corp.                         */
    /*   Status = HLE7790                                                 */
    /*                                                                    */
    /**********************************************************************/
    /*                                                                    */
    /*  Dinkum C++ Library                                                */
    /*  Copyright (c) 1998.  Licensed to IBM Corp. and its suppliers.     */
    /*                                                                    */
    

    Can you find an Open Source equivalent???

  2. Aaron Bartell reporter
  3. Former user Account Deleted

    Wait just a minute, you are a c geek now, second you started compiling things, 'which header' is your work here. Have a nice afternoon :)

  4. Chad Bean

    I'm hitting this issue too. @aaronbartell were you able to find a solution? I'm trying to install the ibm_db module for Node.

  5. Log in to comment