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

Build fails with GCC version 10.1.0 #641

Open
acheronfail opened this issue May 21, 2020 · 4 comments
Open

Build fails with GCC version 10.1.0 #641

acheronfail opened this issue May 21, 2020 · 4 comments

Comments

@acheronfail
Copy link

I've noticed that building appmetrics with the latest version of gcc fails.
I've tried this on multiple node versions (10, 12 & 13).

The last good working version of gcc is 9.3.0.
Building it with 10.1.0 fails with the following output:

... other logs and warnings ...

  SOLINK(target) Release/obj.target/omr-agentcore/libhcmqtt.so
/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
/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
/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
/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/MQTTPacket.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
/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/MQTTPacketOut.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
/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/MQTTPersistence.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
/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/MQTTPersistenceDefault.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
/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/MQTTProtocolClient.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
/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/MQTTProtocolOut.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
/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/SocketBuffer.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
/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/Socket.o:(.bss+0x1a8): multiple definition of `Log_levels'; ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/Heap.o:(.bss+0x0): first defined here
/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/StackTrace.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
/usr/bin/ld: ./Release/obj.target/hcmqtt/omr-agentcore/org.eclipse.paho.mqtt.c/src/Thread.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
/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:174: Release/obj.target/omr-agentcore/libhcmqtt.so] Error 1
make: Leaving directory '/home/cosmotherly/work/incredible-monorepo/node_modules/appmetrics/build'

Some information about my system:

Arch Linux 5.4.41-1-lts x86_64 GNU/Linux

And I've confirmed the issue fails to build with gcc 10.1.0 on various node versions:

10.19.0
10.20.1
12.16.3
13.6.0

Downgrading to gcc 9.3.0 resolves the issues for me.

goto-bus-stop added a commit to goto-bus-stop/omr-agentcore that referenced this issue Aug 23, 2020
This `enum LOG_LEVELS` declaration also included a _variable name_,
causing RuntimeTools/appmetrics#641. It ended
up defining a `Log_levels` variable in every compilation unit that
included "Log.h", which then caused duplicate symbols at link time.

I don't know if there was a reason for this definition, but it looks
like a bug to me … if not, maybe it can be fixed by just putting a
`static` in front? idk.

Thanks!
@mitermayer
Copy link

same problem here! do we have plans on fixing this ?

@mitermayer
Copy link

@acheronfail I actually realized that I have the same issue as you and the same system since we both work at the same place and are falling with the same project. How did you manage to solve this issue? I tried to find you on slack but could not find you based on your GitHub username alone

@acheronfail
Copy link
Author

Depending on what I'm doing I do one of two things:

  • downgrade my gcc and gcc-libs packages to V9
  • ignore the errors during install and manually run the postinstall hooks myself

@CaelumF
Copy link

CaelumF commented Jun 28, 2021

For people who would rather not downgrade several major gcc versions just for this 1 package, the following works for me and I hope will help you too:

  1. install gcc 9.30 separately using a package manager or whichever method you like

  2. When installing something that depends on appmetrics, use:

env CC=/path/to/gcc-9 npm install 

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