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

unable to install on Fedora 34 #651

Open
upkarlidder opened this issue May 21, 2021 · 6 comments
Open

unable to install on Fedora 34 #651

upkarlidder opened this issue May 21, 2021 · 6 comments

Comments

@upkarlidder
Copy link

upkarlidder commented May 21, 2021

Hello,
Stuck on this problem for a while now. Hoping somebody can point me in the right direction.

❯ node --version
v13.14.0
❯ npm --version
6.14.4

Error when installing appmetrics-prometheus:

❯ npm install --save appmetrics-prometheus
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported

> [email protected] install /home/upkarfedora/Documents/upkar-code/express-app/node_modules/appmetrics
> node showBuildInfo.js && node-gyp rebuild

Fri, 21 May 2021 21:35:03 GMT
********************************************************************************
You are installing the Node Application Metrics monitoring and profiling module.
Licensed under the Apache License, Version 2.0 (the "License")
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
********************************************************************************


********************************************************************************
Appmetrics uses node-gyp to compile and build local binary libraries to enhance execution performance. If the following compilation and build logs contain errors, make sure you have the node-gyp pre-requisites installed (https://github.com/nodejs/node-gyp#installation). If you have them and the build still had errors, see if there are any related issues at https://github.com/RuntimeTools/appmetrics/issues). If there aren't, feel free to open a new issue to report the bug.
********************************************************************************


/home/upkarfedora/.nvm/versions/node/v13.14.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: line 5: /usr/local/lib/node_modules/node-gyp/bin/node-gyp.jsn: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] install: `node showBuildInfo.js && node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/upkarfedora/.npm/_logs/2021-05-21T21_35_03_734Z-debug.log

Extended logs:

4044 verbose stack Error: [email protected] install: `node showBuildInfo.js && node-gyp rebuild`
4044 verbose stack spawn ENOENT
4044 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
4044 verbose stack     at ChildProcess.emit (events.js:376:20)
4044 verbose stack     at maybeClose (internal/child_process.js:1055:16)
4044 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
4045 verbose pkgid [email protected]
4046 verbose cwd /home/upkarfedora/Documents/upkar-code/express-app
4047 verbose Linux 5.11.21-300.fc34.x86_64
4048 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "--save" "appmetrics-prometheus"
4049 verbose node v14.17.0
4050 verbose npm  v6.14.13
4051 error code ELIFECYCLE
4052 error syscall spawn
4053 error file sh
4054 error errno ENOENT
4055 error [email protected] install: `node showBuildInfo.js && node-gyp rebuild`
4055 error spawn ENOENT
4056 error Failed at the [email protected] install script.
4056 error This is probably not a problem with npm. There is likely additional logging output above.
4057 verbose exit [ 1, true ]
@mattcolegate
Copy link
Member

@upkarlidder This line jumps out at me:

/home/upkarfedora/.nvm/versions/node/v13.14.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: line 5: /usr/local/lib/node_modules/node-gyp/bin/node-gyp.jsn: No such file or directory

The file that it's running at the time, node-gyp, has it's latest form here:
https://github.com/npm/npm-lifecycle/blob/latest/node-gyp-bin/node-gyp
line 5 looks like
"$npm_config_node_gyp" "$@"

So it's trying to run a script defined by a variable, $npm_config_node_gyp, which in your system is set up to point at /usr/local/lib/node_modules/node-gyp/bin/node-gyp.jsn, which doesn't exist. I suspect some kind of typo at this point, because .jsn isn't the right file extension for a javascript file.
It would be worth checking /usr/local/lib/node_modules/node-gyp/bin and seeing if it exists and if node-gyp.js is present. If it isn't, I would recommend looking at https://github.com/nodejs/node-gyp#installation and double checking you've got everything. If it is, you can alter the variable $npm_config_node_gyp by issuing npm config set node_gyp "node <fully_qualified_path_to_node-gyp.js>" or export npm_config_node_gyp=node <fully_qualified_path_to_node-gyp.js

@upkarlidder
Copy link
Author

upkarlidder commented May 22, 2021

The file exists

❯ ls /usr/local/lib/node_modules/node-gyp/bin

node-gyp.js

I tried both

export npm_config_node_gyp="node /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js"

and

npm config set node_gyp "node /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js"

For some reason, it does not see the file:

/home/upkarfedora/.nvm/versions/node/v13.14.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: line 5: node /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js: No such file or directory

Complete error log:

❯ npm install --save appmetrics-prometheus
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported

> [email protected] install /home/upkarfedora/Documents/upkar-code/express-app/node_modules/appmetrics
> node showBuildInfo.js && node-gyp rebuild

Sat, 22 May 2021 23:43:33 GMT
********************************************************************************
You are installing the Node Application Metrics monitoring and profiling module.
Licensed under the Apache License, Version 2.0 (the "License")
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
********************************************************************************


********************************************************************************
Appmetrics uses node-gyp to compile and build local binary libraries to enhance execution performance. If the following compilation and build logs contain errors, make sure you have the node-gyp pre-requisites installed (https://github.com/nodejs/node-gyp#installation). If you have them and the build still had errors, see if there are any related issues at https://github.com/RuntimeTools/appmetrics/issues). If there aren't, feel free to open a new issue to report the bug.
********************************************************************************


/home/upkarfedora/.nvm/versions/node/v13.14.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: line 5: node /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] install: `node showBuildInfo.js && node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/upkarfedora/.npm/_logs/2021-05-22T23_43_34_340Z-debug.log

