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

链接错误是否能输出详细内容? #150

Closed
xigalto opened this Issue Nov 10, 2017 · 8 comments

Comments

Projects
None yet
2 participants
@xigalto
Contributor

xigalto commented Nov 10, 2017

如题,我在编译ssl的时候,编译都是正常的,但是链接的时候报错,直接返回-1,没有任何其他有用的错误信息了,这个是本来就没有还是没输出?

@waruqi

This comment has been minimized.

Member

waruqi commented Nov 10, 2017

链接错误 是有信息的,能否先详细描述下 你这边的环境(操作系统,构建平台等),以及执行过程和输出,可以加上 -v --backtrace执行下,将详细输出帖我看下:

$ xmake f -c  -v 。。。一些其他配置
$ xmake -r -v
@xigalto

This comment has been minimized.

Contributor

xigalto commented Nov 10, 2017

....o是o文件,太长了我删掉省略了
xmake -v --backtrace
configure
{
ccache = true
, ndk = e:\软件\android-ndk-r14b
, toolchains_ver = 4.9
, plat = android
, ar = E:\软件\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ar
, buildir = build
, toolchains = E:\软件\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin
, ndk_sdkver = 24
, arch = armv7-a
, mode = release
, cc = E:\软件\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-gcc
, cross = arm-linux-androideabi-
, sh = E:\软件\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-g++
, kind = static
, clean = true
, host = windows
, ld = E:\软件\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-g++
, cxx = E:\软件\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-g++
}

[50%]: archiving.release libieoassistant_static.a
E:\软件\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ar -cr bin\armv7-a\libieoassistant_static.a .....o
error: C:\Program Files (x86)\xmake/core/base/os.lua:660: C:\Program Files (x86)\xmake/core/base/os.lua:660: C:\Program Files (x86)\xmake/core/base/os.lua:660: runv(E:\软件\android-ndk-r14b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ar -cr bin\armv7-a\libieoassistant_static.a ....o
stack traceback:
[C]: in function 'error'
[C:\Program Files (x86)\xmake/core/base/os.lua:660]: in function 'raise'
[C:\Program Files (x86)\xmake\core\sandbox\modules\os.lua:271]: in function 'runv'
[C:\Program Files (x86)\xmake\modules\core\tools\ar.lua:72]:
[C]: in function 'link'
[C:\Program Files (x86)\xmake\actions\build\kinds\static.lua:133]: in function '_build_from_objects'
[C:\Program Files (x86)\xmake\actions\build\kinds\static.lua:188]: in function 'build'
[C:\Program Files (x86)\xmake\actions\build\builder.lua:44]: in function 'script'
[C:\Program Files (x86)\xmake\actions\build\builder.lua:68]: in function '_build_target'
[C:\Program Files (x86)\xmake\actions\build\builder.lua:90]: in function '_build_target_and_deps'
[C:\Program Files (x86)\xmake\actions\build\builder.lua:168]: in function 'build'
[C:\Program Files (x86)\xmake\actions\build\main.lua:53]:
[C]: in function 'xpcall'
[C:\Program Files (x86)\xmake\core\sandbox\modules\try.lua:99]: in function 'try'
[C:\Program Files (x86)\xmake\actions\build\main.lua:51]:
[C]: in function 'load'
[C:\Program Files (x86)\xmake/core/base/task.lua:435]: in function 'run'
[C:\Program Files (x86)\xmake/core/main.lua:237]:

stack traceback:
[C]: in function 'error'
[C:\Program Files (x86)\xmake/core/base/os.lua:660]: in function 'raise'
[C:\Program Files (x86)\xmake/core/sandbox/modules/utils.lua:166]: in function 'assert'
[C:\Program Files (x86)\xmake\actions\build\kinds\static.lua:133]: in function '_build_from_objects'
[C:\Program Files (x86)\xmake\actions\build\kinds\static.lua:188]: in function 'build'
[C:\Program Files (x86)\xmake\actions\build\builder.lua:44]: in function 'script'
[C:\Program Files (x86)\xmake\actions\build\builder.lua:68]: in function '_build_target'
[C:\Program Files (x86)\xmake\actions\build\builder.lua:90]: in function '_build_target_and_deps'
[C:\Program Files (x86)\xmake\actions\build\builder.lua:168]: in function 'build'
[C:\Program Files (x86)\xmake\actions\build\main.lua:53]:

stack traceback:
[C]: in function 'error'
[C:\Program Files (x86)\xmake/core/base/os.lua:660]: in function 'raise'
[C:\Program Files (x86)\xmake\actions\build\main.lua:62]: in function 'catch'
[C:\Program Files (x86)\xmake\core\sandbox\modules\try.lua:104]: in function 'try'
[C:\Program Files (x86)\xmake\actions\build\main.lua:51]:
[C]: in function 'load'
[C:\Program Files (x86)\xmake/core/base/task.lua:435]: in function 'run'
[C:\Program Files (x86)\xmake/core/main.lua:237]:

xmake f -c -v
checking for the architecture ... x86
checking for the cl.exe ... cl.exe
checking for the Microsoft Visual Studio (x86) version ... 2015
configure
{
arch = x86
, ccache = true
, mode = release
, plat = windows
, kind = static
, buildir = build
, vs = 2015
, host = windows
, clean = true
}

@waruqi

This comment has been minimized.

Member

waruqi commented Nov 10, 2017

应该是ar生成lib库的时候失败了,ar的失败 不像linker链接失败,本身就没多少错误信息的

....o是o文件,太长了我删掉省略了

根据你的描述,我大概知道什么原因了,应该是cmd下,单条执行命令太长了(.o太多),导致的执行失败。。关于这个issues,可以参考:command-prompt-cmd--exe-command-line-string-limitation

关于这个的解决办法,其实在用msvc编译链接的时候,我也遇到过此问题,并且做了处理,但是对于ar,一直没考虑到 也有可能在cmd下执行的(ndk on windows),所以没去处理。。

我一会修复下之后,你再试试。。稍等。。

@waruqi

This comment has been minimized.

Member

waruqi commented Nov 10, 2017

你试试吧这个文件,覆盖你这边xmake安装目录下对应的文件:xmake/modules/core/tools/ar.lua

然后再执行下编译试试,我这边没有环境,暂时没法验证测试。。

@xigalto

This comment has been minimized.

Contributor

xigalto commented Nov 10, 2017

刚没看见,我回家试下,这个不只是生成android的时候会出现,我试过windows的一样会报链接错误的。

使用xmake -r -v能看到最终的链接错误信息

@waruqi

This comment has been minimized.

Member

waruqi commented Nov 10, 2017

那在msvc下 是报什么链接错误呢。。? 我觉得 windows下那个 链接错误。。跟你现在android的 ar 错误其实是两个问题。。(win的有错误信息的链接错误,应该是后期链接时候,库中缺了某些符号没编译进去导致。。)

而现在的ar错误,实际还没到链接过程了,仅仅在生成lib的时候就出错了,你可以先merge下我刚发的ar.lua脚本。。看看ar过程是否能过掉。。有可能ar生成lib库通过后,执行到实际链接的时候,还会有你刚说的win链接错误。。

@xigalto

This comment has been minimized.

Contributor

xigalto commented Nov 13, 2017

用了你发的这个ar.lua可以显示正常的链接错误了,的确是win下面也会出现这个错误:)。

@xigalto xigalto closed this Nov 13, 2017

@waruqi

This comment has been minimized.

Member

waruqi commented Nov 16, 2017

我更新了下 安装包,修复了上面说的ar问题,并且改进了mingw下的编译问题。

你可以试试:xmake-v2.1.9-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment