- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
在我添加柠檬解析器之前,我的程序过去常常用 OpenBSD 编译得很好。现在它在 Linux 上编译,但在 OpenBSD 上我得到一个我不明白的错误。
$ cmake ..
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dac/test/openshell/build
$ make
Scanning dependScanning dependencies of target shell
[ 28%] Building C object CMakeFiles/shell.dir/main.c.o
/home/dac/test/openshell/main.c: In function 'main':
/home/dac/test/openshell/main.c:788: warning: implicit declaration of function 'add_history'
/home/dac/test/openshell/main.c: In function 'command':
/home/dac/test/openshell/main.c:573: warning: passing argument 1 of 'expandVariable' discards qualifiers from pointer target type
cc: -ledit: linker input file unused because linking not done
cc: -lncurses: linker input file unused because linking not done
cc: -lcurses: linker input file unused because linking not done
cc: -ltermcap: linker input file unused because linking not done
[ 42%] Building C object CMakeFiles/shell.dir/shellparser.c.o
/home/dac/test/openshell/shellparser.c:280: error: expected expression before '%' token
/home/dac/test/openshell/shellparser.c:288: error: expected expression before '%' token
/home/dac/test/openshell/shellparser.c:288: error: initializer element is not constant
/home/dac/test/openshell/shellparser.c:288: error: (near initialization for 'yyRuleName[0]')
/home/dac/test/openshell/shellparser.c: In function 'yy_destructor':
/home/dac/test/openshell/shellparser.c:370: error: expected expression before '%' token
/home/dac/test/openshell/shellparser.c:370: warning: statement with no effect
/home/dac/test/openshell/shellparser.c: In function 'yyStackOverflow':
/home/dac/test/openshell/shellparser.c:551: error: expected expression before '%' token
/home/dac/test/openshell/shellparser.c:551: warning: statement with no effect
/home/dac/test/openshell/shellparser.c: At top level:
/home/dac/test/openshell/shellparser.c:609: error: expected expression before '%' token
/home/dac/test/openshell/shellparser.c:609: warning: missing braces around initializer
/home/dac/test/openshell/shellparser.c:609: warning: (near initialization for 'yyRuleInfo[0]')
/home/dac/test/openshell/shellparser.c:609: error: initializer element is not constant
/home/dac/test/openshell/shellparser.c:609: error: (near initialization for 'yyRuleInfo[0].lhs')
/home/dac/test/openshell/shellparser.c: In function 'yy_reduce':
/home/dac/test/openshell/shellparser.c:664: error: expected expression before '%' token
/home/dac/test/openshell/shellparser.c:664: warning: statement with no effect
/home/dac/test/openshell/shellparser.c: In function 'yy_parse_failed':
/home/dac/test/openshell/shellparser.c:710: error: expected expression before '%' token
/home/dac/test/openshell/shellparser.c:710: warning: statement with no effect
/home/dac/test/openshell/shellparser.c: In function 'yy_syntax_error':
/home/dac/test/openshell/shellparser.c:726: error: expected expression before '%' token
/home/dac/test/openshell/shellparser.c:726: warning: statement with no effect
/home/dac/test/openshell/shellparser.c: In function 'yy_accept':
/home/dac/test/openshell/shellparser.c:745: error: expected expression before '%' token
/home/dac/test/openshell/shellparser.c:745: warning: statement with no effect
/home/dac/test/openshell/shellparser.c: At top level:
/home/dac/test/openshell/shellparser.c:918: error: expected identifier or '(' before string constant
/home/dac/test/openshell/shellparser.c:929: error: expected identifier or '(' before ',' token
为什么会这样,我该怎么办?我忘了包括图书馆吗?我的 cmake 文件是
cmake_minimum_required(VERSION 3.0)
project(shell.test)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -L/usr/local/include/ -L/usr/include -std=c99 -pedantic -O3 -g -Wall -pedantic -ledit -lncurses -lcurses -ltermcap")
include_directories(/usr/local/include/ /usr/include)
link_directories(/usr/lib)
link_directories(/usr/local/lib)
add_executable(shell main.c shellparser.c errors.c util.c)
target_link_libraries(shell edit readline)
add_custom_target(shellparser DEPENDS ${CMAKE_SOURCE_DIR}/shellparser.c)
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/shellparser.c COMMAND lemon -s ${CMAKE_SOURCE_DIR}/shellparser.y DEPENDS ${CMAKE_SOURCE_DIR}/shellparser.y)
add_dependencies(shell shellparser)
set_property(TARGET shell PROPERTY C_STANDARD 99)$
在 Ubuntu 上我可以成功构建它:
$ git clone http://github.com/montao/openshell
Cloning into 'openshell'...
remote: Counting objects: 1439, done.
remote: Compressing objects: 100% (184/184), done.
remote: Total 1439 (delta 124), reused 0 (delta 0), pack-reused 1255
Receiving objects: 100% (1439/1439), 405.08 KiB | 117.00 KiB/s, done.
Resolving deltas: 100% (973/973), done.
Checking connectivity... done.
dac@dac-Latitude-E7450:~/montao/test$ cd openshell/
dac@dac-Latitude-E7450:~/montao/test/openshell$ mkdir build
dac@dac-Latitude-E7450:~/montao/test/openshell$ cd build/
dac@dac-Latitude-E7450:~/montao/test/openshell/build$ cmake ..
-- The C compiler identification is GNU 5.3.1
-- The CXX compiler identification is GNU 5.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dac/montao/test/openshell/build
dac@dac-Latitude-E7450:~/montao/test/openshell/build$ make
Scanning dependencies of target shellparser
[ 14%] Generating ../shellparser.c
Parser statistics:
terminal symbols................... 9
non-terminal symbols............... 3
total symbols...................... 12
rules.............................. 8
states............................. 14
conflicts.......................... 0
action table entries............... 32
total table size (bytes)........... 100
[ 14%] Built target shellparser
Scanning dependencies of target shell
[ 28%] Building C object CMakeFiles/shell.dir/main.c.o
/home/dac/montao/test/openshell/main.c: In function ‘free_pipeline’:
/home/dac/montao/test/openshell/main.c:337:6: note: the ABI of passing struct with a flexible array member has changed in GCC 4.4
void free_pipeline(struct pipeline pipe) {
^
[ 42%] Building C object CMakeFiles/shell.dir/shellparser.c.o
[ 57%] Building C object CMakeFiles/shell.dir/errors.c.o
[ 71%] Building C object CMakeFiles/shell.dir/util.c.o
/home/dac/montao/test/openshell/util.c: In function ‘make_args’:
/home/dac/montao/test/openshell/util.c:1100:52: warning: operation on ‘jc’ may be undefined [-Wsequence-point]
char *str = concat((char *) *retArgv[jc++], (char *) *retArgv[jc]);
^
/home/dac/montao/test/openshell/util.c:1100:19: warning: unused variable ‘str’ [-Wunused-variable]
char *str = concat((char *) *retArgv[jc++], (char *) *retArgv[jc]);
^
[ 85%] Linking C executable shell
[100%] Built target shell
无论我做什么,当我用 OpenBSD 编译时,错误就在那里。我尝试了一切。
最佳答案
我没有使用过 OpenBSD,但这可能是由 2007 年 7 月 18 日发布的“古老的”GCC 4.2.1 引起的。在 Ubuntu 上,它是用更新的 GCC 编译的。
事实上,如果您检查 project you want to build 的依赖项
Dependencies: editline, ncurses, C99
并且在 gcc 中支持 C99
C99 is substantially completely supported as of GCC 4.5 (with -std=c99 -pedantic-errors used; -fextended-identifiers also needed to enable extended identifiers before GCC 5)
关于c - 为什么我不能用 OpenBSD 编译?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37225477/
我是 OpenBSD 新手。我以前曾在 Linux 上工作过。我正在寻找可以找到有关当前正在运行的进程的信息的目录。在 Linux 中,我们有/proc 目录,其中包含整个列表。但我在 OpenBSD
我正在将我们的集成测试环境更新到 OpenBSD 6.7(从 6.5) 我们使用 ansible 在目标系统上安装所有包(openbsd 6.7,Vagrant image https://app.v
我不明白 Postgres 如何与 openBSD 一起工作。我在使用 debian 时没有遇到这些问题(我不必执行 initdb)。 我做了如下 pkg_add postgresql-server
我有任务: “在 JavaEE 上开发程序(使用 Servlet/JSP 技术的简单 Web 应用程序),它将在“OpenBSD 5.6.amd64”服务器上运行,并提供用于控制网络端口的接口(int
作为一个概念验证,加上一个方便的偏执工具,我正在编写一个 OpenBSD LKM,它将连接到一个 IRC channel ,并在执行 Hook 系统调用时报告。 这样一来,当我不在现场但可以访问 In
我试过: char *path = realpath(getenv("_"), NULL); *(strrchr(path, '/')+1) = '\0'; 这行得通,但是如果我的可执行文件被父进程调
Linux 有backtrace() 函数,它是GNU 的扩展。 FreeBSD 从 10.0 版开始引入了 backtrace() 函数,NetBSD 从 7.0 版开始引入了函数。 有什么方法可以
在我添加柠檬解析器之前,我的程序过去常常用 OpenBSD 编译得很好。现在它在 Linux 上编译,但在 OpenBSD 上我得到一个我不明白的错误。 $ cmake .. -- The C com
我想我必须安装 editline (libedit?) 库,但我在哪里可以为 OpenBSD 获得它?代码在 PC-BSD 上编译得很好,但在 OpenBSD 上我得到这个错误 implicit de
有没有人让 VisualWorks 在 OpenBSD 下运行?它不是官方支持的平台,但 Cincom 的一位员工告诉我,它应该能够在 linux 兼容模式下运行。你是怎么设置的? 我已经让 Sque
我最近一直在阅读 D 编程语言,并且有兴趣将它用于将在 OpenBSD 上运行的小型应用程序。 据我所知,编译器没有 OpenBSD 端口,但我可以在 posix.mak 文件中看到对 OpenBSD
我经常乘公共(public)汽车旅行,其中大部分都提供某种形式的车载 WiFi。使用像 Wicd 这样的自动连接管理器连接到它们的通常方法是选择网络,然后在启动浏览器时进行一些额外的身份验证,我就完成
httpd 配置文件可以有多少个 fastcgi 处理程序?我想设置 httpd 服务器来服务器在不同 tcp 套接字上运行的多个 fastcgi 程序。例如:http://uwsgi-docs.re
我已经开始为 OpenBSD 编写驱动程序(用于 NXP 的 I2C 设备 PCF8574)。 目前我用官方指令编译内核https://www.openbsd.org/faq/faq5.html来自
我正在玩 OpenBSD 内核代码,尤其是这个文件 sys/kern/sched_bsd.c。 void schedcpu(void *arg) { ...... ......
当需要 .so 时,我应该如何在 OpenBSD 上构建 XS perl 模块文件丢失? 背景:在普通 OpenBSD 5.3 vm 安装中,我无法构建需要链接到 -lpthread 的 perl 模
我的ssl bindings for R在 linux、osx、windows 和 solaris 上编译,但在 OpenBSD 上包含 resolv.h 时会失败。这是 OpenBSD 中的错误吗?
我已经摸不着头脑了一段时间,找不到让它工作的方法...... 我想在我的 OpenBSD 服务器上运行一些 cgi 脚本(用 Python 编写)。由于 OpenBSD 上的 Web 服务器在 jai
我最近将我的服务器从 OpenBSD 6.0 更新到 6.1 自从这次更新后,python 控制台不再可用(我安装了 2.7 和 3.6 版本,两者具有相同的行为) 当我尝试启动 python 控制台
我想在 ksh 和 openBSD 5.8/5.9 中为 git 命令设置自动完成。 不知何故,它以前安装过,但突然消失了,所以我不得不输入或复制粘贴大量文本。 它应该像在 OSX 或 Ubuntu
我是一名优秀的程序员,十分优秀!