tboox / tbox

🎁 A glib-like multi-platform c library
https://docs.tboox.org
Apache License 2.0
4.89k stars 725 forks source link

macOS M1安装tbox报arm相关错误 #242

Closed da-liii closed 1 year ago

da-liii commented 1 year ago

注:提问题时若使用不能用/没效果/有问题/报错此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将绝对不会有任何反馈。

描述问题

Lolly的main分支依赖了tbox的dev版本,使用xmake 2.8.3会报错

$ xmake config -vD

{
    libc_wcsncasecmp = false
    cxflags = -fPIC
    libc_wcscat = false
    libm_cos = false
    ndk_stdcxx = true
    libc_setjmp = false
    regex = false
    libm_fmod = false
    kind = static
    libc_strlen = false
    posix_gethostbyname = false
    libm_atan2 = false
    database = false
    posix_regcomp = false
    posix_posix_spawnp = false
    libc_wcscasestr = false
    libc_wcsnlen = false
    posix_preadv = false
    keyword_thread = false
    posix_pipe = false
    libc_gettimeofday = false
    posix_getpagesize = false
    clean = true
    libm_sqrt = false
    posix_pthread_setaffinity_np = false
    info = false
    libc_strnlen = false
    posix_pipe2 = false
    posix_getaddrinfo = false
    posix_socket = false
    libc_strncasecmp = false
    libc_strstr = false
    posix_sysconf = false
    sqlite3 = false
    hash = true
    libm_powf = false
    plat = macosx
    libc_strchr = false
    libc_sigsetjmp = false
    posix_epoll_wait = false
    libm_acosf = false
    libm_atanf = false
    wchar = false
    posix_vfork = false
    libc_mktime = false
    ccache = true
    libc_fread = false
    posix_fork = false
    posix_utimensat = false
    posix_mkfifo = false
    posix_select = false
    posix_getifaddrs = false
    deprecated = false
    posix_gethostbyaddr = false
    libc_strcmp = false
    libm_asinf = false
    systemv_semget = false
    libc_wcscmp = false
    libm_tan = false
    posix_pthread_key_delete = false
    libc_wcsncpy = false
    posix_pthread_create = false
    libm_asin = false
    libm_sinf = false
    systemv_semtimedop = false
    libc_wcsncat = false
    libc_memcpy = false
    coroutine = false
    libc_strncmp = false
    posix_pwritev = false
    libm_sqrtf = false
    posix_pread64 = false
    libc_wcsncmp = false
    posix_pthread_mutex_init = false
    posix_pthread_getspecific = false
    libc_wcscpy = false
    libm_log2f = false
    valgrind_VALGRIND_STACK_REGISTER = false
    pcre = false
    libm_exp = false
    libc_strcasestr = false
    arch = arm64
    posix_pthread_key_create = false
    posix_fcntl = false
    libc_ungetc = false
    posix_getrlimit = false
    posix_getnameinfo = false
    posix_getdtablesize = false
    demo = false
    libc_gmtime = false
    posix_regexec = false
    libm_atan = false
    posix_sem_init = false
    host = macosx
    libc_strrchr = false
    mysql = false
    libm_pow = false
    libc_mbstowcs = false
    libc_memmove = false
    posix_waitpid = false
    posix_sendfile = false
    mode = release
    posix_opendir = false
    libc_strcpy = false
    posix_dlopen = false
    libm_sin = false
    posix_lstat64 = false
    small = true
    xml = false
    libc_wcslen = false
    libc_wcstombs = false
    zip = false
    zlib = false
    posix_fdatasync = false
    libm_tanf = false
    libm_acos = false
    micro = false
    libc_kill = false
    charset = true
    libc_localtime = false
    libm_sincosf = false
    mbedtls = false
    posix_execvpe = false
    buildir = build_bc57d9af
    exception = false
    posix_gethostname = false
    libc_memmem = false
    libc_fgets = false
    polarssl = false
    posix_execvp = false
    openssl = false
    libc_strcat = false
    libm_log2 = false
    libc_fgetc = false
    posix_futimens = false
    bsd_flock = false
    posix_open = false
    libm_fmodf = false
    libm_expf = false
    posix_stat64 = false
    keyword_thread_local = false
    posix_sched_setaffinity = false
    libc_memset = false
    force-utf8 = true
    feature_anonymous_union = true
    libc_wcslcpy = false
    libc_backtrace = false
    posix_epoll_create = false
    object = false
    libm_sincos = false
    libc_strcasecmp = false
    libc_memcmp = false
    libc_srandom = false
    libc_fputc = false
    libm_cosf = false
    libc_signal = false
    float = true
    libm_atan2f = false
    libc_strncat = false
    libc_fputs = false
    libc_random = false
    libc_wcscasecmp = false
    libc_strlcpy = false
    posix_mmap = false
    posix_posix_spawn_file_actions_addchdir_np = false
    pcre2 = false
    posix_poll = false
    libc_setlocale = false
    libc_fwrite = false
    posix_pthread_setspecific = false
    posix_pwrite64 = false
    libc_strncpy = false
    posix_readv = false
    posix_copyfile = false
    posix_writev = false
    posix_sched_yield = false
    libc_wcsstr = false
}

src/tbox/libc/string/impl/arm/strlen.c:46:9: error: invalid operand for instruction
        "   bic     r2, %1, #0x3\n"             //!< align address by 4-bytes
        ^
<inline asm>:1:13: note: instantiated into assembly here
           bic     r2, x0, #0x3
                   ^
In file included from src/tbox/libc/string/strlen.c:32:
src/tbox/libc/string/impl/arm/strlen.c:47:10: error: invalid operand for instruction
        "   ldr     r3, [r2], #4\n"             //!< get the first dword after alignment
         ^
<inline asm>:2:12: note: instantiated into assembly here
   ldr     r3, [r2], #4
           ^
In file included from src/tbox/libc/string/strlen.c:32:
src/tbox/libc/string/impl/arm/strlen.c:49:10: error: unrecognized instruction mnemonic, did you mean: b, dsb, esb, isb, ldrsb, mrs, sb, sbc, sub, tsb?
        "   rsb     %0, %1, #0x0\n"             //!< n = -left
         ^
<inline asm>:4:4: note: instantiated into assembly here
   rsb     x8, x0, #0x0
   ^

期待的结果

正确编译

错误信息

如上所示

相关环境

macOS M1 13.1

其他信息

Issues-translate-bot commented 1 year ago

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


Title: macOS M1 installs tbox and reports arm related errors

da-liii commented 1 year ago

目测和 https://github.com/xmake-io/xmake/discussions/4252 是同一个问题

Issues-translate-bot commented 1 year ago

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


Visual inspection and https://github.com/xmake-io/xmake/discussions/4252 are the same problem

waruqi commented 1 year ago

目测和 xmake-io/xmake#4252 是同一个问题

那就用 xmake/dev 版本

Issues-translate-bot commented 1 year ago

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


Visual inspection is the same problem as xmake-io/xmake#4252

Then use the xmake/dev version

da-liii commented 1 year ago

使用xmake的dev分支之后,已经可以了

Issues-translate-bot commented 1 year ago

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


After using the dev branch of xmake, it is already possible