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

tbox能否移植到 openwrt 上 #69

Closed
longma0008 opened this issue Nov 29, 2018 · 18 comments
Closed

tbox能否移植到 openwrt 上 #69

longma0008 opened this issue Nov 29, 2018 · 18 comments

Comments

@longma0008
Copy link

tbox移植到其它平台需要修改哪些地方,还有 xmake 的 sdk和bin选项有没有具体点的说明,我使用
xmake f --sdk=openwrt_sdk_home/ 和
xmake f --bin=tool_chain_home 都不能正常编译

@waruqi
Copy link
Member

waruqi commented Nov 29, 2018

可以的,openwrt上我跑过,只要是交叉编译都是支持的。。可以看下交叉编译的配置文档:https://xmake.io/#/zh/?id=%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91

$ xmake f -p cross --sdk=/xxx/sdk 

--sdk配置交叉工具链根目录,--bin指定gcc所在目录,--cross --bin都是按需配置,一般情况下设置--sdk就行了,其他都能自动检测到,检测不到的话,再按需配置。。

@longma0008
Copy link
Author

xmake f -p cross --sdk=/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/ -v
xmake f -p cross --bin=
/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/ -v
都是可以正常识别的

configure
{
deprecated = false
, arch = none
, info = false
, cc =/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin/mipsel-openwrt-linux-musl-gcc
, cross = mipsel-openwrt-linux-musl-
, plat = cross
, wchar = false
, float = true
, host = linux
, charset = false
, xml = false
, bin =
/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin
, exception = false
, base = true
, regex = false
, ccache = true
, buildir = build
, demo = true
, object = false
, small = true
, micro = false
, hash = false
, zip = false
, database = false
, coroutine = false
, mode = release
, kind = static
}

@waruqi
Copy link
Member

waruqi commented Nov 30, 2018

那现在是什么问题呢?如果编译不过的话 可以贴下错误信息。。xmake -v 执行 贴下详细编译

@longma0008
Copy link
Author

