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

工程多模块构建失败 #4786

Closed
rooong opened this issue Mar 1, 2024 · 19 comments
Closed

工程多模块构建失败 #4786

rooong opened this issue Mar 1, 2024 · 19 comments
Labels

Comments

@rooong
Copy link

rooong commented Mar 1, 2024

Xmake 版本

2.8.6

操作系统版本和架构

windows 7

描述问题

vs2013,工程多模块构建失败,单个模块独立构建是正常的。报错如下:
image
详细log看附件

期待的结果

正常构建

工程配置

工程多模块构建
在xmake.lua中includes多个模块

附加信息和错误日志

log.txt

@rooong rooong added the bug label Mar 1, 2024
@Issues-translate-bot
Copy link

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


Title: Project multi-module build failed

Xmake version

2.8.6

Operating system version and architecture

Windows 7

Describe the problem

In vs2013, the multi-module construction of the project failed. It is normal for a single module to be built independently. The error is reported as follows:
image
See attachment for detailed log

Expected results

Build normally

Project configuration

Engineering multi-module construction
Include multiple modules in xmake.lua

Additional information and error logs

log.txt

@waruqi
Copy link
Member

waruqi commented Mar 1, 2024

XBLog.dll 你没导出任何符号,所以没有自动生成 XBLog.lib ,not found了。。跟 xmake 没啥关系。。你自己导出下符号

@Issues-translate-bot
Copy link

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


You did not export any symbols for XBLog.dll, so XBLog.lib was not automatically generated and was not found. . It has nothing to do with xmake. . Export the symbols yourself

@rooong
Copy link
Author

rooong commented Mar 1, 2024

首先有导出符号,其次,单独构建模块时:xmake -r XBLog,是可以正常构建的,也有自动生成XBLog.lib

@Issues-translate-bot
Copy link

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


First, there are exported symbols. Secondly, when building the module separately: xmake -r XBLog can be built normally, and XBLog.lib is also automatically generated.

@rooong
Copy link
Author

rooong commented Mar 1, 2024

单独构建XBLog日志
log2.txt

@Issues-translate-bot
Copy link

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


Build XBLog logs separately
log2.txt

@waruqi
Copy link
Member

waruqi commented Mar 1, 2024

首先有导出符号,其次,单独构建模块时:xmake -r XBLog,是可以正常构建的,也有自动生成XBLog.lib

多模块下,XBLog 也构建成功的,跟是否单独没关系,目前看日志,多模块下,就是没有找到 XBLog.lib

你可以看下就没有生成,如果生成了 XBLog.dll 但是没生成 XBLog.lib 。。那就是没有导出符号。。

@Issues-translate-bot
Copy link

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


First, there are exported symbols. Secondly, when building the module separately: xmake -r XBLog can be built normally, and XBLog.lib is also automatically generated.

Under multi-module, XBLog is also built successfully. It has nothing to do with whether it is alone. Looking at the logs, under multi-module, XBLog.lib is not found.

You can check if it is not generated. If XBLog.dll is generated but XBLog.lib is not generated. . That means no symbols are exported. .

@rooong
Copy link
Author

rooong commented Mar 1, 2024

首先有导出符号,其次,单独构建模块时:xmake -r XBLog,是可以正常构建的,也有自动生成XBLog.lib

多模块下,XBLog 也构建成功的,跟是否单独没关系,目前看日志,多模块下,就是没有找到 XBLog.lib

你可以看下就没有生成,如果生成了 XBLog.dll 但是没生成 XBLog.lib 。。那就是没有导出符号。。

多模块下,XBLog.lib有生成,XBLog.dll也有文件,但未成功,PS:XBLog.dll不是成功编译好的文件大小

@Issues-translate-bot
Copy link

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


First, there are exported symbols. Secondly, when building the module separately: xmake -r XBLog can be built normally, and XBLog.lib is also automatically generated.

Under multi-module, XBLog is also built successfully. It has nothing to do with whether it is alone. Looking at the logs, XBLog.lib is not found under multi-module.

You can check if it is not generated. If XBLog.dll is generated but XBLog.lib is not generated. . That means no symbols are exported. .

Under multi-module, XBLog.lib is generated, and XBLog.dll file is also generated, but it is not successful. PS: XBLog.dll is not the size of the successfully compiled file.

@waruqi
Copy link
Member

waruqi commented Mar 1, 2024

贴下 xmake.lua 或者给下完整可复现的 example

@Issues-translate-bot
Copy link

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


Paste xmake.lua or provide a complete and reproducible example.

@rooong
Copy link
Author

rooong commented Mar 1, 2024

找到问题了,是另外一个模块xb_breakpad依赖XBLog,需要引用,脚本中没写依赖,导致编译失败。
但是目前给的log,很难明了的知道问题点。而且遇到了这个问题,.xmake需要删掉重新编译,不然再次重新编译,链接时会报另外一个错误:
linker.lua:33: cannot get program for ar
也非常不友好,搞不明白实际的问题点

@Issues-translate-bot
Copy link

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


I found the problem. It is that another module xb_breakpad depends on XBLog and needs to be referenced. The dependency is not written in the script, causing the compilation to fail.
But with the log provided so far, it’s difficult to clearly understand the problem. And if you encounter this kind of problem, .xmake needs to be deleted and recompiled, otherwise another error will be reported during linking:
linker.lua:33: cannot get program for ar
They are also very unfriendly and cannot understand the actual problem.

@rooong rooong closed this as completed Mar 1, 2024
@rooong rooong reopened this Mar 1, 2024
@rooong
Copy link
Author

rooong commented Mar 1, 2024

希望报错可以更精准些,哪个模块出的问题,可以清晰描述出来,这样更容易找问题

@Issues-translate-bot
Copy link

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


I hope that the error reporting can be more accurate, and which module has the problem can be clearly described, so that it will be easier to find the problem.

@waruqi
Copy link
Member

waruqi commented Mar 1, 2024

其实我已经猜到是这个问题,所以刚问你要 xmake.lua 只是想确认下。。用户没有添加依赖关系,xmake 也不可能猜出来他们之间需要有依赖(xmake 是无法预判用户需求的),给出准确的依赖错误。。这种只能自己根据 xmake.lua 和链接器报错,自己分析。。

@waruqi waruqi closed this as completed Mar 1, 2024
@Issues-translate-bot
Copy link

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


In fact, I have already guessed that this is the problem, so I just asked you for xmake.lua just to confirm. . The user has not added dependencies, and it is impossible for xmake to guess that there are dependencies between them (xmake cannot predict user needs) and give accurate dependency errors. . This can only be analyzed by yourself based on the error reported by xmake.lua and the linker. .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants