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

duplicate symbol errors in development using go-sdk and go-ethereum at the same time #280

Open
3100 opened this issue Jan 6, 2022 · 2 comments

Comments

@3100
Copy link

3100 commented Jan 6, 2022

Hi, while developing a go application using go-sdk with accounts/abi/bind package of ethereum/go-ethereum, I got duplicate symbols error caused by cgo at build time.

error log (on ubuntu)
/opt/hostedtoolcache/go/1.16.12/x64/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_control_transfer':
libs.cgo2.c:(.text+0xe1c7): multiple definition of `libusb_control_transfer'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xc54d): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_cond_timedwait':
libs.cgo2.c:(.text+0x6f4): multiple definition of `usbi_cond_timedwait'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x4dc): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_get_tid':
libs.cgo2.c:(.text+0x7bf): multiple definition of `usbi_get_tid'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5ae): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_pipe':
libs.cgo2.c:(.text+0x7e2): multiple definition of `usbi_pipe'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5d8): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o:(.bss+0x0): multiple definition of `linux_hotplug_lock'; /tmp/go-link-969130002/000025.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `linux_netlink_start_event_monitor':
libs.cgo2.c:(.text+0x50b6): multiple definition of `linux_netlink_start_event_monitor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x4c50): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `linux_netlink_stop_event_monitor':
libs.cgo2.c:(.text+0x5287): multiple definition of `linux_netlink_stop_event_monitor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x4e23): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `linux_netlink_hotplug_poll':
libs.cgo2.c:(.text+0x5af2): multiple definition of `linux_netlink_hotplug_poll'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x566d): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `linux_get_device_address':
libs.cgo2.c:(.text+0x173a): multiple definition of `linux_get_device_address'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x1310): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_parse_descriptor':
libs.cgo2.c:(.text+0x9864): multiple definition of `usbi_parse_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x7d42): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_ref_device':
libs.cgo2.c:(.text+0x81b5): multiple definition of `libusb_ref_device'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6180): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `linux_enumerate_device':
libs.cgo2.c:(.text+0x2370): multiple definition of `linux_enumerate_device'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x1f23): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_get_device_by_session_id':
libs.cgo2.c:(.text+0x7ae8): multiple definition of `usbi_get_device_by_session_id'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5aa5): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_unref_device.localalias':
libs.cgo2.c:(.text+0x81f4): multiple definition of `libusb_unref_device'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x61bf): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_alloc_device':
libs.cgo2.c:(.text+0x7884): multiple definition of `usbi_alloc_device'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5832): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_sanitize_device':
libs.cgo2.c:(.text+0x7a94): multiple definition of `usbi_sanitize_device'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5a51): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_connect_device':
libs.cgo2.c:(.text+0x793d): multiple definition of `usbi_connect_device'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x58fa): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `linux_hotplug_enumerate':
libs.cgo2.c:(.text+0x247e): multiple definition of `linux_hotplug_enumerate'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x2031): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o:(.bss+0x40): multiple definition of `active_contexts_lock'; /tmp/go-link-969130002/000025.o:(.bss+0x40): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `linux_device_disconnected':
libs.cgo2.c:(.text+0x2516): multiple definition of `linux_device_disconnected'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x20c9): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_disconnect_device':
libs.cgo2.c:(.text+0x79e8): multiple definition of `usbi_disconnect_device'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x59a5): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_add_pollfd':
libs.cgo2.c:(.text+0xdb83): multiple definition of `usbi_add_pollfd'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xbf02): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_remove_pollfd':
libs.cgo2.c:(.text+0xdc70): multiple definition of `usbi_remove_pollfd'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xbfef): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_handle_transfer_cancellation':
libs.cgo2.c:(.text+0xc674): multiple definition of `usbi_handle_transfer_cancellation'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xaa34): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_handle_transfer_completion':
libs.cgo2.c:(.text+0xc54c): multiple definition of `usbi_handle_transfer_completion'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xa90c): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_handle_disconnect':
libs.cgo2.c:(.text+0xdec1): multiple definition of `usbi_handle_disconnect'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xc240): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o:(.data.rel.ro.local+0x0): multiple definition of `usbi_backend'; /tmp/go-link-969130002/000025.o:(.data.rel.ro+0x0): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `get_usb_code_for_current_locale':
libs.cgo2.c:(.text+0x75b2): multiple definition of `get_usb_code_for_current_locale'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe45c): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_device_address':
libs.cgo2.c:(.text+0x7f2a): multiple definition of `libusb_get_device_address'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5ef5): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_bus_number':
libs.cgo2.c:(.text+0x7e00): multiple definition of `libusb_get_bus_number'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5dcb): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_init':
libs.cgo2.c:(.text+0x5f6e): multiple definition of `hid_init'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xce18): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_init':
libs.cgo2.c:(.text+0x913f): multiple definition of `libusb_init'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x7040): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_exit':
libs.cgo2.c:(.text+0x5fcf): multiple definition of `hid_exit'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xce79): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_exit':
libs.cgo2.c:(.text+0x94ae): multiple definition of `libusb_exit'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x73ee): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_enumerate':
libs.cgo2.c:(.text+0x6004): multiple definition of `hid_enumerate'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xceae): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_device_list':
libs.cgo2.c:(.text+0x7b81): multiple definition of `libusb_get_device_list'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5b3e): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_device_descriptor':
libs.cgo2.c:(.text+0xa5d6): multiple definition of `libusb_get_device_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x8ab4): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_active_config_descriptor':
libs.cgo2.c:(.text+0xa60d): multiple definition of `libusb_get_active_config_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x8aeb): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_config_descriptor':
libs.cgo2.c:(.text+0xa72e): multiple definition of `libusb_get_config_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x8c14): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_open':
libs.cgo2.c:(.text+0x837a): multiple definition of `libusb_open'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6354): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_close':
libs.cgo2.c:(.text+0x8761): multiple definition of `libusb_close'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6752): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_free_config_descriptor':
libs.cgo2.c:(.text+0xaa22): multiple definition of `libusb_free_config_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x8f1c): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_free_device_list':
libs.cgo2.c:(.text+0x7d92): multiple definition of `libusb_free_device_list'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5d5d): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_free_enumeration':
libs.cgo2.c:(.text+0x636e): multiple definition of `hid_free_enumeration'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xd218): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_open':
libs.cgo2.c:(.text+0x63f2): multiple definition of `hid_open'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xd29c): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_open_path':
libs.cgo2.c:(.text+0x681a): multiple definition of `hid_open_path'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xd6c4): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_submit_transfer':
libs.cgo2.c:(.text+0xc2e5): multiple definition of `libusb_submit_transfer'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xa697): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_alloc_transfer':
libs.cgo2.c:(.text+0xbf5d): multiple definition of `libusb_alloc_transfer'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xa300): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_handle_events':
libs.cgo2.c:(.text+0xd6cb): multiple definition of `libusb_handle_events'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xba43): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_cancel_transfer':
libs.cgo2.c:(.text+0xc444): multiple definition of `libusb_cancel_transfer'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xa7fd): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_handle_events_completed':
libs.cgo2.c:(.text+0xd728): multiple definition of `libusb_handle_events_completed'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xbaa0): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_kernel_driver_active':
libs.cgo2.c:(.text+0x8e56): multiple definition of `libusb_kernel_driver_active'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6ea8): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_detach_kernel_driver':
libs.cgo2.c:(.text+0x8ea9): multiple definition of `libusb_detach_kernel_driver'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6f09): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_claim_interface':
libs.cgo2.c:(.text+0x8a5b): multiple definition of `libusb_claim_interface'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6a58): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_write':
libs.cgo2.c:(.text+0x6c54): multiple definition of `hid_write'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xdafe): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_interrupt_transfer':
libs.cgo2.c:(.text+0xe5fc): multiple definition of `libusb_interrupt_transfer'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xc982): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_read_timeout':
libs.cgo2.c:(.text+0x6e41): multiple definition of `hid_read_timeout'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xdceb): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_read':
libs.cgo2.c:(.text+0x71ac): multiple definition of `hid_read'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe056): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_set_nonblocking':
libs.cgo2.c:(.text+0x71f1): multiple definition of `hid_set_nonblocking'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe09b): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_send_feature_report':
libs.cgo2.c:(.text+0x7218): multiple definition of `hid_send_feature_report'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe0c2): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_get_feature_report':
libs.cgo2.c:(.text+0x72cc): multiple definition of `hid_get_feature_report'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe176): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_close':
libs.cgo2.c:(.text+0x737e): multiple definition of `hid_close'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe228): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_free_transfer':
libs.cgo2.c:(.text+0xbfe9): multiple definition of `libusb_free_transfer'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xa39b): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_release_interface':
libs.cgo2.c:(.text+0x8b22): multiple definition of `libusb_release_interface'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6b23): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_get_manufacturer_string':
libs.cgo2.c:(.text+0x7479): multiple definition of `hid_get_manufacturer_string'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe323): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_get_indexed_string':
libs.cgo2.c:(.text+0x7518): multiple definition of `hid_get_indexed_string'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe3c2): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_get_product_string':
libs.cgo2.c:(.text+0x74ae): multiple definition of `hid_get_product_string'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe358): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_get_serial_number_string':
libs.cgo2.c:(.text+0x74e3): multiple definition of `hid_get_serial_number_string'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe38d): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `hid_error':
libs.cgo2.c:(.text+0x759f): multiple definition of `hid_error'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xe449): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o:(.bss+0x28): multiple definition of `usbi_default_context'; /tmp/go-link-969130002/000025.o:(.bss+0x28): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `discovered_devs_append':
libs.cgo2.c:(.text+0x778b): multiple definition of `discovered_devs_append'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5739): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_has_capability':
libs.cgo2.c:(.text+0x96d4): multiple definition of `libusb_has_capability'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x7610): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_hotplug_notification':
libs.cgo2.c:(.text+0xb584): multiple definition of `usbi_hotplug_notification'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x9a6e): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_device_cache_descriptor':
libs.cgo2.c:(.text+0xa4f8): multiple definition of `usbi_device_cache_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x89d6): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_port_number':
libs.cgo2.c:(.text+0x7e16): multiple definition of `libusb_get_port_number'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5de1): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_port_numbers':
libs.cgo2.c:(.text+0x7e2c): multiple definition of `libusb_get_port_numbers'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5df7): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_port_path':
libs.cgo2.c:(.text+0x7ede): multiple definition of `libusb_get_port_path'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5ea9): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_parent':
libs.cgo2.c:(.text+0x7f14): multiple definition of `libusb_get_parent'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5edf): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_device_speed':
libs.cgo2.c:(.text+0x7f40): multiple definition of `libusb_get_device_speed'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5f0b): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_max_packet_size':
libs.cgo2.c:(.text+0x802e): multiple definition of `libusb_get_max_packet_size'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x5ff9): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_max_iso_packet_size':
libs.cgo2.c:(.text+0x80ce): multiple definition of `libusb_get_max_iso_packet_size'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6099): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_signal_event':
libs.cgo2.c:(.text+0x82ab): multiple definition of `usbi_signal_event'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6284): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_clear_event':
libs.cgo2.c:(.text+0x8315): multiple definition of `usbi_clear_event'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x62ee): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_open_device_with_vid_pid':
libs.cgo2.c:(.text+0x84dd): multiple definition of `libusb_open_device_with_vid_pid'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x64ca): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_lock_events':
libs.cgo2.c:(.text+0xc872): multiple definition of `libusb_lock_events'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xac32): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_unlock_events':
libs.cgo2.c:(.text+0xc8ba): multiple definition of `libusb_unlock_events'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xac7a): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_device':
libs.cgo2.c:(.text+0x8949): multiple definition of `libusb_get_device'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x693a): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_configuration':
libs.cgo2.c:(.text+0x895f): multiple definition of `libusb_get_configuration'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6950): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_set_configuration':
libs.cgo2.c:(.text+0x8a31): multiple definition of `libusb_set_configuration'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6a2a): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_set_interface_alt_setting':
libs.cgo2.c:(.text+0x8bd1): multiple definition of `libusb_set_interface_alt_setting'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6bd6): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_clear_halt':
libs.cgo2.c:(.text+0x8c7f): multiple definition of `libusb_clear_halt'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6c8b): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_reset_device':
libs.cgo2.c:(.text+0x8cc2): multiple definition of `libusb_reset_device'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6cd5): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_alloc_streams':
libs.cgo2.c:(.text+0x8cfa): multiple definition of `libusb_alloc_streams'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6d14): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_free_streams':
libs.cgo2.c:(.text+0x8d5a): multiple definition of `libusb_free_streams'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6d82): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_dev_mem_alloc':
libs.cgo2.c:(.text+0x8db7): multiple definition of `libusb_dev_mem_alloc'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6ded): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_dev_mem_free':
libs.cgo2.c:(.text+0x8e0d): multiple definition of `libusb_dev_mem_free'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6e51): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_attach_kernel_driver':
libs.cgo2.c:(.text+0x8efc): multiple definition of `libusb_attach_kernel_driver'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6f6a): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_set_auto_detach_kernel_driver':
libs.cgo2.c:(.text+0x8f4f): multiple definition of `libusb_set_auto_detach_kernel_driver'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x6fcb): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_set_debug':
libs.cgo2.c:(.text+0x8f84): multiple definition of `libusb_set_debug'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x7005): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_io_init':
libs.cgo2.c:(.text+0xbba7): multiple definition of `usbi_io_init'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x9f39): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_handle_events_timeout':
libs.cgo2.c:(.text+0xd69d): multiple definition of `libusb_handle_events_timeout'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xba15): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_io_exit':
libs.cgo2.c:(.text+0xbd45): multiple definition of `usbi_io_exit'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xa0fb): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_error_name':
libs.cgo2.c:(.text+0x9747): multiple definition of `libusb_error_name'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x7c25): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_version':
libs.cgo2.c:(.text+0x9853): multiple definition of `libusb_get_version'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x7d31): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_get_config_index_by_value':
libs.cgo2.c:(.text+0xa876): multiple definition of `usbi_get_config_index_by_value'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x8d64): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_config_descriptor_by_value':
libs.cgo2.c:(.text+0xa937): multiple definition of `libusb_get_config_descriptor_by_value'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x8e29): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_ss_endpoint_companion_descriptor':
libs.cgo2.c:(.text+0xaa56): multiple definition of `libusb_get_ss_endpoint_companion_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x8f50): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_free_ss_endpoint_companion_descriptor':
libs.cgo2.c:(.text+0xab7d): multiple definition of `libusb_free_ss_endpoint_companion_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x9077): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_free_bos_descriptor':
libs.cgo2.c:(.text+0xaf0b): multiple definition of `libusb_free_bos_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x9405): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_bos_descriptor':
libs.cgo2.c:(.text+0xadc9): multiple definition of `libusb_get_bos_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x92c3): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_usb_2_0_extension_descriptor':
libs.cgo2.c:(.text+0xaf67): multiple definition of `libusb_get_usb_2_0_extension_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x9461): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_free_usb_2_0_extension_descriptor':
libs.cgo2.c:(.text+0xaff3): multiple definition of `libusb_free_usb_2_0_extension_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x94ed): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_ss_usb_device_capability_descriptor':
libs.cgo2.c:(.text+0xb012): multiple definition of `libusb_get_ss_usb_device_capability_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x950c): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_free_ss_usb_device_capability_descriptor':
libs.cgo2.c:(.text+0xb09e): multiple definition of `libusb_free_ss_usb_device_capability_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x9598): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_container_id_descriptor':
libs.cgo2.c:(.text+0xb0bd): multiple definition of `libusb_get_container_id_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x95b7): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_free_container_id_descriptor':
libs.cgo2.c:(.text+0xb149): multiple definition of `libusb_free_container_id_descriptor'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x9643): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_string_descriptor_ascii':
libs.cgo2.c:(.text+0xb168): multiple definition of `libusb_get_string_descriptor_ascii'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x9662): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_hotplug_match':
libs.cgo2.c:(.text+0xb479): multiple definition of `usbi_hotplug_match'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x997a): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_hotplug_register_callback':
libs.cgo2.c:(.text+0xb688): multiple definition of `libusb_hotplug_register_callback'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x9b72): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_hotplug_deregister_callback':
libs.cgo2.c:(.text+0xb965): multiple definition of `libusb_hotplug_deregister_callback'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0x9dca): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_transfer_set_stream_id':
libs.cgo2.c:(.text+0xc503): multiple definition of `libusb_transfer_set_stream_id'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xa8c3): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_transfer_get_stream_id':
libs.cgo2.c:(.text+0xc52b): multiple definition of `libusb_transfer_get_stream_id'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xa8eb): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `usbi_signal_transfer_completion':
libs.cgo2.c:(.text+0xc6f9): multiple definition of `usbi_signal_transfer_completion'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xaab9): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_try_lock_events':
libs.cgo2.c:(.text+0xc7d8): multiple definition of `libusb_try_lock_events'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xab98): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_event_handling_ok':
libs.cgo2.c:(.text+0xc938): multiple definition of `libusb_event_handling_ok'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xacf8): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_event_handler_active':
libs.cgo2.c:(.text+0xc9a2): multiple definition of `libusb_event_handler_active'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xad62): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_interrupt_event_handler':
libs.cgo2.c:(.text+0xca11): multiple definition of `libusb_interrupt_event_handler'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xadd1): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_lock_event_waiters':
libs.cgo2.c:(.text+0xcae9): multiple definition of `libusb_lock_event_waiters'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xaea9): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_unlock_event_waiters':
libs.cgo2.c:(.text+0xcb23): multiple definition of `libusb_unlock_event_waiters'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xaee3): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_wait_for_event':
libs.cgo2.c:(.text+0xcb5d): multiple definition of `libusb_wait_for_event'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xaf1d): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_next_timeout':
libs.cgo2.c:(.text+0xd82a): multiple definition of `libusb_get_next_timeout'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xbba2): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_handle_events_timeout_completed':
libs.cgo2.c:(.text+0xd547): multiple definition of `libusb_handle_events_timeout_completed'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xb8bf): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_handle_events_locked':
libs.cgo2.c:(.text+0xd788): multiple definition of `libusb_handle_events_locked'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xbb00): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_pollfds_handle_timeouts':
libs.cgo2.c:(.text+0xd817): multiple definition of `libusb_pollfds_handle_timeouts'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xbb8f): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_set_pollfd_notifiers':
libs.cgo2.c:(.text+0xda87): multiple definition of `libusb_set_pollfd_notifiers'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xbe06): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_get_pollfds':
libs.cgo2.c:(.text+0xdd8c): multiple definition of `libusb_get_pollfds'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xc10b): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_free_pollfds':
libs.cgo2.c:(.text+0xde99): multiple definition of `libusb_free_pollfds'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xc218): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_setlocale':
libs.cgo2.c:(.text+0xe003): multiple definition of `libusb_setlocale'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xc389): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_strerror':
libs.cgo2.c:(.text+0xe0da): multiple definition of `libusb_strerror'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xc460): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000033.o: in function `libusb_bulk_transfer':
libs.cgo2.c:(.text+0xe5a7): multiple definition of `libusb_bulk_transfer'; /tmp/go-link-969130002/000025.o:hid_enabled.cgo2.c:(.text+0xc92d): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000036.o:(.rodata+0x0): multiple definition of `SIZEOF_WCHAR_T'; /tmp/go-link-969130002/000026.o:(.rodata+0x0): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000036.o: in function `gowchar_set':
wchar.cgo2.c:(.text+0x3e): multiple definition of `gowchar_set'; /tmp/go-link-969130002/000026.o:wchar.cgo2.c:(.text+0x3e): first defined here
/usr/bin/ld: /tmp/go-link-969130002/000036.o: in function `gowchar_get':
wchar.cgo2.c:(.text+0x6c): multiple definition of `gowchar_get'; /tmp/go-link-969130002/000026.o:wchar.cgo2.c:(.text+0x6c): first defined here
collect2: error: ld returned 1 exit status

The following shows the dependencies of the related packages and the packages that use them:

  • karalabe/usb
    • go-ethereum/accounts/usbwallet
      • go-ethereum/signer/core
        • go-ethereum/accounts/external
          • go-ethereum/accounts/abi/bind (Used in go-bindings of contract)
  • karalabe/hid
    • go-sdk/pkg/ledger
      • go-sdk/pkg/transaction (Used in controller.ExecuteTransaction, etc.)

I replaced karalabe/hid with karalabe/usb and was able to build it without the duplicate symbols error above. However, I have not been able to confirm if this is a correct replacement since I do not have a hardware wallet.
For reference, the work associated with this survey was done by
https://github.com/datachainlab/harmony-go-sdk-sample

Is there any good way to improve the situation? This problem is always possible in application development where go-sdk and go-ethereum are used together.

As a side note, since go-sdk depends on cosmos/cosmos-sdk, it also could cause a duplicate symbol error with Zondax/hid via cosmos-sdk.

@harjas27
Copy link

  1. I see you have commented out the option ldflags=-v -extldflags "-Wl,--allow-multiple-definition", does it work using this ?
  2. The soultion to this should be to create a fork for the karalabe/hid repo and rename the functions/variables and use that as a dependency module. Or can have the modified hid in the sdk itself

@3100
Copy link
Author

3100 commented Jan 17, 2022

  1. I see you have commented out the option ldflags=-v -extldflags "-Wl,--allow-multiple-definition", does it work using this ?

It allows us to build it, but we won't know which one is called, and I don't think we should use it.

  1. The soultion to this should be to create a fork for the karalabe/hid repo and rename the functions/variables and use that as a dependency module. Or can have the modified hid in the sdk itself

If the go-sdk development team is comfortable with this idea, changing the symbol names of the hid seems to be a good idea.

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

2 participants