[ 0%]: compiling.release src/tbox/utils/base32.c
[ 0%]: compiling.release src/tbox/string/static_string.c
[ 0%]: compiling.release src/tbox/stream/stream.c
[ 0%]: compiling.release src/tbox/platform/sched.c
[ 0%]: compiling.release src/tbox/libc/stdio/wprintf.c
[ 0%]: compiling.release src/tbox/libc/string/strcat.c
[ 1%]: compiling.release src/tbox/network/impl/http/option.c
[ 1%]: compiling.release src/tbox/libc/stdio/printf.c
[ 1%]: compiling.release src/tbox/libc/stdio/puts.c
[ 1%]: compiling.release src/tbox/libm/acosf.c
[ 1%]: compiling.release src/tbox/memory/impl/static_fixed_pool.c
[ 2%]: compiling.release src/tbox/algorithm/sort.c
[ 2%]: compiling.release src/tbox/libm/cosf.c
[ 2%]: compiling.release src/tbox/utils/lock_profiler.c
[ 2%]: compiling.release src/tbox/libc/stdio/wputs.c
[ 2%]: compiling.release src/tbox/memory/default_allocator.c
[ 3%]: compiling.release src/tbox/math/int32.c
[ 3%]: compiling.release src/tbox/platform/impl/sockdata.c
[ 3%]: compiling.release src/tbox/libc/stdlib/stdlib.c
[ 3%]: compiling.release src/tbox/libc/string/strncat.c
[ 3%]: compiling.release src/tbox/platform/impl/platform.c
[ 4%]: compiling.release src/tbox/stream/transfer.c
[ 4%]: compiling.release src/tbox/platform/timer.c
[ 4%]: compiling.release src/tbox/libc/string/strdup.c
[ 4%]: compiling.release src/tbox/memory/impl/static_large_allocator.c
[ 4%]: compiling.release src/tbox/libm/exp1.c
[ 4%]: compiling.release src/tbox/platform/processor.c
[ 5%]: compiling.release src/tbox/memory/fixed_pool.c
[ 5%]: compiling.release src/tbox/network/url.c
[ 5%]: compiling.release src/tbox/network/http.c
[ 5%]: compiling.release src/tbox/libc/stdio/printf_object.c
[ 5%]: compiling.release src/tbox/algorithm/rwalk.c
[ 6%]: compiling.release src/tbox/libm/fmodf.c
[ 6%]: compiling.release src/tbox/memory/allocator.c
[ 6%]: compiling.release src/tbox/libm/atan2f.c
[ 6%]: compiling.release src/tbox/libc/string/strrstr.c
[ 6%]: compiling.release src/tbox/container/element/uint32.c
[ 7%]: compiling.release src/tbox/libc/string/wcsnrstr.c
[ 7%]: compiling.release src/tbox/libm/impl/libm.c
[ 7%]: compiling.release src/tbox/utils/base64.c
[ 7%]: compiling.release src/tbox/stream/impl/stream/data.c
[ 7%]: compiling.release src/tbox/libc/stdlib/mbstowcs.c
[ 8%]: compiling.release src/tbox/libc/stdio/snprintf.c
[ 8%]: compiling.release src/tbox/algorithm/predicate.c
[ 8%]: compiling.release src/tbox/libc/stdio/vswprintf.c
[ 8%]: compiling.release src/tbox/libm/isqrti.c
[ 8%]: compiling.release src/tbox/platform/event.c
[ 9%]: compiling.release src/tbox/container/list_entry.c
[ 9%]: compiling.release src/tbox/libc/string/memmov.c
[ 9%]: compiling.release src/tbox/platform/syserror.c
[ 9%]: compiling.release src/tbox/algorithm/find_if.c
[ 9%]: compiling.release src/tbox/libc/string/strcpy.c
[ 9%]: compiling.release src/tbox/libc/string/memmem.c
[ 10%]: compiling.release src/tbox/network/ipv6.c
[ 10%]: compiling.release src/tbox/container/list.c
[ 10%]: compiling.release src/tbox/network/impl/http/date.c
[ 10%]: compiling.release src/tbox/algorithm/count_if.c
[ 10%]: compiling.release src/tbox/container/element/long.c
[ 11%]: compiling.release src/tbox/container/element/uint8.c
[ 11%]: compiling.release src/tbox/container/element/mem.c
[ 11%]: compiling.release src/tbox/memory/string_pool.c
[ 11%]: compiling.release src/tbox/math/impl/math.c
[ 11%]: compiling.release src/tbox/libm/isnan.c
[ 12%]: compiling.release src/tbox/math/random/linear.c
[ 12%]: compiling.release src/tbox/platform/path.c
[ 12%]: compiling.release src/tbox/libc/string/wcsndup.c
[ 12%]: compiling.release src/tbox/memory/small_allocator.c
[ 12%]: compiling.release src/tbox/container/element/str.c
[ 13%]: compiling.release src/tbox/platform/page.c
[ 13%]: compiling.release src/tbox/libm/fmod.c
[ 13%]: compiling.release src/tbox/libc/string/wcsstr.c
[ 13%]: compiling.release src/tbox/libm/cos.c
[ 13%]: compiling.release src/tbox/container/element/null.c
[ 13%]: compiling.release src/tbox/stream/impl/stream/sock.c
[ 14%]: compiling.release src/tbox/libm/sincosf.c
[ 14%]: compiling.release src/tbox/libc/string/wcsnlen.c
[ 14%]: compiling.release src/tbox/libm/log2.c
[ 14%]: compiling.release src/tbox/container/array_iterator.c
[ 14%]: compiling.release src/tbox/algorithm/heap_sort.c
[ 15%]: compiling.release src/tbox/platform/semaphore.c
[ 15%]: compiling.release src/tbox/memory/impl/memory.c
[ 15%]: compiling.release src/tbox/hash/fnv32.c
[ 15%]: compiling.release src/tbox/container/element/uint16.c
[ 15%]: compiling.release src/tbox/platform/addrinfo.c
[ 16%]: compiling.release src/tbox/algorithm/quick_sort.c
[ 16%]: compiling.release src/tbox/container/queue.c
[ 16%]: compiling.release src/tbox/utils/dump.c
[ 16%]: compiling.release src/tbox/libm/sinf.c
[ 16%]: compiling.release src/tbox/libm/atanf.c
[ 17%]: compiling.release src/tbox/libm/isfin.c
[ 17%]: compiling.release src/tbox/algorithm/remove.c
[ 17%]: compiling.release src/tbox/libc/stdlib/random.c
[ 17%]: compiling.release src/tbox/libm/expif.c
[ 17%]: compiling.release src/tbox/libm/atan.c
[ 18%]: compiling.release src/tbox/libm/exp.c
[ 18%]: compiling.release src/tbox/math/fixed16.c
[ 18%]: compiling.release src/tbox/libm/tan.c
[ 18%]: compiling.release src/tbox/memory/impl/native_large_allocator.c
[ 18%]: compiling.release src/tbox/libc/impl/libc.c
[ 18%]: compiling.release src/tbox/network/ipaddr.c
[ 19%]: compiling.release src/tbox/hash/bkdr.c
[ 19%]: compiling.release src/tbox/platform/thread.c
[ 19%]: compiling.release src/tbox/container/stack.c
[ 19%]: compiling.release src/tbox/platform/mutex.c
[ 19%]: compiling.release src/tbox/string/string.c
[ 20%]: compiling.release src/tbox/memory/large_allocator.c
[ 20%]: compiling.release src/tbox/stream/static_stream.c
[ 20%]: compiling.release src/tbox/hash/adler32.c
[ 20%]: compiling.release src/tbox/platform/memory.c
[ 20%]: compiling.release src/tbox/libm/isfinf.c
[ 21%]: compiling.release src/tbox/libm/sqrtf.c
[ 21%]: compiling.release src/tbox/libm/acos.c
[ 21%]: compiling.release src/tbox/libm/exp1f.c
[ 21%]: compiling.release src/tbox/libc/string/strnlen.c
[ 21%]: compiling.release src/tbox/platform/time.c
[ 22%]: compiling.release src/tbox/libc/stdio/sprintf.c
[ 22%]: compiling.release src/tbox/libm/pow.c
[ 22%]: compiling.release src/tbox/stream/impl/filter/cache.c
[ 22%]: compiling.release src/tbox/memory/static_buffer.c
[ 22%]: compiling.release src/tbox/libc/string/strlcpy.c
[ 22%]: compiling.release src/tbox/libc/stdio/vsnprintf.c
[ 23%]: compiling.release src/tbox/libm/expi.c
[ 23%]: compiling.release src/tbox/libc/string/strnicmp.c
[ 23%]: compiling.release src/tbox/libc/string/strnstr.c
[ 23%]: compiling.release src/tbox/libc/stdlib/wcstombs.c
[ 23%]: compiling.release src/tbox/container/element/hash.c
[ 24%]: compiling.release src/tbox/libm/asin.c
[ 24%]: compiling.release src/tbox/memory/static_allocator.c
[ 24%]: compiling.release src/tbox/utils/singleton.c
[ 24%]: compiling.release src/tbox/stream/impl/stream/filter.c
[ 24%]: compiling.release src/tbox/libc/string/memcpy.c
[ 25%]: compiling.release src/tbox/libm/isinff.c
[ 25%]: compiling.release src/tbox/libc/string/strstr.c
[ 25%]: compiling.release src/tbox/libc/string/wcscmp.c
[ 25%]: compiling.release src/tbox/algorithm/binary_find_if.c
[ 25%]: compiling.release src/tbox/algorithm/find.c
[ 26%]: compiling.release src/tbox/tbox.c
[ 26%]: compiling.release src/tbox/libc/misc/time/gmtime.c
[ 26%]: compiling.release src/tbox/memory/impl/prefix.c
[ 26%]: compiling.release src/tbox/libc/string/wcscpy.c
[ 26%]: compiling.release src/tbox/libc/string/memcmp.c
[ 27%]: compiling.release src/tbox/container/priority_queue.c
[ 27%]: compiling.release src/tbox/libc/string/wcsnrchr.c
[ 27%]: compiling.release src/tbox/libc/string/strcmp.c
[ 27%]: compiling.release src/tbox/algorithm/remove_first_if.c
[ 27%]: compiling.release src/tbox/libc/string/strnirstr.c
[ 27%]: compiling.release src/tbox/libm/sincos.c
[ 28%]: compiling.release src/tbox/container/circle_queue.c
[ 28%]: compiling.release src/tbox/libc/string/strnrstr.c
[ 28%]: compiling.release src/tbox/libc/string/strirstr.c
[ 28%]: compiling.release src/tbox/network/dns/cache.c
[ 28%]: compiling.release src/tbox/libc/string/wcsichr.c
[ 29%]: compiling.release src/tbox/memory/buffer.c
[ 29%]: compiling.release src/tbox/libc/string/wcsncat.c
[ 29%]: compiling.release src/tbox/libc/string/strnistr.c
[ 29%]: compiling.release src/tbox/libc/string/wcsirchr.c
[ 29%]: compiling.release src/tbox/utils/used.c
[ 30%]: compiling.release src/tbox/libc/string/strndup.c
[ 30%]: compiling.release src/tbox/network/ipv4.c
[ 30%]: compiling.release src/tbox/stream/filter.c
[ 30%]: compiling.release src/tbox/container/element/true.c
[ 30%]: compiling.release src/tbox/algorithm/walk.c
[ 31%]: compiling.release src/tbox/libc/string/wcsicmp.c
[ 31%]: compiling.release src/tbox/libc/string/wcslen.c
[ 31%]: compiling.release src/tbox/math/random/random.c
[ 31%]: compiling.release src/tbox/libc/stdio/swprintf.c
[ 31%]: compiling.release src/tbox/libc/string/wcsnirchr.c
[ 31%]: compiling.release src/tbox/algorithm/bubble_sort.c
[ 32%]: compiling.release src/tbox/platform/ifaddrs.c
[ 32%]: compiling.release src/tbox/libc/string/wcsdup.c
[ 32%]: compiling.release src/tbox/libm/sqrt.c
error: src/tbox/platform/posix/ifaddrs.c:37:23: fatal error: net/if_dl.h: No such file or directory
compilation terminated.

