? A glib-like multi-platform c library

A glib-like cross-platform C library

Supporting the project

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. ? [Become a sponsor]

Introduction (中文)

TBOX is a glib-like cross-platform C library that is simple to use yet powerful in nature.

The project focuses on making C development easier and provides many modules (.e.g stream, coroutine, regex, container, algorithm ...), so that any developer can quickly pick it up and enjoy the productivity boost when developing in C language.

It supports the following platforms: Windows, Macosx, Linux, Android, iOS, *BSD and etc.

And it provides many compiling options using xmake:

  • Release: Disable debug information, assertion, memory checking and enable optimization.
  • Debug: Enable debug information, assertion, memory checking and disable optimization.
  • Small: Disable all extensional modules and enable space optimization.
  • Micro: compiling micro library (~64K) for the embed system.

If you want to know more, please refer to: Documents, Github and Gitee

Features

The stream library

  • Supports file, data, http and socket source
  • Supports the stream filter for gzip, charset and...
  • Implements stream transfer
  • Implements the static buffer stream for parsing data
  • Supports coroutine and implements asynchronous operation

The coroutine library

  • Provides high-performance coroutine switch
  • Supports arm, arm64, x86, x86_64 ..
  • Provides channel interfaces
  • Provides semaphore and lock interfaces
  • Supports io socket and stream operation in coroutine
  • Provides some io servers (http ..) using coroutine
  • Provides stackfull and stackless coroutines
  • Support epoll, kqueue, poll, select and IOCP
  • Support to wait pipe, socket and process in coroutine and poller at same time

The database library

  • Supports mysql and sqlite3 database and enumerates data using the iterator mode

The xml parser library

  • Supports DOM and SAX mode and Supports xpath

The serialization and deserialization library

  • Supports xml, json, bplist, xplist, binary formats

The memory library

  • Implements some memory pools for optimizing memory
  • Supports fast memory error detecting. it can detect the following types of bugs for the debug mode:
    • out-of-bounds accesses to heap and globals
    • use-after-free
    • double-free, invalid free
    • memory leaks

The container library

  • Implements hash table, single list, double list, vector, stack, queue and min/max heap. Supports iterator mode for algorithm

The algorithm library

  • Uses the iterator mode
  • Implements find, binary find and reverse find algorithm
  • Implements sort, bubble sort, quick sort, heap sort and insert sort algorithm
  • Implements count, walk items, reverse walk items, for_all and rfor_all

The network library

  • Implements dns(cached)
  • Implements ssl(openssl, polarssl, mbedtls)
  • Implements http
  • Implements cookies
  • Supports ipv4, ipv6
  • Supports coroutine

The platform library

  • Implements timer, fast and low precision timer
  • Implements atomic and atomic64 operation
  • Implements spinlock, mutex, event, semaphore, thread and thread pool
  • Implements file, socket operation
  • Implements poller using epoll, poll, select, kqueue ...
  • Implements switch context interfaces for coroutine

The charset library

  • Supports utf8, utf16, gbk, gb2312, uc2 and uc4
  • Supports big endian and little endian mode

The zip library

  • Supports gzip, zlibraw, zlib formats using the zlib library if exists
  • Implements lzsw, lz77 and rlc algorithm

The utils library

  • Implements base32, base64 encoder and decoder
  • Implements assert and trace output for the debug mode
  • Implements bits operation for parsing u8, u16, u32, u64 data

The math library

  • Implements random generator
  • Implements fast fixed-point calculation, Supports 6-bits, 16-bits, 30-bits fixed-point number

The libc library

  • Implements lightweight libc library interfaces, the interface name contains tb_xxx prefix for avoiding conflict
  • Implements strixxx strrxxx wcsixxx wcsrxxx interface extension
  • Optimizes some frequently-used interface, .e.g. memset, memcpy, strcpy ...
  • Implements memset_u16, memset_u32, memset_u64 extension interfaces

The libm library

  • Implements lightweight libm library interfaces, the interface name contains tb_xxx prefix for avoiding conflict
  • Supports float and double type

The regex library

  • Supports match and replace
  • Supports global/multiline/caseless mode
  • Uses pcre, pcre2 and posix regex modules

The hash library

  • Implements crc32, adler32, md5 and sha1 hash algorithm
  • Implements some string hash algorithms (.e.g bkdr, fnv32, fnv64, sdbm, djb2, rshash, aphash ...)
  • Implements uuid generator

Projects

Some projects using tbox:

Build

Please install xmake first: xmake

# build for the host platform
$ cd ./tbox
$ xmake

# build for the mingw platform
$ cd ./tbox
$ xmake f -p mingw --sdk=/home/mingwsdk
$ xmake

# build for the iphoneos platform
$ cd ./tbox
$ xmake f -p iphoneos
$ xmake

# build for the android platform
$ cd ./tbox
$ xmake f -p android --ndk=xxxxx
$ xmake

# build for the linux cross-platform
$ cd ./tbox
$ xmake f -p linux --sdk=/home/sdk # --bin=/home/sdk/bin
$ xmake

Example

#include "tbox/tbox.h"

int main(int argc, char** argv)
{
    // init tbox
    if (!tb_init(tb_null, tb_null)) return 0;

    // trace
    tb_trace_i("hello tbox");

    // init vector
    tb_vector_ref_t vector = tb_vector_init(0, tb_element_str(tb_true));
    if (vector)
    {
        // insert item
        tb_vector_insert_tail(vector, "hello");
        tb_vector_insert_tail(vector, "tbox");

        // dump all items
        tb_for_all (tb_char_t const*, cstr, vector)
        {
            // trace
            tb_trace_i("%s", cstr);
        }

        // exit vector
        tb_vector_exit(vector);
    }

    // init stream
    tb_stream_ref_t stream = tb_stream_init_from_url("http://www.xxx.com/file.txt");
    if (stream)
    {
        // open stream
        if (tb_stream_open(stream))
        {
            // read line
            tb_long_t size = 0;
            tb_char_t line[TB_STREAM_BLOCK_MAXN];
            while ((size = tb_stream_bread_line(stream, line, sizeof(line))) >= 0)
            {
                // trace
                tb_trace_i("line: %s", line);
            }
        }

        // exit stream
        tb_stream_exit(stream);
    }

    // wait
    tb_getchar();

    // exit tbox
    tb_exit();
    return 0;
}

Technical Support

We also provide paid technical support to help users quickly solve related problems. For details, please click the image link below:

Or you can also consider sponsoring us to get technical support services, [Become a sponsor]

Contacts

