conan-io / examples

Conan 1.x examples
MIT License
124 stars 66 forks source link

#43 Fix broken imgui build #45

Closed uilianries closed 4 years ago

uilianries commented 4 years ago

Both GLFW and GLEW requires graphic packages (mesa and X11) which are not listed in Conan Center yet (and there is no PR for them). The only possible example for now, is creating and destroying imgui context, with no graphical support.

That's sad, because we have an excellent blog post about it: https://blog.conan.io/2019/06/26/An-introduction-to-the-Dear-ImGui-library.html

We can update it in the future, but first we need to solve the graphical libs in Conan Center Index

Another option, add Bincrafters's remote and consume both GLFW and GLEW.

fixes #43

jgsogo commented 4 years ago

Yes, I really like that blogpost too 😞

Maybe we should workaround this issue and add bincrafters remote just for this example, wdyt? The blogpost will be valid and the CI will run.

czoido commented 4 years ago

@jgsogo, @uilianries I agree with the idea of adding the bincrafters repo for this example and adding a comment in the blogpost.

danimtb commented 4 years ago

Yes, this fixes the example in the CI but changes too much of it. I would rather keep the original example (everything show-cased in the blog post should work), and meanwhile, add the bincrafters repo and update the post with that additional step.

The good thing is that the example will be tested and we make sure it works for people landing in the blog

uilianries commented 4 years ago

Agreed, I'll revert and add Bincrafters remote.

uilianries commented 4 years ago

Well, Bincrafters is broken. I'll fix that.

uilianries commented 4 years ago

We have a new problem, when linking the imgui example, there is linker error:

mesa/19.3.1/bincrafters/stable/package/6cefff/lib/libGL.so: undefined reference to `xcb_dri3_buffers_from_pixmap_offsets'
mesa/19.3.1/bincrafters/stable/package/6cefff/lib/libGL.so: undefined reference to `xcb_dri3_get_supported_modifiers_window_modifiers'
mesa/19.3.1/bincrafters/stable/package/6cefff/lib/libGL.so: undefined reference to `xcb_dri3_get_supported_modifiers'
mesa/19.3.1/bincrafters/stable/package/6cefff/lib/libGL.so: undefined reference to `xcb_dri3_get_supported_modifiers_reply'
mesa/19.3.1/bincrafters/stable/package/6cefff/lib/libGL.so: undefined reference to `xcb_dri3_buffers_from_pixmap'
mesa/19.3.1/bincrafters/stable/package/6cefff/lib/libGL.so: undefined reference to `xcb_dri3_get_supported_modifiers_screen_modifiers'
mesa/19.3.1/bincrafters/stable/package/6cefff/lib/libGL.so: undefined reference to `xcb_dri3_buffers_from_pixmap_strides'
mesa/19.3.1/bincrafters/stable/package/6cefff/lib/libGL.so: undefined reference to `xcb_dri3_pixmap_from_buffers'
mesa/19.3.1/bincrafters/stable/package/6cefff/lib/libGL.so: undefined reference to `xcb_dri3_buffers_from_pixmap_reply'
mesa/19.3.1/bincrafters/stable/package/6cefff/lib/libGL.so: undefined reference to `xcb_dri3_buffers_from_pixmap_reply_fds'
collect2: error: ld returned 1 exit status
CMakeFiles/dear-imgui-conan.dir/build.make:184: recipe for target 'dear-imgui-conan' failed

That error is cause by the library order. I've tried change the target order in target_link_libraries, but the effect is the same.

However, it works when using the conan cmake generator + conan_basic_setup() + ${CONAN_LIBS}

That's not the first I see a link error which only occurs when using targets provided by Conan.

Steps to reproduce:

cd libraries/dear-imgui/basic
./build.sh
uilianries commented 4 years ago

@jgsogo I made a mistake early morning, it's working pretty well with Conan 1.22 using a different order. It's working now!

jgsogo commented 4 years ago

Interesting... so it was working with 1.21 and it was broken with 1.22, now with your changes it works with both versions.

Some questions I have in mind: Is it really needed to change the order of targets glew::glew and glfw::glfw? do you think it can be an issue in the library order of some of the dependencies? or is it an issue with Conan? I've seen that the graph in Linux is quite big, so probably not needed to have a look at it now, just your impression.

uilianries commented 4 years ago

Is it really needed to change the order of targets glew::glew and glfw::glfw?

No. Running Conan 1.22 it works as well.