linux-4.4.59

@longma0008
Copy link
Author

加入 net/if_dl.h 后,报错:
[ 31%]: compiling.release src/tbox/algorithm/bubble_sort.c
[ 32%]: compiling.release src/tbox/platform/ifaddrs.c
[ 32%]: compiling.release src/tbox/libc/string/wcsdup.c
[ 32%]: compiling.release src/tbox/libm/sqrt.c
error: src/tbox/platform/posix/ifaddrs.c:158:18: error: 'AF_LINK' undeclared (first use in this function)
case AF_LINK:

@waruqi
Copy link
Member

waruqi commented Nov 30, 2018

你这目标平台是linux,可以切到linux来交叉编译,xmake f -p linux --sdk= ....

@longma0008
Copy link
Author

xmake f -p linux --bin=~/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/ -v

configure
{
deprecated = false
, arch = x86_64
, info = false
, cc = /home/brucelau/openwrt/openwrt-hlink/staging_dir_hlink/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin/mipsel-openwrt-linux-musl-gcc
, cross = mipsel-openwrt-linux-musl-
, plat = linux
, wchar = false
, float = true
, host = linux
, charset = false
, xml = false
, bin = /home/brucelau/openwrt/openwrt-hlink/staging_dir_hlink/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin
, exception = false
, base = true
, regex = false
, ccache = true
, buildir = build
, demo = true
, object = false
, small = true
, micro = false
, hash = false
, zip = false
, database = false
, coroutine = false
, mode = release
, kind = static
}