Owner
TBOOX
?Focus on cross-platform development using c language
TBOOX
Comments
  • Thread Local Storage for iOS target below 9.0 issue

    Thread Local Storage for iOS target below 9.0 issue

    __thread 在iOS8上,SDK: Xcode 12.2,还是不支持.iOS9下是i386的模拟器不支持.可能需要重新考虑下方案了😂

    xmake f --hash=y --zip=y --coroutine=y --exception=y --object=y --xml=y --charset=y -p iphoneos -a armv7 --target_minver=8 --cxflags="-fembed-bitcode " --mxflags="-fembed-bitcode" --asflags="-fembed-bitcode"
    xmake p tbox
    
    error: src/tbox/coroutine/stackless/scheduler.c:59:8: error: thread-local storage is not supported for the current target
    
  • tbox 在向某款嵌入式linux平台移植,进行配置时报错

    tbox 在向某款嵌入式linux平台移植,进行配置时报错

    描述问题

    tbox工程移植嵌入式平台时,按照文档中进行配置时,报错。 tbox 版本信息: c log.txt ommit 0cdb41ee2f944466e4d69219922f2feb5b761514 (HEAD -> master, origin/master, origin/HEAD) Author: ruki [email protected] Date: Sat Aug 17 00:48:37 2019 +0800

    set process private data
    

    执行命令:xmake f -p cross --sdk=/home/esuny/soft/arm-2009q3/ --bin=/home/esuny/soft/arm-2009q3/bin --cross=arm-none-linux-gnueabi- -v -D

    错误信息

    见附件

    相关环境

    os: ubuntu-18.04 cross-tool: arm-none-linux-gnueabi-gcc -v Using built-in specs. Target: arm-none-linux-gnueabi Configured with: /scratch/julian/2009q3-respin-linux-lite/src/gcc-4.4/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-arch=armv5te --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=|ffreestanding|nostdlib:;:-funwind-tables} %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --enable-shared --disable-lto --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q3-67' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-ppl=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin Thread model: posix gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67)

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

  • 编译出错   right shift count >= width of type

    编译出错 right shift count >= width of type

    mingw 64bit

    MINGW64_NT-10.0-17134 XXX 3.0.7-338.x86_64 2019-07-11 10:58 UTC x86_64 Msys

    • xmake.exe f -p mingw
    • xmake.exe build
    error: src\tbox\memory\../utils/bits.h:639:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
      639 |     p[4] = (tb_byte_t)(x >> 32);
          |                          ^~
    src\tbox\memory\../utils/bits.h:640:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
      640 |     p[5] = (tb_byte_t)(x >> 40);
          |                          ^~
    src\tbox\memory\../utils/bits.h:641:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
      641 |     p[6] = (tb_byte_t)(x >> 48);
          |                          ^~
    src\tbox\memory\../utils/bits.h:642:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
      642 |     p[7] = (tb_byte_t)(x >> 56);
          |                          ^~
    src\tbox\memory\../utils/bits.h: In function 'tb_bits_set_u64_be_inline':
    src\tbox\memory\../utils/bits.h:646:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
      646 |     p[0] = (tb_byte_t)(x >> 56);
          |                          ^~
    src\tbox\memory\../utils/bits.h:647:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
    

    根据 x >> 32 断定 tb_uint64_t == ulong

    #if defined(TB_COMPILER_IS_MSVC)
    typedef __int64                     tb_int64_t;
    typedef unsigned __int64            tb_uint64_t;
    #elif (TB_CPU_BITSIZE == 64)
    typedef signed long                 tb_int64_t;
    typedef unsigned long               tb_uint64_t;
    #else
    typedef signed long long            tb_int64_t;
    typedef unsigned long long          tb_uint64_t;
    #endif
    

    在本机上 sizeof(ulong) == 4

    至少在本机上 TB_CPU_BITSIZE 并不能作为 long 宽度的判断方法

  • 项目使用xmake依赖tbox,安装的时候会出现错误

    项目使用xmake依赖tbox,安装的时候会出现错误

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

    描述问题

    项目使用xmake依赖tbox,安装的时候会出现错误

    期待的结果

    应该能安装成功

    错误信息

    运行错误信息:

    ` Executing task: xmake f -p mingw -a x86 -m release -o "d:\git\gcctest/build" < checking for mingw directory ... D:\i686-8.1.0-win32-dwarf-rt_v6-rev0\mingw32 note: try installing these packages (pass -y to skip confirm)? in xmake-repo: -> mbedtls 2.13.0 -> zlib 1.2.11 -> tbox v1.6.6 [charset:y, coroutine:y, object:y, zlib:y, hash:y, mbedtls:y, zip:y, xml:y, regex:y] please input: y (y/n)

    => download https://github.com/madler/zlib/archive/v1.2.11.tar.gz .. ok => install zlib 1.2.11 .. ok => download https://github.com/tboox/tbox/archive/v1.6.6.tar.gz .. ok => download https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.13.0.zip .. ok package(mbedtls) is being accessed by other processes, please waiting! => install mbedtls 2.13.0 .. ok => install tbox v1.6.6 .. failed if you want to get verbose errors, please see: -> C:\Users\CY\AppData\Local.xmake\cache\packages\2101\t\tbox\v1.6.6\installdir.failed\logs\install.txt error: install failed! `

    install.txt 文件内容

    assertion failed!

    相关环境

    我使用的是mingw编译

    经过测试 使用默认本机的windows vs2019 也编译不通过 install.txt 内容一样

    其他信息

  • linux交叉编译出错

    linux交叉编译出错

    打算将tbox交叉编译到一个armv7-a平台,通过以下指令进行配置: xmake f -p linux --sdk=/home/lzb/ql-ol-sdk/ql-ol-crosstool/sysroots/x86_64-oesdk-linux/usr --bin=/home/lzb/ql-ol-sdk/ql-ol-crosstool/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi -a armv7-a -vD 最后的错误信息如下:

    checkinfo: ...amdir/core/sandbox/modules/import/core/tool/compiler.lua:88: @programdir/modules/core/tools/gcc.lua:466: In file included from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/platform.h:42:0,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/prefix.h:33,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/xml.h:28,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/tbox.h:29,
                     from /dev/shm/.xmake1000/200407/_2D8E3EFF80704C208C042254E4DF4860.c:2:
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h: In function 'tb_atomic_flag_test_and_set_explicit_generic':
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h:289:22: error: size of array '__tb_static_assert__' is negative
         tb_assert_static(sizeof(tb_atomic_flag_t) == sizeof(tb_atomic32_t));
                          ^
    In file included from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/platform.h:42:0,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/prefix.h:33,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/xml.h:28,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/tbox.h:29,
                     from /dev/shm/.xmake1000/200407/_2D8E3EFF80704C208C042254E4DF4860.c:2:
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h: In function 'tb_atomic_flag_test_explicit_generic':
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h:298:22: error: size of array '__tb_static_assert__' is negative
         tb_assert_static(sizeof(tb_atomic_flag_t) == sizeof(tb_atomic32_t));
                          ^
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h: In function 'tb_atomic_flag_clear_explicit_generic':
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h:307:22: error: size of array '__tb_static_assert__' is negative
         tb_assert_static(sizeof(tb_atomic_flag_t) == sizeof(tb_atomic32_t));
    

    看提示是tb_atomic_flag_t和tb_atomic32_t长度不匹配,也就是arm是64bit的。

    #if __tb_has_feature__(c_atomic) && !defined(__STDC_NO_ATOMICS__)
    #   include "libc/atomic.h"
    #elif defined(TB_COMPILER_IS_GCC) \
            && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
    #   include "compiler/gcc/atomic.h"
    #elif defined(TB_CONFIG_OS_WINDOWS)
    #   include "windows/atomic.h"
    #endif
    

    看了一下上面相关代码,应该就是这些include都没用到,最后要这个内联通用函数,但是这个函数也就只是32bit,导致出问题了。

  • ubuntu编译tbox cortoutine模块问题

    ubuntu编译tbox cortoutine模块问题

    @waruqi 在ubuntu下编译tbox启用coroutine时编译出错: [ 0%]: compiling.debug src/tbox/platform/arch/context.S error: cc1: 错误: unrecognized command line option ‘-fcolor-diagnostics’ 请问该怎么处理呢?

  • 协程间 跨线程通信的一个问题

    协程间 跨线程通信的一个问题

    想利用多个核功能. 所以有多个线程.

    为了描述简单, 假设有两个线程,记为: A, B. 各有一个调度器. 记为: a_scheduler 和b_scheduler.

    A 负责从tcp服务器收数据,解码转为消息,交给线程B处理. (通过一个queue通信,有lock,和条件变量 cond) B 负责处理消息, 以及其它一些事情(比如定时输出系统状态等)

    问题是: B 和如何等待 A的消息 ? 代码如下:

    //A线程
    void A()
    {
        //...
        tb_coroutine_start(b_scheduler,a_recv_tcp_data,tb_null,0);
        tb_co_scheduler_loop(a_scheduler, , tb_true);
    }
    
    //A线程中的, 收数据协程.
    void a_recv_tcp_data(tb_cpointer_t priv)
    {
        while(1){
            data = recv_from_tcp();
            msg = decode(data);
    
            lock(); //线程锁
            queue.enqueue(msg); //放入队列.
            cond.wake_up();  // 通知执行.
            unlock();//线程锁
        }
    
    }
    
    
    
    void do_show_tick(tb_cpointer_t priv)
    {
        while(1)
        {
            tb_trace_i("tick...");
            tb_coroutine_sleep(10*1000);
        }
    
    }
    
    //问题就是这个函数该怎么写, 
    //版本1:cond.wait 会导致线程B被挂起.
    //tick, do_show_tick 不会被执行.
    
    void do_handle_msg(tb_cpointer_t priv)
    {
        lock();
        int cdn = queue.size(); 
        while(cdn == 0){
            cond.wait();
            cdn = queue.size();
        }
        unlock();
        //...
    }
    
    //版本 2. 
    //如果这样的话, do_handle_msg 是不是会被一直调用. 就像忙查一样? 
    
    void do_handle_msg(tb_cpointer_t priv)
    {
        while(1) {
            lock();
            int cdn = queue.size(); 
            unlock();
            if(cdn == 0){
                tb_coroutine_yield();//....
            }else{
                ..... //handle msg
           }
            
        }
        //...
    }
    
    void B()
    {
        ...
        tb_coroutine_start(b_scheduler,do_show_tick,tb_null,0);
        tb_co_scheduler_loop(b_scheduler, tb_true);
    }
    
  • 关于demo的sleep.c请教

    关于demo的sleep.c请教

    你好,大牛,tbox的demo源码的sleep.c执行后开始打印了:

     [demo]: [coroutine: 10]: count: 9, interval: 10 ms
     [demo]: [coroutine: 1000]: count: 9, interval: 10 ms
     [demo]: [coroutine: 2000]: count: 9, interval: 10 ms
     [demo]: [coroutine: 100]: count: 9, interval: 10 ms
     ...
    

    我刚开始接触协程请见谅,有个地方想不通:按我的理解遇到 tb_msleep 后协程切出去了,10 ms超时后其它的协程(100, 1000, 2000 )应该不会执行啊,不应该是 tb_msleep 到时间后才会往后走麽?

  • Windows/MinGW compile errors

    Windows/MinGW compile errors

    Compiling tbox 1.6.3 on Windows with MinGW (GCC 7.3.0) via:

    xmake f -p mingw --cflags=-Wno-error=unknown-pragmas
    xmake
    ...
    [23%]: compiling.release src\tbox\libm\tanf.c
    [23%]: compiling.release src\tbox\libm\atan.c
    [23%]: compiling.release src\tbox\libc\string\strcat.c
    error: src\tbox\platform\windows\iocp_object.c:456:85: error: 'FILE_SKIP_COMPLETION_PORT_ON_SUCCESS' undeclared (first use in this function); did you mean 'IO_COMPLETION_ALL_ACCESS'?
                 if (tb_kernel32()->SetFileCompletionNotificationModes((HANDLE)clientfd, FILE_SKIP_COMPLETION_PORT_ON_SUCCESS))
                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                         IO_COMPLETION_ALL_ACCESS
    src\tbox\platform\windows\iocp_object.c:456:85: note: each undeclared identifier is reported only once for each function it appears in
    src\tbox\platform\windows\iocp_object.c: In function 'tb_iocp_object_connect':
    src\tbox\platform\windows\iocp_object.c:544:117: error: 'FILE_SKIP_COMPLETION_PORT_ON_SUCCESS' undeclared (first use in this function); did you mean 'IO_COMPLETION_ALL_ACCESS'?
                         if (tb_kernel32()->SetFileCompletionNotificationModes((HANDLE)(SOCKET)tb_sock2fd(object->sock), FILE_SKIP_COMPLETION_PORT_ON_SUCCESS))
                                                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                                         IO_COMPLETION_ALL_ACCESS
    
    

    Visual Studio 2015 compiles fine but that's not what i am looking for. Anything i missed? Thanks!

  • Memory leak on demo asio_httpd

    Memory leak on demo asio_httpd

    Hello ! I just cloned tbox and build it, then when testing ./demo asio_httpd with httpress/ab and watching a task manager I can see how memory consumption only grows, keep running the command bellow and watch process memory usage:

    ab -n 100000 -c 2000 -k http://127.0.0.1:8080/tbox/config.h
    
    or
    
    httpress -t 2 -n 100000 -c 2000 -k http://127.0.0.1:8080/tbox/config.h
    

    I tested with valgrind and it reports no memory leaks (same number of allocations/deallocations) when terminating the program normally (key press), so I think it's memory fragmentation or any pool attached to a connection that is not been released (but because maybe they are attached to a hierarchy of pools that are released at the end valgrind can not find anything).

    The system where it's running is a ubuntu 14.04 64bits.

    Cheers !

  • 编译错误

    编译错误

    [ 37%]: compiling.release src/tbox/stream/impl/stream/sock.c
    error: src/tbox/memory/impl/../../prefix/assert.h:255:135: 错误:‘__a’ may be used uninitialized [-Werror=maybe-uninitialized]
      255 | #   define tb_assert_static(x)          do { typedef int __tb_static_assert__[(x)? 1 : -1]; __tb_volatile__ __tb_static_assert__ __a; tb_used_ptr((tb_cpointer_t)(tb_size_t)__a); } while(0)
          |                                                                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/tbox/memory/impl/native_large_allocator.c:627:9: 附注:in expansion of macro ‘tb_assert_static’
      627 |         tb_assert_static(!(sizeof(tb_native_large_data_head_t) & (TB_POOL_DATA_ALIGN - 1)));
          |         ^~~~~~~~~~~~~~~~
    
  • 👋 Cross compile QNX version error :(

    👋 Cross compile QNX version error :(

    描述问题

    QNX交叉编译tbox库,按照手册中的交叉编译模块配置后编译不通过。

    期待的结果

    能顺利完成tbox QNX平台的交叉编译。

    详细描述

    1. 根据手册配置好交叉工具链 xmake f -p cross -a qnx700-a --sdk=/home/liyq/qnx700/host/linux/x86_64/usr --bin=/home/liyq/qnx700/host/linux/x86_64/usr/bin --cross=ntoaarch64- 运行log如下:
    checking for libc_wcscasecmp ... no
    checking for posix_getnameinfo ... no
    checking for posix_pthread_setaffinity_np ... no
    checking for bsd_flock ... no
    checking for systemv_semget ... no
    checking for libc_memcpy ... ok
    checking for posix_utimensat ... no
    checking for libc_fgetc ... ok
    checking for posix_stat64 ... no
    checking for libm_log2f ... ok
    checking for libc_wcsstr ... ok
    checking for posix_posix_spawnp ... ok
    checking for posix_posix_spawn_file_actions_addchdir_np ... no
    checking for libc_strlen ... ok
    checking for posix_getpagesize ... no
    checking for libc_strnlen ... ok
    checking for posix_getaddrinfo ... no
    checking for posix_mkfifo ... ok
    checking for libc_signal ... ok
    checking for posix_preadv ... no
    checking for posix_pthread_key_create ... ok
    checking for libc_gettimeofday ... ok
    checking for libm_acosf ... ok
    checking for posix_sysconf ... no
    checking for posix_epoll_create ... no
    checking for libc_strncat ... ok
    checking for libc_fgets ... ok
    checking for libc_wcsncpy ... ok
    checking for posix_poll ... ok
    checking for posix_fcntl ... no
    checking for posix_copyfile ... no
    checking for libm_fmodf ... ok
    checking for libc_ungetc ... ok
    checking for libm_pow ... ok
    checking for libc_kill ... no
    checking for libc_wcscpy ... ok
    checking for libc_strncmp ... ok
    checking for posix_gethostname ... no
    checking for libc_memset ... ok
    checking for libc_strchr ... ok
    checking for libc_wcslen ... ok
    checking for posix_pipe ... no
    checking for libc_wcscmp ... ok
    checking for libc_backtrace ... no
    checking for libm_atan ... ok
    checking for posix_execvp ... no
    checking for libm_atan2 ... ok
    checking for libm_sincosf ... no
    checking for libc_wcscasestr ... no
    checking for posix_gethostbyaddr ... ok
    checking for posix_sendfile ... no
    checking for libc_wcsncat ... ok
    checking for posix_sched_setaffinity ... no
    checking for libc_strncasecmp ... no
    checking for libm_powf ... ok
    checking for libc_strcat ... ok
    checking for libc_mbstowcs ... ok
    checking for libc_memmem ... no
    checking for libc_strncpy ... ok
    checking for posix_pthread_mutex_init ... ok
    checking for libm_acos ... ok
    checking for libc_wcsnlen ... no
    checking for posix_pwritev ... no
    checking for libc_wcstombs ... ok
    checking for libm_exp ... ok
    checking for posix_writev ... ok
    checking for libc_wcslcpy ... no
    checking for posix_pread64 ... no
    checking for posix_regexec ... ok
    checking for libc_localtime ... ok
    checking for posix_pthread_create ... ok
    checking for posix_fork ... no
    checking for libc_wcsncmp ... ok
    checking for posix_waitpid ... ok
    checking for posix_futimens ... no
    checking for posix_getdtablesize ... no
    checking for posix_lstat64 ... no
    checking for libc_mktime ... ok
    checking for posix_getifaddrs ... no
    checking for libm_atan2f ... ok
    checking for posix_pwrite64 ... no
    checking for libc_strcasestr ... no
    checking for valgrind_VALGRIND_STACK_REGISTER ... no
    checking for libc_gmtime ... ok
    checking for posix_pthread_getspecific ... ok
    checking for posix_readv ... ok
    checking for feature_anonymous_union ... ok
    checking for posix_select ... ok
    checking for libm_sqrt ... ok
    checking for libm_sin ... ok
    checking for libc_setlocale ... ok
    checking for libc_strlcpy ... no
    checking for posix_vfork ... no
    checking for libm_atanf ... ok
    checking for posix_execvpe ... no
    checking for libm_cosf ... ok
    checking for posix_dlopen ... ok
    checking for libc_strcasecmp ... no
    checking for libc_random ... no
    checking for posix_epoll_wait ... no
    checking for libm_sincos ... no
    checking for posix_fdatasync ... no
    checking for libc_sigsetjmp ... ok
    checking for posix_getrlimit ... ok
    checking for libc_fputc ... ok
    checking for posix_open ... no
    checking for libc_strstr ... ok
    checking for posix_sched_yield ... ok
    checking for posix_regcomp ... ok
    checking for posix_pthread_setspecific ... ok
    checking for libc_fwrite ... ok
    checking for libc_strcmp ... ok
    checking for libm_tanf ... ok
    checking for libm_log2 ... ok
    checking for posix_opendir ... ok
    checking for libc_fread ... ok
    checking for posix_pthread_key_delete ... ok
    checking for posix_socket ... ok
    checking for libm_expf ... ok
    checking for libc_wcsncasecmp ... no
    checking for libc_wcscat ... ok
    checking for posix_gethostbyname ... ok
    checking for libm_asin ... ok
    checking for libc_strcpy ... ok
    checking for libc_setjmp ... no
    checking for libm_sinf ... ok
    checking for posix_mmap ... ok
    checking for libm_fmod ... ok
    checking for libc_memmove ... ok
    checking for libc_fputs ... ok
    checking for posix_sem_init ... ok
    checking for wchar ... no
    checking for libm_tan ... ok
    checking for libc_srandom ... no
    checking for libm_sqrtf ... ok
    checking for systemv_semtimedop ... no
    checking for libc_memcmp ... ok
    checking for libm_cos ... ok
    checking for libc_strrchr ... ok
    checking for libm_asinf ... ok
    checking for posix_pipe2 ... no
    checking for keyword_thread_local ... no
    checking for keyword_thread ... no
    generating src/tbox/tbox.config.h.in ... ok
    

    q1:这一步的checking是在检查什么,checking for xxx ... no的模块要如何处理?

    1. 执行xmake编译报错
    [  0%]: ccache compiling.release src/tbox/libc/stdlib/mbstowcs.c
    [  0%]: ccache compiling.release src/tbox/hash/bkdr.c
    [  0%]: ccache compiling.release src/tbox/math/fixed16.c
    [  0%]: ccache compiling.release src/tbox/libc/impl/libc.c
    [  0%]: ccache compiling.release src/tbox/tbox.c
    [  0%]: ccache compiling.release src/tbox/math/impl/math.c
    [  0%]: ccache compiling.release src/tbox/math/random/linear.c
    [  0%]: ccache compiling.release src/tbox/libc/stdlib/wcstombs.c
    [  0%]: ccache compiling.release src/tbox/hash/adler32.c
    [  0%]: ccache compiling.release src/tbox/math/random/random.c
    [  0%]: ccache compiling.release src/tbox/math/int32.c
    [  0%]: ccache compiling.release src/tbox/hash/fnv32.c
    [  1%]: ccache compiling.release src/tbox/libc/stdlib/random.c
    [  1%]: ccache compiling.release src/tbox/libc/stdlib/stdlib.c
    [  3%]: ccache compiling.release src/tbox/libc/misc/time/gmmktime.c
    [  3%]: ccache compiling.release src/tbox/libc/misc/time/time.c
    [  3%]: ccache compiling.release src/tbox/libc/misc/time/mktime.c
    [  3%]: ccache compiling.release src/tbox/libc/misc/time/gmtime.c
    [  3%]: ccache compiling.release src/tbox/libc/misc/time/localtime.c
    [  3%]: ccache compiling.release src/tbox/libc/string/wcschr.c
    [  3%]: ccache compiling.release src/tbox/libc/string/wcscmp.c
    [  3%]: ccache compiling.release src/tbox/libc/string/strncpy.c
    [  3%]: ccache compiling.release src/tbox/libc/string/strcpy.c
    [  6%]: ccache compiling.release src/tbox/libc/string/strdup.c
    [  6%]: ccache compiling.release src/tbox/libc/string/wcsicmp.c
    [  6%]: ccache compiling.release src/tbox/libc/string/strrchr.c
    [  6%]: ccache compiling.release src/tbox/libc/string/strchr.c
    [  6%]: ccache compiling.release src/tbox/libc/string/wcsndup.c
    [  6%]: ccache compiling.release src/tbox/libc/string/wcsnicmp.c
    [  6%]: ccache compiling.release src/tbox/libc/string/strcat.c
    [  6%]: ccache compiling.release src/tbox/libc/string/wcsdup.c
    [  6%]: ccache compiling.release src/tbox/libc/string/wcsnrstr.c
    [  8%]: ccache compiling.release src/tbox/libc/string/memmov.c
    [  8%]: ccache compiling.release src/tbox/libc/string/strlen.c
    [  8%]: ccache compiling.release src/tbox/libc/string/wcsncat.c
    [  8%]: ccache compiling.release src/tbox/libc/string/wcsncpy.c
    [  8%]: ccache compiling.release src/tbox/libc/string/strnrstr.c
    [  8%]: ccache compiling.release src/tbox/libc/string/wcsrstr.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/wcslcpy.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/strnrchr.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/wcslen.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/wcscpy.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/strnistr.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/wcsrchr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/strnirstr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/wcscat.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/memdup.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/wcsnirchr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/wcsnirstr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/strichr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/strnirchr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/strnchr.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/wcsirchr.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/memmem.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/wcsnrchr.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/memcpy.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/memcmp.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/strnstr.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strnicmp.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/wcsnlen.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strncat.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strnlen.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/wcsstr.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strirchr.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strstr.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strndup.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/memset.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/wcsichr.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/stricmp.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/stristr.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/wcsirstr.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/strlcpy.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/strrstr.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/strirstr.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/strcmp.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/strnichr.c
    [ 21%]: ccache compiling.release src/tbox/libc/string/wcsncmp.c
    [ 21%]: ccache compiling.release src/tbox/libc/string/wcsistr.c
    [ 21%]: ccache compiling.release src/tbox/libc/string/strncmp.c
    [ 21%]: ccache compiling.release src/tbox/libc/stdio/swprintf.c
    [ 21%]: ccache compiling.release src/tbox/libc/stdio/printf_object.c
    [ 21%]: ccache compiling.release src/tbox/libc/stdio/getchar.c
    [ 21%]: ccache compiling.release src/tbox/libc/stdio/vswprintf.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/wputs.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/putchar.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/snprintf.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/vsnprintf.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/wprintf.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/sprintf.c
    [ 25%]: ccache compiling.release src/tbox/libc/stdio/printf.c
    [ 25%]: ccache compiling.release src/tbox/libc/stdio/puts.c
    [ 25%]: ccache compiling.release src/tbox/utils/singleton.c
    [ 25%]: ccache compiling.release src/tbox/utils/trace.c
    [ 25%]: ccache compiling.release src/tbox/utils/lock_profiler.c
    [ 25%]: ccache compiling.release src/tbox/utils/dump.c
    [ 25%]: ccache compiling.release src/tbox/utils/url.c
    [ 28%]: ccache compiling.release src/tbox/utils/base64.c
    [ 28%]: ccache compiling.release src/tbox/utils/bits.c
    [ 28%]: ccache compiling.release src/tbox/utils/used.c
    [ 28%]: ccache compiling.release src/tbox/utils/base32.c
    [ 28%]: ccache compiling.release src/tbox/prefix/state.c
    [ 28%]: ccache compiling.release src/tbox/memory/large_allocator.c
    [ 28%]: ccache compiling.release src/tbox/memory/native_allocator.c
    [ 28%]: ccache compiling.release src/tbox/memory/static_allocator.c
    [ 28%]: ccache compiling.release src/tbox/memory/impl/static_fixed_pool.c
    [ 28%]: ccache compiling.release src/tbox/memory/impl/native_large_allocator.c
    [ 30%]: ccache compiling.release src/tbox/memory/impl/static_large_allocator.c
    [ 30%]: ccache compiling.release src/tbox/memory/impl/prefix.c
    [ 30%]: ccache compiling.release src/tbox/memory/impl/memory.c
    [ 30%]: ccache compiling.release src/tbox/memory/virtual_allocator.c
    [ 30%]: ccache compiling.release src/tbox/memory/default_allocator.c
    [ 30%]: ccache compiling.release src/tbox/memory/allocator.c
    [ 30%]: ccache compiling.release src/tbox/memory/string_pool.c
    [ 31%]: ccache compiling.release src/tbox/memory/static_buffer.c
    [ 31%]: ccache compiling.release src/tbox/memory/queue_buffer.c
    [ 31%]: ccache compiling.release src/tbox/memory/small_allocator.c
    [ 31%]: ccache compiling.release src/tbox/memory/buffer.c
    [ 31%]: ccache compiling.release src/tbox/memory/fixed_pool.c
    [ 33%]: ccache compiling.release src/tbox/string/string.c
    [ 33%]: ccache compiling.release src/tbox/string/static_string.c
    [ 33%]: ccache compiling.release src/tbox/stream/impl/stream/data.c
    [ 33%]: ccache compiling.release src/tbox/stream/impl/stream/http.c
    [ 33%]: ccache compiling.release src/tbox/stream/impl/stream/sock.c
    [ 33%]: ccache compiling.release src/tbox/stream/impl/stream/filter.c
    [ 33%]: ccache compiling.release src/tbox/stream/impl/stream/file.c
    [ 35%]: ccache compiling.release src/tbox/stream/impl/filter/cache.c
    [ 35%]: ccache compiling.release src/tbox/stream/impl/filter/chunked.c
    [ 35%]: ccache compiling.release src/tbox/stream/static_stream.c
    [ 35%]: ccache compiling.release src/tbox/stream/filter.c
    [ 35%]: ccache compiling.release src/tbox/stream/transfer.c
    [ 37%]: ccache compiling.release src/tbox/stream/stream.c
    [ 37%]: ccache compiling.release src/tbox/network/cookies.c
    [ 37%]: ccache compiling.release src/tbox/network/ipaddr.c
    [ 37%]: ccache compiling.release src/tbox/network/impl/http/date.c
    [ 37%]: ccache compiling.release src/tbox/network/impl/http/status.c
    [ 37%]: ccache compiling.release src/tbox/network/impl/http/method.c
    [ 37%]: ccache compiling.release src/tbox/network/impl/http/option.c
    [ 39%]: ccache compiling.release src/tbox/network/impl/network.c
    [ 39%]: ccache compiling.release src/tbox/network/url.c
    [ 39%]: ccache compiling.release src/tbox/network/http.c
    [ 39%]: ccache compiling.release src/tbox/network/dns/cache.c
    [ 39%]: ccache compiling.release src/tbox/network/dns/looker.c
    [ 39%]: ccache compiling.release src/tbox/network/dns/server.c
    [ 39%]: ccache compiling.release src/tbox/network/ipv4.c
    [ 41%]: ccache compiling.release src/tbox/network/ipv6.c
    [ 41%]: ccache compiling.release src/tbox/network/unixaddr.c
    [ 41%]: ccache compiling.release src/tbox/network/hwaddr.c
    [ 41%]: ccache compiling.release src/tbox/algorithm/count.c
    [ 41%]: ccache compiling.release src/tbox/algorithm/heap_sort.c
    [ 41%]: ccache compiling.release src/tbox/algorithm/insert_sort.c
    [ 41%]: ccache compiling.release src/tbox/algorithm/rfind.c
    [ 43%]: ccache compiling.release src/tbox/algorithm/rwalk.c
    [ 43%]: ccache compiling.release src/tbox/algorithm/rfind_if.c
    [ 43%]: ccache compiling.release src/tbox/algorithm/walk.c
    [ 43%]: ccache compiling.release src/tbox/algorithm/predicate.c
    [ 43%]: ccache compiling.release src/tbox/algorithm/remove.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/bubble_sort.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/quick_sort.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/find_if.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/count_if.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/find.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/remove_first_if.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/distance.c
    [ 47%]: ccache compiling.release src/tbox/algorithm/remove_if.c
    [ 47%]: ccache compiling.release src/tbox/algorithm/binary_find_if.c
    [ 47%]: ccache compiling.release src/tbox/algorithm/binary_find.c
    [ 47%]: ccache compiling.release src/tbox/algorithm/sort.c
    [ 47%]: ccache compiling.release src/tbox/algorithm/remove_first.c
    [ 47%]: ccache compiling.release src/tbox/container/circle_queue.c
    [ 47%]: ccache compiling.release src/tbox/container/iterator.c
    [ 47%]: ccache compiling.release src/tbox/container/hash_set.c
    [ 49%]: ccache compiling.release src/tbox/container/heap.c
    [ 49%]: ccache compiling.release src/tbox/container/array_iterator.c
    [ 49%]: ccache compiling.release src/tbox/container/hash_map.c
    [ 49%]: ccache compiling.release src/tbox/container/single_list.c
    [ 49%]: ccache compiling.release src/tbox/container/queue.c
    [ 49%]: ccache compiling.release src/tbox/container/list.c
    [ 49%]: ccache compiling.release src/tbox/container/stack.c
    [ 49%]: ccache compiling.release src/tbox/container/vector.c
    [ 51%]: ccache compiling.release src/tbox/container/priority_queue.c
    [ 51%]: ccache compiling.release src/tbox/container/single_list_entry.c
    [ 51%]: ccache compiling.release src/tbox/container/bloom_filter.c
    [ 51%]: ccache compiling.release src/tbox/container/list_entry.c
    [ 51%]: ccache compiling.release src/tbox/container/element/uint16.c
    [ 51%]: ccache compiling.release src/tbox/container/element/uint8.c
    [ 54%]: ccache compiling.release src/tbox/container/element/uint32.c
    [ 54%]: ccache compiling.release src/tbox/container/element/true.c
    [ 54%]: ccache compiling.release src/tbox/container/element/ptr.c
    [ 54%]: ccache compiling.release src/tbox/container/element/long.c
    [ 54%]: ccache compiling.release src/tbox/container/element/hash.c
    [ 54%]: ccache compiling.release src/tbox/container/element/null.c
    [ 54%]: ccache compiling.release src/tbox/container/element/mem.c
    [ 54%]: ccache compiling.release src/tbox/container/element/size.c
    [ 54%]: ccache compiling.release src/tbox/container/element/str.c
    [ 55%]: ccache compiling.release src/tbox/libm/impl/libm.c
    [ 55%]: ccache compiling.release src/tbox/libm/idivi8.c
    [ 55%]: ccache compiling.release src/tbox/libm/ilog2i.c
    [ 57%]: ccache compiling.release src/tbox/libm/isqrti.c
    [ 57%]: ccache compiling.release src/tbox/libm/isqrti64.c
    [ 57%]: ccache compiling.release src/tbox/libm/cosf.c
    [ 57%]: ccache compiling.release src/tbox/libm/isinf.c
    [ 57%]: ccache compiling.release src/tbox/libm/exp.c
    [ 57%]: ccache compiling.release src/tbox/libm/sincos.c
    [ 57%]: ccache compiling.release src/tbox/libm/log2f.c
    [ 57%]: ccache compiling.release src/tbox/libm/log2.c
    [ 57%]: ccache compiling.release src/tbox/libm/expi.c
    [ 59%]: ccache compiling.release src/tbox/libm/expif.c
    [ 59%]: ccache compiling.release src/tbox/libm/sinf.c
    [ 59%]: ccache compiling.release src/tbox/libm/exp1f.c
    [ 59%]: ccache compiling.release src/tbox/libm/atanf.c
    [ 59%]: ccache compiling.release src/tbox/libm/isnan.c
    [ 59%]: ccache compiling.release src/tbox/libm/expf.c
    [ 62%]: ccache compiling.release src/tbox/libm/exp1.c
    [ 62%]: ccache compiling.release src/tbox/libm/isnanf.c
    [ 62%]: ccache compiling.release src/tbox/libm/cos.c
    [ 62%]: ccache compiling.release src/tbox/libm/atan2f.c
    [ 62%]: ccache compiling.release src/tbox/libm/tan.c
    [ 62%]: ccache compiling.release src/tbox/libm/fmodf.c
    [ 62%]: ccache compiling.release src/tbox/libm/atan.c
    [ 62%]: ccache compiling.release src/tbox/libm/sincosf.c
    [ 62%]: ccache compiling.release src/tbox/libm/isfinf.c
    [ 63%]: ccache compiling.release src/tbox/libm/tanf.c
    [ 63%]: ccache compiling.release src/tbox/libm/powf.c
    [ 63%]: ccache compiling.release src/tbox/libm/isinff.c
    [ 63%]: ccache compiling.release src/tbox/libm/asinf.c
    [ 65%]: ccache compiling.release src/tbox/libm/acos.c
    [ 65%]: ccache compiling.release src/tbox/libm/isfin.c
    [ 65%]: ccache compiling.release src/tbox/libm/pow.c
    [ 65%]: ccache compiling.release src/tbox/libm/asin.c
    [ 65%]: ccache compiling.release src/tbox/libm/sqrt.c
    [ 65%]: ccache compiling.release src/tbox/libm/sin.c
    [ 65%]: ccache compiling.release src/tbox/libm/atan2.c
    [ 66%]: ccache compiling.release src/tbox/libm/sqrtf.c
    [ 66%]: ccache compiling.release src/tbox/libm/acosf.c
    [ 66%]: ccache compiling.release src/tbox/libm/fmod.c
    [ 66%]: ccache compiling.release src/demo/demo.c
    [ 69%]: ccache compiling.release src/demo/libc/wcstombs.c
    [ 69%]: ccache compiling.release src/demo/libc/mbstowcs.c
    [ 69%]: ccache compiling.release src/demo/libc/wchar.c
    [ 69%]: ccache compiling.release src/demo/libc/time.c
    [ 69%]: ccache compiling.release src/demo/libc/string.c
    [ 69%]: ccache compiling.release src/demo/libc/stdlib.c
    [ 69%]: ccache compiling.release src/demo/libm/integer.c
    [ 69%]: ccache compiling.release src/demo/math/random.c
    [ 69%]: ccache compiling.release src/demo/utils/dump.c
    [ 69%]: ccache compiling.release src/demo/utils/url.c
    [ 71%]: ccache compiling.release src/demo/utils/base64.c
    [ 71%]: ccache compiling.release src/demo/utils/bits.c
    [ 71%]: ccache compiling.release src/demo/utils/base32.c
    [ 71%]: ccache compiling.release src/demo/other/test.c
    [ 71%]: ccache compiling.release src/demo/string/string.c
    [ 71%]: ccache compiling.release src/demo/string/static_string.c
    [ 73%]: ccache compiling.release src/demo/memory/check.c
    [ 73%]: ccache compiling.release src/demo/memory/large_pool.c
    [ 73%]: ccache compiling.release src/demo/memory/impl/static_fixed_pool.c
    [ 73%]: ccache compiling.release src/demo/memory/default_allocator.c
    [ 73%]: ccache compiling.release src/demo/memory/string_pool.c
    [ 73%]: ccache compiling.release src/demo/memory/static_buffer.c
    [ 73%]: ccache compiling.release src/demo/memory/queue_buffer.c
    [ 76%]: ccache compiling.release src/demo/memory/small_allocator.c
    [ 76%]: ccache compiling.release src/demo/memory/memops.c
    [ 76%]: ccache compiling.release src/demo/memory/buffer.c
    [ 76%]: ccache compiling.release src/demo/memory/fixed_pool.c
    [ 76%]: ccache compiling.release src/demo/platform/pipe_pair.c
    [ 76%]: ccache compiling.release src/demo/platform/ifaddrs.c
    [ 76%]: ccache compiling.release src/demo/platform/hostname.c
    [ 76%]: ccache compiling.release src/demo/platform/cache_time.c
    [ 76%]: ccache compiling.release src/demo/platform/thread.c
    [ 76%]: ccache compiling.release src/demo/platform/fwatcher.c
    [ 76%]: ccache compiling.release src/demo/platform/ltimer.c
    [ 78%]: ccache compiling.release src/demo/platform/poller_fwatcher.c
    [ 78%]: ccache compiling.release src/demo/platform/addrinfo.c
    [ 78%]: ccache compiling.release src/demo/platform/poller_pipe.c
    [ 78%]: ccache compiling.release src/demo/platform/poller_process.c
    [ 79%]: ccache compiling.release src/demo/platform/process.c
    [ 79%]: ccache compiling.release src/demo/platform/utils.c
    [ 79%]: ccache compiling.release src/demo/platform/stdfile.c
    [ 79%]: ccache compiling.release src/demo/platform/backtrace.c
    [ 79%]: ccache compiling.release src/demo/platform/atomic.c
    [ 79%]: ccache compiling.release src/demo/platform/lock.c
    [ 81%]: ccache compiling.release src/demo/platform/atomic64.c
    [ 81%]: ccache compiling.release src/demo/platform/atomic32.c
    [ 81%]: ccache compiling.release src/demo/platform/thread_pool.c
    [ 81%]: ccache compiling.release src/demo/platform/poller_server.c
    [ 81%]: ccache compiling.release src/demo/platform/environment.c
    [ 81%]: ccache compiling.release src/demo/platform/filelock.c
    [ 83%]: ccache compiling.release src/demo/platform/timer.c
    [ 83%]: ccache compiling.release src/demo/platform/file.c
    [ 83%]: ccache compiling.release src/demo/platform/path.c
    [ 83%]: ccache compiling.release src/demo/platform/sched.c
    [ 83%]: ccache compiling.release src/demo/platform/directory.c
    [ 84%]: ccache compiling.release src/demo/platform/semaphore.c
    [ 84%]: ccache compiling.release src/demo/platform/event.c
    [ 84%]: ccache compiling.release src/demo/platform/poller_client.c
    [ 84%]: ccache compiling.release src/demo/platform/thread_local.c
    [ 84%]: ccache compiling.release src/demo/platform/named_pipe.c
    [ 84%]: ccache compiling.release src/demo/container/circle_queue.c
    [ 87%]: ccache compiling.release src/demo/container/hash_set.c
    [ 87%]: ccache compiling.release src/demo/container/heap.c
    [ 87%]: ccache compiling.release src/demo/container/hash_map.c
    [ 87%]: ccache compiling.release src/demo/container/single_list.c
    [ 87%]: ccache compiling.release src/demo/container/queue.c
    [ 87%]: ccache compiling.release src/demo/container/list.c
    [ 87%]: ccache compiling.release src/demo/container/stack.c
    [ 87%]: ccache compiling.release src/demo/container/vector.c
    [ 89%]: ccache compiling.release src/demo/container/single_list_entry.c
    [ 89%]: ccache compiling.release src/demo/container/bloom_filter.c
    [ 89%]: ccache compiling.release src/demo/container/list_entry.c
    [ 89%]: ccache compiling.release src/demo/algorithm/find.c
    [ 89%]: ccache compiling.release src/demo/algorithm/sort.c
    [ 89%]: ccache compiling.release src/demo/stream/stream.c
    [ 66%]: ccache compiling.release src/demo/other/test.cpp
    [ 90%]: ccache compiling.release src/demo/stream/stream/cache.c
    [ 90%]: ccache compiling.release src/demo/stream/stream/charset.c
    [ 90%]: ccache compiling.release src/demo/stream/stream/zip.c
    [ 90%]: ccache compiling.release src/demo/stream/stream/null.c
    [ 90%]: ccache compiling.release src/demo/network/cookies.c
    [ 92%]: ccache compiling.release src/demo/network/ping.c
    [ 92%]: ccache compiling.release src/demo/network/unix_echo_client.c
    [ 92%]: ccache compiling.release src/demo/network/ipaddr.c
    [ 92%]: ccache compiling.release src/demo/network/impl/date.c
    [ 92%]: ccache compiling.release src/demo/network/dns.c
    [ 92%]: ccache compiling.release src/demo/network/url.c
    [ 92%]: ccache compiling.release src/demo/network/unix_echo_server.c
    [ 93%]: ccache compiling.release src/demo/network/http.c
    [ 93%]: ccache compiling.release src/demo/network/ipv4.c
    [ 93%]: ccache compiling.release src/demo/network/ipv6.c
    [ 93%]: ccache compiling.release src/demo/network/unixaddr.c
    [ 95%]: ccache compiling.release src/demo/network/whois.c
    [ 95%]: ccache compiling.release src/demo/network/hwaddr.c
    [ 95%]: ccache compiling.release src/demo/math/fixed.c
    [ 95%]: ccache compiling.release src/demo/libm/float.c
    [ 95%]: ccache compiling.release src/demo/libm/double.c
    [ 98%]: archiving.release libtbox.a
    [ 99%]: linking.release demo
    error: /home/liyq/qnx700/host/linux/x86_64//usr/bin/aarch64-unknown-nto-qnx7.0.0-ld: cannot find -lpthread
    /home/liyq/qnx700/host/linux/x86_64//usr/bin/aarch64-unknown-nto-qnx7.0.0-ld: cannot find -ldl
    collect2: error: ld returned 1 exit status
    

    q2:lpthread、ldl等库是否需要用交叉工具链编译相应平台的so库放入指定的目录(shared)才可以?

    相关环境

    ubuntu x86_64上 编译 qnx700

    交叉编译工具链目录结构:

    • lib
    • bin
    • shared
    • include
  • sqlite3 demo get wrong row size

    sqlite3 demo get wrong row size

    Note: If you use the fuzzy expressions such as 'can't use/no effect/problem/error', but don't give any relevant auxiliary information according to the template below, this issue will be not replied.

    Describe the bug

    A clear and concise description of what the bug is. run

    xmake f -m debug -p macosx --database=y --sqlite3=y
    xmake
    xmake run demo database_sql ./test.db
    

    get wrong row size as follow:

    [demo]: ==============================================================================
    [demo]: row: size: 18446744073709551615
    [demo]: [row: 0, col: size: 9]: [id:1] [fval:3.000000] [name:name1] [data:data1] [tdata:ldata1] [ldata1:tdata1] [ldata2:null] [number:52642] [snumber:2642] 
    [demo]: [row: 1, col: size: 9]: [id:2] [fval:3.099999] [name:name2] [data:data2] [tdata:ldata2] [ldata1:tdata2] [ldata2:null] [number:57127] [snumber:7127] 
    [demo]: [row: 2, col: size: 9]: [id:3] [fval:3.140000] [name:name3] [data:data3] [tdata:ldata3] [ldata1:tdata3] [ldata2:null] [number:9000] [snumber:9000] 
    [demo]: [row: 3, col: size: 9]: [id:4] [fval:3.141499] [name:name4] [data:data4] [tdata:ldata4] [ldata1:tdata4] [ldata2:null] [number:29000] [snumber:9000] 
    [demo]: [row: 4, col: size: 9]: [id:5] [fval:-3.099999] [name:name5] [data:data5] [tdata:ldata5] [ldata1:tdata5] [ldata2:null] [number:350000] [snumber:5000] 
    [demo]: [row: 5, col: size: 9]: [id:6] [fval:3.453999] [name:name6] [data:data6] [tdata:ldata6] [ldata1:tdata6] [ldata2:null] [number:21000] [snumber:1000] 
    [demo]: [row: 6, col: size: 9]: [id:7] [fval:100.097999] [name:name7] [data:data7] [tdata:ldata7] [ldata1:tdata7] [ldata2:null] [number:21600] [snumber:1600] 
    [tbox]: [database]: exit: ..
    [tbox]: [database]: exit: ok
    

    Related Environment

    macOS Monterey 12.3.1 Xcode 13.4.1 tbox 1.6.8 xmake 2.6.9

  • Add cgi support

    Add cgi support

    Is your feature request related to a problem? Please describe.

    no, just cgi with c

    Describe the solution you'd like

    use tbox to write simple cgi programs in c, similar to qdecoder, libcgi,cgic

    Describe alternatives you've considered

    qdecoder,libcgi,cgic

    Additional context

    Add any other context or screenshots about the feature request here.

  • json 数据解析浮点数错误

    json 数据解析浮点数错误

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

    描述问题

    我使用如下的 json 串解码,得到的 confidence 字段一个是0.000000,另一个是0.750000。都不对。 [{"confidence":0.974220335483551,"text":"lenovo联想","text_region":[[191,80],[672,80],[672,148],[191,148]]},{"confidence":0.6968730688095093,"text":"BY:花享湖月","text_region":[[250,866],[332,866],[332,885],[250,885]]}]

    期待的结果

    如果是 debug 希望老大处理一下,如果是我使用错误,请老大指正一下。

    错误信息

    我以为是中文的问题,但我转换为 \uxxxx 格式后提示我需要重新编译启用 unicode 支持,那不是就说明不是中文的问题

    相关环境

    xmake v2.6.4+dev.35fa885 tbox master

    其他信息

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

  • TB_OPTION_MODE_KEY_VAL  = 3  选项处理有错误

    TB_OPTION_MODE_KEY_VAL = 3 选项处理有错误

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

    描述问题

    看源码注释是:TB_OPTION_MODE_KEY_VAL = 3 //!< --key=value or --key value or -k=value or -k value 但经过我测试只有 --key=value 和 -k=value 才行,另外两个不行!

    我代码中的选项定义是这样的: c {'c', "config", TB_OPTION_MODE_KEY_VAL, TB_OPTION_TYPE_CSTR, "配置文件路径,支持 json/xml 等格式"},

    期待的结果

    -c=xxx 正常, -c xxx 报错

    错误信息

    [tbox]: [option]: [error]: aiden: no option value '--c=' at tb_option_done(): 465, src/tbox/utils/option.c

    相关环境

    xmake v2.6.4+dev.35fa885

    其他信息

    xmake 中的依赖:

    add_requires("tbox master", { configs = {database = true, object = true}, debug = is_mode("debug") })

JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, RTAS and AAX audio plug-ins.
JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, RTAS and AAX audio plug-ins.

JUCE is an open-source cross-platform C++ application framework used for rapidly developing high quality desktop and mobile applications, including VS

Jan 1, 2023
Kigs framework is a C++ modular multipurpose cross platform framework.
Kigs framework is a C++ modular multipurpose cross platform framework.

Kigs framework is a C++ modular multi-purpose cross-platform framework. It was used as a basis for many professionnal projects. The main goal was to b

Nov 28, 2022
openFrameworks is a community-developed cross platform toolkit for creative coding in C++.

openFrameworks openFrameworks is a C++ toolkit for creative coding. If you are new to OF, welcome! Build status The master branch contains the newest,

Jan 3, 2023
EASTL stands for Electronic Arts Standard Template Library. It is an extensive and robust implementation that has an emphasis on high performance.

EA Standard Template Library EASTL stands for Electronic Arts Standard Template Library. It is a C++ template library of containers, algorithms, and i

Jan 3, 2023
Embedded Template Library

Embedded Template Library (ETL) Motivation C++ is a great language to use for embedded applications and templates are a powerful aspect. The standard

Dec 28, 2022
An open-source C++ library developed and used at Facebook.

Folly: Facebook Open-source Library What is folly? Folly (acronymed loosely after Facebook Open Source Library) is a library of C++14 components desig

Jan 1, 2023
Functional Programming Library for C++. Write concise and readable C++ code.
Functional Programming Library for C++. Write concise and readable C++ code.

FunctionalPlus helps you write concise and readable C++ code. Table of contents Introduction Usage examples Type deduction and useful error messages T

Dec 29, 2022
Dec 25, 2022
NIH Utility Library

libnih is a light-weight "standard library" of C functions to ease the development of other libraries and applications. Its goals are: * despite it

Dec 10, 2022
An open source library for C

Homo Deus - C Library Introduction The Homo Deus C Library (hdelibc) is an open source collection of tools for the C programming language. The project

Dec 11, 2022
A convenience C++ wrapper library for JSON-Glib providing friendly syntactic sugar for parsing JSON

This library is a wrapper for the json-glib library that aims to provide the user with a trivial alternative API to the API provided by the base json-

Oct 19, 2022
A repository I'm using to learn hashing with GLib.

GLib Tests Description A repository I'm using to store my progress while learning GNOME's GLib library. Specifically hashing via ghash. Test Files GLi

Oct 24, 2022
Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator framework, based on QEMU.
Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator framework, based on QEMU.

Unicorn Engine Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator framework, based on QEMU. Unicorn offers some unparalleled fe

Nov 7, 2021
aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line.

aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink.

Jan 7, 2023
multi-sdr-gps-sim generates a IQ data stream on-the-fly to simulate a GPS L1 baseband signal using a SDR platform like HackRF or ADLAM-Pluto.

multi-sdr-gps-sim generates a GPS L1 baseband signal IQ data stream, which is then transmitted by a software-defined radio (SDR) platform. Supported at the moment are HackRF, ADLAM-Pluto and binary IQ file output. The software interacts with the user through a curses based text user interface (TUI) in terminal.

Dec 27, 2022
A cross platform shader language with multi-threaded offline compilation or platform shader source code generation
A cross platform shader language with multi-threaded offline compilation or platform shader source code generation

A cross platform shader language with multi-threaded offline compilation or platform shader source code generation. Output json reflection info and c++ header with your shaders structs, fx-like techniques and compile time branch evaluation via (uber-shader) "permutations".

Dec 14, 2022
A fast multi-producer, multi-consumer lock-free concurrent queue for C++11

moodycamel::ConcurrentQueue An industrial-strength lock-free queue for C++. Note: If all you need is a single-producer, single-consumer queue, I have

Jan 3, 2023
A bounded multi-producer multi-consumer concurrent queue written in C++11
A bounded multi-producer multi-consumer concurrent queue written in C++11

MPMCQueue.h A bounded multi-producer multi-consumer concurrent queue written in C++11. It's battle hardened and used daily in production: In the Frost

Dec 25, 2022
Multi-dimensional dynamically distorted staggered multi-bandpass LV2 plugin
Multi-dimensional dynamically distorted staggered multi-bandpass LV2 plugin

B.Angr A multi-dimensional dynamicly distorted staggered multi-bandpass LV2 plugin, for extreme soundmangling. Based on Airwindows XRegion. Key featur

Nov 7, 2022