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

[BUG] Multiple definition of u8g_bitData, u8g_bitNotData, etc #18368

Closed
roobre opened this issue Jun 20, 2020 · 8 comments
Closed

[BUG] Multiple definition of u8g_bitData, u8g_bitNotData, etc #18368

roobre opened this issue Jun 20, 2020 · 8 comments
Labels
Fix Included A fix is included in the description stale-closing-soon

Comments

@roobre
Copy link

roobre commented Jun 20, 2020

Bug Description

While trying to compile with latest u8glib, I get linker errors regarding multiple u8glib-related variables, defined here:

uint8_t u8g_bitData, u8g_bitNotData, u8g_bitClock, u8g_bitNotClock;
volatile uint8_t *u8g_outData, *u8g_outClock;

These variables collide with some with the same name in u8glib:

https://github.com/olikraus/U8glib_Arduino/blob/f17d404d8a20831bfb07ef5de0d225cada2adaef/src/clib/u8g_com_arduino_sw_spi.c#L62

These symbols do not seem to be used outside their compilation unit neither in U8glib, nor in Marlin, at least as far as I could grep. I have solved this locally by patching Marlin and unexport them. See the diff here:

roobre/Marlin-E5P@2.0.x...roobre:fix-u8glib-exported

I am running Marlin on my printer with this patch and I haven't found issues so far.

My Configurations

Configuration is basically the sample in the current 2.0.x branch with some tweaks for the Ender 5 Pro. A diff can be found here: roobre/Marlin-E5P@fix-u8glib-exported...roobre:2.0.x-e5p

Perhaps the most relevant changes are:

#define MOTHERBOARD BOARD_MELZI_CREALITY
#define CR10_STOCKDISPLAY

Steps to Reproduce

  1. Download Marlin
  2. Download U8glib either manually or from the Arduino IDE
  3. Attempt to build using the Arduino IDE

Expected behavior: Build succeeds

Actual behavior: Linking fails due to multiple definitions.

Additional Information

It could be that I am not building Marlin correctly, if that is the case please tell me. Otherwise, the patch I linked above is working for me so I could happily create a PR for it.

I also think that it would be better practice to unexport this in U8glib, rather than in Marlin, but since U8g v1 seems to be long unmaintained I think I'd have better success by submitting a patch here.

@boelle
Copy link
Contributor

boelle commented Jun 20, 2020

tried with vscode+plaform.io ?

@roobre
Copy link
Author

roobre commented Jun 20, 2020

tried with vscode+plaform.io ?

No, sorry, I do not have VSC or PIO on my laptop. It might work with that setup.

@boelle
Copy link
Contributor

boelle commented Jun 20, 2020

i use that... but be warned: its highly addictive, once you tried you will never go back to arduino ide

@roobre
Copy link
Author

roobre commented Jun 20, 2020

i use that... but be warned: its highly addictive, once you tried you will never go back to arduino ide

Yeah, Arduino IDE is quite simple and limited, I'm not particularly a fan. I usually use arduino-mk for my projects, but honestly I was not able to get Marlin's makefile to work...

In any case, I'd like to have some feedback regarding the patch, just to see if it is worth to create a PR for it :)

@roobre
Copy link
Author

roobre commented Jun 29, 2020

I wanted to add that I tried (in fact, switched to) PIO, which pulls a different u8glib (https://github.com/MarlinFirmware/U8glib-HAL). I cannot reproduce this using PIO setup.

When I was using Arduino for compiling, I tried to use the library mentioned above instead for compilation, but it did not work to me. Unfortunately, I do not have the exact output right now, but I can try to get it if you think it may help.

However, I still think that it would be a good idea to keep those symbols private, as they seem to be internal and are conflicting on at least one build environment. Is there a reason I'm not seeing them for keeping them exported?

@sjasonsmith
Copy link
Contributor

@roobre it might be more effective to just post the PR, they will usually be responded to within a couple days. Just be sure to post it against the bugfix-2.0.x branch.

I haven't responded before now because I don't know anything about these u8g libraries, or why there is a custom version for Marlin and we have these duplicated functions.

@boelle boelle added the Fix Included A fix is included in the description label Jun 30, 2020
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label / comment or this will be closed in 5 days.

@github-actions
Copy link

github-actions bot commented Oct 5, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fix Included A fix is included in the description stale-closing-soon
Projects
None yet
Development

No branches or pull requests

3 participants