arch = x86_64 这个不对, 是 mips 的

@waruqi
Copy link
Member

waruqi commented Nov 30, 2018

如果指定了 --sdk= --bin=等参数就是 交叉编译了。。--arch不用管,不会去用的。。当前toolchains是啥arch,就用这个arch编译。。

你直接编译下就行了,报错的话,贴下错误信息

@longma0008
Copy link
Author

好的,
[ 49%]: compiling.release src/tbox/libm/asinf.c
~/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin/mipsel-openwrt-linux-musl-gcc -c -fvisibility=hidden -Wall -Werror -Os -std=c99 -Ibuild -Ibuild/.include/tbox -D__tb_small__ -D__tb_prefix__="tbox" -I/home/brucelau/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/include -Wno-error=deprecated-declarations -fno-strict-aliasing -o build/.objs/tbox/linux/x86_64/release/src/tbox/libm/asinf.c.o src/tbox/libm/asinf.c
[ 49%]: compiling.release src/tbox/platform/socket.c
~/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin/mipsel-openwrt-linux-musl-gcc -c -fvisibility=hidden -Wall -Werror -Os -std=c99 -Ibuild -Ibuild/.include/tbox -D__tb_small__ -D__tb_prefix__="tbox" -I/home/brucelau/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/include -Wno-error=deprecated-declarations -fno-strict-aliasing -o build/.objs/tbox/linux/x86_64/release/src/tbox/platform/socket.c.o src/tbox/platform/socket.c
error: mipsel-openwrt-linux-musl-gcc: warning: environment variable 'STAGING_DIR' not defined
In file included from src/tbox/platform/posix/socket_poll.c:30:0,
from src/tbox/platform/socket.c:154:
~/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/include/sys/poll.h:1:2: error: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Werror=cpp]
#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
^
cc1: all warnings being treated as errors

