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

aosp中编译srs-server及libst报错 #26

Open
sunplusApp opened this issue Dec 23, 2021 · 2 comments
Open

aosp中编译srs-server及libst报错 #26

sunplusApp opened this issue Dec 23, 2021 · 2 comments

Comments

@sunplusApp
Copy link

sunplusApp commented Dec 23, 2021

目前我在做的是将srs及libst源码放入android源码中交叉编译,然后集成进安卓手机中(手机CPU架构aarch64)。
android源码现在是用clang 编译。
在编译libst时,这个MD_GET_SP宏报错

#elif defined(__aarch64__)
            /* https://github.com/ossrs/state-threads/issues/9 */
            #define MD_STACK_GROWS_DOWN
            #define MD_USE_BUILTIN_SETJMP
            #define MD_GET_SP(_t) ((_t)->context[0].__jmpbuf[13])

报错内容:

system/core/libst/sched.c:616:9: error: member reference base type 'long' is not a structure or union
        _ST_INIT_CONTEXT(thread, stack->sp, _st_thread_main);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
system/core/libst/common.h:442:30: note: expanded from macro '_ST_INIT_CONTEXT'
    #define _ST_INIT_CONTEXT MD_INIT_CONTEXT
                             ^
system/core/libst/md.h:472:13: note: expanded from macro 'MD_INIT_CONTEXT'
            MD_GET_SP(_thread) = (long) (_sp);         \
            ^~~~~~~~~~~~~~~~~~
system/core/libst/md.h:429:52: note: expanded from macro 'MD_GET_SP'
            #define MD_GET_SP(_t) ((_t)->context[0].__jmpbuf[13])
                                   ~~~~~~~~~~~~~~~~^~~~~~~~~

请问这个是什么原因啊?是clang的问题吗?

@winlinvip
Copy link
Member

winlinvip commented Dec 23, 2021

嵌入式环境差别比较大,这个就是setmpjmpbuf定义不太一样,需要你处理下。

可以参考 https://github.com/ossrs/state-threads/blob/srs/tools/porting/porting.c 看看具体怎么写才是对的。

欢迎Patch下。

@sunplusApp
Copy link
Author

#define MD_GET_SP(_t) ((_t)->context[0].__jmpbuf[13])
看了下这行大概的意思是获取获取SP指针?编译报错是context[0]是个long类型变量,遂将上面代码改成
#define MD_GET_SP(_t) ((_t)->context[JB_RSP]
这样就编过了,而且测试好用。

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