@mattcolegate
Copy link
Member

This issue nodejs/node-gyp#2199 suggests not having the variable set at all
npm config delete node-gyp
unset npm_config_node_gyp

@upkarlidder
Copy link
Author

Thank you @mattcolegate. I deleted it and now get a make error 🤦🏽

❯ npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.14.4 node/v13.14.0 linux x64"

; userconfig /home/upkarfedora/.npmrc
python = "/usr/bin/python"

; node bin location = /home/upkarfedora/.nvm/versions/node/v13.14.0/bin/node
; cwd = /home/upkarfedora/Documents/upkar-code/express-app
; HOME = /home/upkarfedora
; "npm config ls -l" to show all defaults.

Prerequisites installed:

❯ gcc --version
gcc (GCC) 11.1.1 20210428 (Red Hat 11.1.1-1)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

❯ make --version
GNU Make 4.3
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
❯ node --version
v14.17.0
❯ python --version
Python 3.9.5

New error:

/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/utf-8.o:(.bss+0x0): multiple definition of `Log_levels'; ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/Heap.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [omr-agentcore/hcmqtt.target.mk:182: Release/obj.target/omr-agentcore/libhcmqtt.so] Error 1
make: Leaving directory '/home/upkarfedora/Documents/upkar-code/express-app/node_modules/appmetrics/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/upkarfedora/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:376:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 5.11.21-300.fc34.x86_64
gyp ERR! command "/home/upkarfedora/.nvm/versions/node/v14.17.0/bin/node" "/home/upkarfedora/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/upkarfedora/Documents/upkar-code/express-app/node_modules/appmetrics
gyp ERR! node -v v14.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node showBuildInfo.js && node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/upkarfedora/.npm/_logs/2021-05-23T04_10_12_591Z-debug.log

@iblessedi
Copy link

any news on this?

@attermann
Copy link

attermann commented Aug 12, 2024

I know this is an old issue but I encountered something similar recently so wanted to share a potential solution.

In my case I noticed the following suspicious logs

npm ERR! /usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/Log.o:(.bss+0x20): multiple definition of `Log_levels'; ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/Heap.o:(.bss+0x0): first defined here
npm ERR! /usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/Messages.o:(.bss+0x0): multiple definition of `Log_levels'; ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/Heap.o:(.bss+0x0): first defined here
npm ERR! /usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/MQTTAsync.o:(.bss+0x68): multiple definition of `Log_levels'; ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/Heap.o:(.bss+0x0): first defined here
...

Digging into paho mqtt source I noticed that the LOG_LEVELS enum has a definition of Log_levels in Logs.h which leads to multiple definitions. This condition was tolerated by the gcc compiler until more recent versions. The actual change in the compiler makes the -fno-common the default instead of -fcommon, which does not allow such duplicates.

The solution in my case was to revert this setting using the CFLAGS environment variable prior to installing appmetrics.

export CFLAGS=-fcommon

This allowed me to successfully install.

Ultimately this needs to be fixed in omr-agentcore by using a more recent build of org.eclipse.paho.mqtt.c, but until then this workaround is required for newer gcc versions.

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

4 participants