@longma0008
Copy link
Author

xmake f -p linux --sdk=~/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/ -v --cflags=-Werror

再重新编译报错:

error: mipsel-openwrt-linux-musl-g++: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-musl-g++: warning: environment variable 'STAGING_DIR' not defined
build/linux/x86_64/release/libtbox.a(backtrace.c.o): In function tb_backtrace_frames.part.0': backtrace.c:(.text+0x44): undefined reference to backtrace'
build/linux/x86_64/release/libtbox.a(backtrace.c.o): In function tb_backtrace_frames': backtrace.c:(.text+0xc8): undefined reference to backtrace'
build/linux/x86_64/release/libtbox.a(backtrace.c.o): In function tb_backtrace_symbols_init': backtrace.c:(.text+0xe8): undefined reference to backtrace_symbols'
collect2: error: ld returned 1 exit status

@longma0008
Copy link
Author

详细点的日志

[ 99%]: compiling.release src/demo/memory/buffer.c
~/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin/mipsel-openwrt-linux-musl-gcc -c -Werror -fvisibility=hidden -Wall -Os -std=c99 -Ibuild -Ibuild/.include/tbox -D__tb_small__ -D__tb_prefix__="demo" -I/home/brucelau/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/include -Wno-error=deprecated-declarations -fno-strict-aliasing -o build/.objs/demo/linux/x86_64/release/src/demo/memory/buffer.c.o src/demo/memory/buffer.c
checking for the mipsel-openwrt-linux-musl-g++ ... /home/brucelau/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin/mipsel-openwrt-linux-musl-g++
checking for the linker (ld) ... mipsel-openwrt-linux-musl-g++
checking for the ~/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin/mipsel-openwrt-linux-musl-g++ ... ok
checking for the flags(mipsel-openwrt-linux-musl-g++) -Wl,-rpath=@loader_path ... ok
[100%]: linking.release demo
~/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin/mipsel-openwrt-linux-musl-g++ -o build/linux/x86_64/release/demo build/.objs/demo/linux/x86_64/release/src/demo/string/static_string.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/atomic.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/check.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/impl/date.c.o build/.objs/demo/linux/x86_64/release/src/demo/algorithm/find.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/queue_buffer.c.o build/.objs/demo/linux/x86_64/release/src/demo/utils/base64.c.o build/.objs/demo/linux/x86_64/release/src/demo/stream/stream/null.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/small_allocator.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/bloom_filter.c.o build/.objs/demo/linux/x86_64/release/src/demo/other/test.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/semaphore.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/ipv6.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/hash_set.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/whois.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/addrinfo.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/dns.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/queue.c.o build/.objs/demo/linux/x86_64/release/src/demo/libm/integer.c.o build/.objs/demo/linux/x86_64/release/src/demo/string/string.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/utils.c.o build/.objs/demo/linux/x86_64/release/src/demo/stream/stream/cache.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/heap.c.o build/.objs/demo/linux/x86_64/release/src/demo/libc/wcstombs.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/ipv4.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/process.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/hostname.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/list.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/http.c.o build/.objs/demo/linux/x86_64/release/src/demo/libc/mbstowcs.c.o build/.objs/demo/linux/x86_64/release/src/demo/utils/bits.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/directory.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/ltimer.c.o build/.objs/demo/linux/x86_64/release/src/demo/utils/url.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/cache_time.c.o build/.objs/demo/linux/x86_64/release/src/demo/libm/double.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/ping.c.o build/.objs/demo/linux/x86_64/release/src/demo/libc/time.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/string_pool.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/hwaddr.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/barrier.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/thread_local.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/thread.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/url.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/stack.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/cookies.c.o build/.objs/demo/linux/x86_64/release/src/demo/libm/float.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/atomic64.c.o build/.objs/demo/linux/x86_64/release/src/demo/math/fixed.c.o build/.objs/demo/linux/x86_64/release/src/demo/network/ipaddr.c.o build/.objs/demo/linux/x86_64/release/src/demo/libc/wchar.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/large_pool.c.o build/.objs/demo/linux/x86_64/release/src/demo/algorithm/sort.c.o build/.objs/demo/linux/x86_64/release/src/demo/stream/stream/charset.c.o build/.objs/demo/linux/x86_64/release/src/demo/stream/stream.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/fixed_pool.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/list_entry.c.o build/.objs/demo/linux/x86_64/release/src/demo/libc/stdlib.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/processor.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/memops.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/timer.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/default_allocator.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/event.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/hash_map.c.o build/.objs/demo/linux/x86_64/release/src/demo/math/random.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/ifaddrs.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/thread_pool.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/static_buffer.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/single_list_entry.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/lock.c.o build/.objs/demo/linux/x86_64/release/src/demo/stream/stream/zip.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/file.c.o build/.objs/demo/linux/x86_64/release/src/demo/libc/string.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/path.c.o build/.objs/demo/linux/x86_64/release/src/demo/demo.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/impl/static_fixed_pool.c.o build/.objs/demo/linux/x86_64/release/src/demo/utils/dump.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/backtrace.c.o build/.objs/demo/linux/x86_64/release/src/demo/utils/base32.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/single_list.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/vector.c.o build/.objs/demo/linux/x86_64/release/src/demo/container/circle_queue.c.o build/.objs/demo/linux/x86_64/release/src/demo/platform/environment.c.o build/.objs/demo/linux/x86_64/release/src/demo/memory/buffer.c.o -Lbuild/linux/x86_64/release -Wl,-rpath=$ORIGIN -s -fvisibility=hidden -L/home/brucelau/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/lib -ltbox -lpthread -ldl -lm -lc
error: mipsel-openwrt-linux-musl-g++: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-musl-g++: warning: environment variable 'STAGING_DIR' not defined
build/linux/x86_64/release/libtbox.a(backtrace.c.o): In function tb_backtrace_frames.part.0': backtrace.c:(.text+0x44): undefined reference to backtrace'
build/linux/x86_64/release/libtbox.a(backtrace.c.o): In function tb_backtrace_frames': backtrace.c:(.text+0xc8): undefined reference to backtrace'
build/linux/x86_64/release/libtbox.a(backtrace.c.o): In function tb_backtrace_symbols_init': backtrace.c:(.text+0xe8): undefined reference to backtrace_symbols'
collect2: error: ld returned 1 exit status

@waruqi
Copy link
Member

waruqi commented Nov 30, 2018

你配置的时候加个-c 强制重新检测所有支持的 api 后在编译 试试。。

xmake f -p linux --sdk=~/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-5.3.0_musl-1.1.14/ -v --cflags=-Werror -c

@longma0008
Copy link
Author

还是一样的~

@waruqi
Copy link
Member

waruqi commented Nov 30, 2018

还是不行的话 说明你这检测到了backtrace的头文件 但是链接库里面没有定义导致链接失败了 可以直接代码里面去掉相关调用就好

https://github.com/tboox/tbox/blob/master/src/tbox/platform/libc/backtrace.c

@longma0008
Copy link
Author

好的~

@waruqi
Copy link
Member

waruqi commented Nov 30, 2018

把相关TB_CONFIG_LIBC_HAVE_BACKTRACE的地方 禁用就好

@longma0008
Copy link
Author

src/tbox/platform/libc/backtrace.c 中加入

#undef TB_CONFIG_LIBC_HAVE_BACKTRACE

继续编译通过~,我再链接一下我的项目看

@longma0008
Copy link
Author

项目已经正常跑起来了,暂时没发现有其它问题。
tbox 和 xmake 项目非常不错,加油!

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

No branches or pull requests

2 participants