xmake-io / xmake-repo

📦 An official xmake package repository
https://xrepo.xmake.io
Apache License 2.0
617 stars 371 forks source link

imgui: compile imgui project occur link issue of 'undefined reference to glClear' #3411

Open Sunrisepeak opened 4 months ago

Sunrisepeak commented 4 months ago

Xmake 版本

2.8.7

操作系统版本和架构

Ubuntu22.04

描述问题

真实问题出现在 我自己的项目KHistory上(xmake.lua) 老电脑上使用 xmake v2.7.3可以正常构建,新安装的ubuntu22.04, 使用 xmake v2.8.7 会出现 opengl 相关的问题

最后发现编译 imgui-scaffold示例也会出现问题

sudo add-apt-repository ppa:xmake-io/xmake
sudo apt-get update
sudo apt-get install g++ gdb xmake make git -y

image

期待的结果

imgui-scaffold 可以正常构建

工程配置

https://github.com/xmake-examples/imgui-scaffold

附加信息和错误日志

目前通过 安装mesa-common-dev, 并且在xmake.lua 中加 add_links("GL") 可以正常编译

sudo apt-get install mesa-common-dev

可能的原因 glfw 没有加 gl链接吗?

https://github.com/xmake-io/xmake-repo/blob/0c965731a637a5f7fb4cab79cdb4397a302ee8d4/packages/g/glfw/xmake.lua#L35

Issues-translate-bot commented 4 months ago

Bot detected the issue body's language is not English, translate it automatically.


Title: imgui-scaffold: Using xmake to compile projects that depend on imgui lacks opengl Related header file links

Xmake version

2.8.7

Operating system version and architecture

Ubuntu22.04

Describe the problem

Newly installed ubuntu22.04, after configuring the following environment, there is a problem when compiling the example imgui-scaffold https://github.com/xmake-examples/imgui-scaffold

sudo add-apt-repository ppa:xmake-io/xmake
sudo apt-get update
sudo apt-get install g++ gdb xmake make git -y

image

Expected results

imgui-scaffold

Project configuration

https://github.com/xmake-examples/imgui-scaffold

Additional information and error logs

Currently, mesa-common-dev is installed and can be compiled normally by adding add_links("GL") to xmake.lua

sudo apt-get install mesa-common-dev

The possible reason is that glfw does not add gl link?

https://github.com/xmake-io/xmake-repo/blob/0c965731a637a5f7fb4cab79cdb4397a302ee8d4/packages/g/glfw/xmake.lua#L35

c8ef commented 4 months ago

The config in imgui-scaffold seems deprecated, maybe enable this config and try again?

Sunrisepeak commented 4 months ago

The config in imgui-scaffold seems deprecated, maybe enable this config and try again?

the glfw_opengl3 configs is kept for backwards compatibility, script auto config 'glfw' & 'opengl3' in L86 of xmake.lua

add_requires("imgui 1.88", {configs = {glfw_opengl3 = true}})

https://github.com/xmake-io/xmake-repo/blob/d2f42d97ef321be965a46359823fa8f2c8d8a30b/packages/i/imgui/xmake.lua#L86

its more of a link issue

image