IBM / ibmichroot

A set of scripts to facilitate the use of chroot-based containers for IBM i
MIT License
21 stars 9 forks source link

gcc include /usr/include/algorithm #24

Closed abmusse closed 8 years ago

abmusse commented 9 years ago

Original report by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).


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:

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?

abmusse commented 8 years ago

Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).


I've resolved this issue with direction from Kevin Adler. See this link for how to resolve the algorithm include.

abmusse commented 8 years ago

Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).


Sorry, I haven't had time to pursue this further.

abmusse commented 8 years ago

Original comment by Chad Bean (Bitbucket: chadbean, GitHub: Unknown).


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.

abmusse commented 9 years ago

Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).


Too true. Time for me to put on my big boy pants. :-)

abmusse commented 9 years ago

Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).


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 :)

abmusse commented 9 years ago

Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).


Can you find an Open Source equivalent???

Here is the gcc repo. Pressing 't' on that page opens up a nifty file search tool that allowed me to find a couple different algorithm files.

Do you know which one I should be using?...

abmusse commented 9 years ago

Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).


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

#!shell

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???