Closed mattseaboard closed 10 months ago
Yep, this is a known issue and a duplicate of #27.
Unfortunately, we don't have much ability to fix GCC 6 due to the way we package it from the prebuilt AIX rpms. Please use GCC 10 instead by eg. CC=gcc-10 CXX=g++-10 npm i
Thanks @kadler. I don't quite understand your instructions there. Is this just a bash command I need to run? Do I need to uninstall GCC 6?
Also, do you know what is causing this error upon upgrading to IBM i 7.5? I was informed that the upgrade itself did not modify any open source packages.
Yes, this is just part of the npm command you run. You can export the CC
and CXX
environment variables in bash or prefix them to your npm
command.
The problem is that GCC needs to modify some system header files in order to work correctly and the modified versions it ships are not compatible with the updated IBM i 7.5 system header files. The GCC 10 rpms we have are built by us and we handle the modified system header files differently. There, the rpm runs a tool which modifies the system header files from the system it's installed on instead of shipping a pre-modified copy.
I appreciate you taking the time to explain to me so I can relay this info on to our IBM i admin. Have a good one!
Problem
Upon upgrading our IBM i OS from 7.4 to 7.5, compilation of any C++-based Node.js module downloaded from NPM started failing, including bcrypt and odbc packages. This causes the NPM package installation to fail which renders the Node.js application inoperable.
Verification
Check the output from the NPM install operation. If it is failing on the Node-Gyp step with errors mentioning a duplicate struct definition for sigset_t , this is the issue.
Sample error snippet: npm ERR! In file included from /usr/include/sys/resource.h:57:0, npm ERR! from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/sys/wait.h:56, npm ERR! from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/stdlib.h:386, npm ERR! from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include/c++/cstdlib:75, npm ERR! from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include/c++/stdlib.h:36, npm ERR! from ../src/odbc.cpp:20: npm ERR! /usr/include/sys/time.h:108:16: error: redefinition of 'struct sigset_t' npm ERR! typedef struct sigset_t { npm ERR! ^
~~~ npm ERR! In file included from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/time.h:199:0, npm ERR! from ../src/odbc.cpp:19: npm ERR! /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/sys/types.h:345:16: error: previous definition of 'struct sigset_t' npm ERR! typedef struct sigset_t { npm ERR! ^~~~ npm ERR! In file included from /usr/include/sys/resource.h:57:0, npm ERR! from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/sys/wait.h:56, npm ERR! from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/stdlib.h:386, npm ERR! from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include/c++/cstdlib:75, npm ERR! from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include/c++/stdlib.h:36, npm ERR! from ../src/odbc.cpp:20: npm ERR! /usr/include/sys/time.h:124:3: error: conflicting declaration 'typedef int sigset_t' npm ERR! } sigset_t; npm ERR! ^~~~ npm ERR! In file included from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/time.h:199:0, npm ERR! from ../src/odbc.cpp:19: npm ERR! /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/sys/types.h:361:3: note: previous declaration as 'typedef struct sigset_t sigset_t' npm ERR! } sigset_t; npm ERR! ^~~~ npm ERR! gmake: *** [odbc.target.mk:135: Release/obj.target/odbc/src/odbc.o] Error 1Cause
A recent update of the GCC packages on yum for IBM i added a definition of the sigset_t struct to the /usr/include/sys/time.h file. This definition was not previously present here. Along with that, the /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/sys/types.h file defines sigset_t without first checking if sigset_t has already been defined.
As a result, if the /usr/include/sys/time.h file is processed by the compiler before the /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/sys/types.h file, there will be a duplicate definition of sigset_t and the compilation will fail.
Resolution
The simplest way to resolve this issue is to update the /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/sys/types.h file to only define the sigset_t struct if it has not already been defined. This can be accomplished by surrounding the sigset_t definition lines in a ifndef condition which will only pass if sigset_t has not already been defined.
The following diff can be applied to the file to make this change:
344a345,346
Once that file has been changed, try the npm install again and it should be able to successfully install this time.