floooh/oryol-imgui

Linking error. ld: cannot find -lIMUI

bmcorser opened this issue · 3 comments

Not too sure what I'm doing wrong, but I'm getting a linking error when running ./fips build.

I cloned the oryol-test-app repo and added dependencies for imgui to CMakeLists.txt and fips.yml ... I can't see anything else that's happening in the sample code (which I'm using for reference).

My repo is here https://github.com/steadysupply/mouse-track

Yep I can reproduce this. The reason is the line "no_auto_import: true" in the fips.yml file:

#
# mouse-track
#
---
policies:
    no_auto_import: true

imports:
    oryol:
        git: https://github.com/floooh/oryol.git
    oryol-imgui:
        git: https://github.com/floooh/oryol-imgui.git

This disables the automatic import of all modules a dependency exports, for a small program like the test application this makes the IDE project structure simpler, but it requires that you list all required modules of a dependency manually.

There's 2 ways to fix this:

  1. add the required manual dependency to the toplevel CMakeLists.txt files, there 3 needed (I started with the IMUI dependency, and then had to add Oryol's Input module and the fips-imgui module, because the IMUI module depends on those two):
...
fips_import_oryol_Input()
fips_import_fips_imgui_imgui()
fips_import_oryol_imgui_IMUI()
...

These cmake functions are defined in the generated file .fips-imports.cmake in the project root directory.

The complete CMakeLists.txt file would look like this:

cmake_minimum_required(VERSION 2.8)

# include the fips main cmake file
get_filename_component(FIPS_ROOT_DIR "../fips" ABSOLUTE)
include("${FIPS_ROOT_DIR}/cmake/fips.cmake")

fips_setup()
fips_project(mouse-track)
fips_add_subdirectory(code)

# manually defined imports, we don't need all of Oryol
fips_ide_group("Oryol")
fips_import_oryol_Core()
fips_import_oryol_Gfx()
fips_import_oryol_Assets()
fips_import_oryol_Resource()
fips_import_oryol_Input()
fips_import_fips_imgui_imgui()
fips_import_oryol_imgui_IMUI()
fips_ide_group("Libs")
fips_import_fips_glfw_glfw3()
fips_ide_group("")

fips_finish()

The other option is to enable the "auto-import policy", first remove the first 2 lines from fips.yml, so it looks like this:

imports:
    oryol:
        git: https://github.com/floooh/oryol.git
    oryol-imgui:
        git: https://github.com/floooh/oryol-imgui.git

Then remove all the manual import cmake function calls from the toplevel CMakeLists.txt file, so it looks like this:

cmake_minimum_required(VERSION 2.8)

# include the fips main cmake file
get_filename_component(FIPS_ROOT_DIR "../fips" ABSOLUTE)
include("${FIPS_ROOT_DIR}/cmake/fips.cmake")

fips_setup()
fips_project(mouse-track)
fips_add_subdirectory(code)
fips_finish()

Then run ./fipa clean (important) and ./fips build again:

> ./fips clean
...
> ./fips build
...
> ./fips list targets
...
  app:
    MouseTrack
> ./fips run MouseTrack

On my work-in-progress sokol-gfx integration branch I'm getting an assertion im imguiWrapper.cc, not sure if you'll get the same (so whether it's my work-in-progress stuff, or a bug in your test app), but I guess you can take over from here ;)

Cheers!

PS: I'm closing the ticket, if you encounter more problems, feel free to re-open it.

Thank for such a comprehensive reply. I opted for the simpler option of turning auto import on and letting your work take care of everything :)

Really looking forward to playing with Oryol, looks great!