Skip to content

configure 脚本无法构建 .so 动态库,但 xmake f -k shared 可以 #214

Closed
@mochaaP

Description

@mochaaP

描述问题

https://github.com/tboox/tbox/blob/master/src/tbox/xmake.sh?plain=1#L4

static 改为 shared 后:

linking.release build/linux/x86_64/release/libtbox.so
/usr/bin/ld: build/.objs/tbox/linux/x86_64/release/src/tbox/math/fixed16.c.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [makefile:46: build/linux/x86_64/release/libtbox.so] Error 1

期待的结果

xmake f -k shared && xmake b 相同:

[ 99%]: linking.release libtbox.so
[100%]: build ok, spent 4.317s

相关环境

gcc (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4)
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU ld version 2.40-9.fc39
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

其他信息

请提供其他附加信息帮助我们诊断问题。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions