0
点赞
收藏
分享

微信扫一扫

gcc源码编译报错:error: dereferencing pointer to incomplete type ‘struct ucontext’ 解决办法

陆佃 2022-01-16 阅读 94

文章目录


项目场景

在安装 gcc 使用 make 编译源码时,出现如下报错:

In file included from ../.././libgcc/unwind-dw2.c:401:0:
./md-unwind-support.h: In function ‘x86_64_fallback_frame_state’:
./md-unwind-support.h:65:47: error: dereferencing pointer to incomplete type ‘struct ucontext’
       sc = (struct sigcontext *) (void *) &uc_->uc_mcontext;
                                               ^~

解决办法

修改 md-unwind-support.h 文件的第 61 行,其中该文件位于 ./x86_64-pc-linux-gnu/libgcc 目录下:

vim ./x86_64-pc-linux-gnu/libgcc/md-unwind-support.h

输入 :61,跳转到第 61 行,修改 struct ucontext *uc_ = context->cfa; 中的 ucontextucontext_t

struct ucontext_t *uc_ = context->cfa;

按下 ESC 键,输入 :wq 保存并退出,重新执行 make

举报

相关推荐

0 条评论