We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
v2.6.9
Linux myuan-precision7920tower 5.10.129-1-MANJARO #1 SMP PREEMPT Thu Jul 7 16:56:51 UTC 2022 x86_64 GNU/Linux
当使用规则add_rules("lex", "yacc")时, 添加的包无效, 在最终的命令中无法体现对包的 link.
add_rules("lex", "yacc")
正确添加 link 相关参数
最小复现: https://github.com/myuanz/test-packages-with-yacc
命令行输出:
myuan@myuan-precision7920tower ~/p/t/test-packages-with-yacc (master) [255]> xmake -r -v [ 20%]: compiling.yacc src/calc.y /usr/bin/bison -d -o build/.gens/test-cjson/linux/x86_64/release/rules/yacc_yacc/calc.tab.c src/calc.y /opt/cuda/bin/gcc -c -m64 -fvisibility=hidden -O3 -Ibuild/.gens/test-cjson/linux/x86_64/release/rules/yacc_yacc -isystem /home/myuan/.xmake/packages/c/cjson/1.7.15/385bd0d4d94d4d20b56a4adc35851b4c/include -DNDEBUG -o build/.objs/test-cjson/linux/x86_64/release/gens/rules/yacc_yacc/calc.tab.c.o build/.gens/test-cjson/linux/x86_64/release/rules/yacc_yacc/calc.tab.c [ 40%]: compiling.lex src/calc.l /usr/bin/flex -o build/.gens/test-cjson/linux/x86_64/release/rules/lex_yacc/calc.c src/calc.l /opt/cuda/bin/gcc -c -m64 -fvisibility=hidden -O3 -Ibuild/.gens/test-cjson/linux/x86_64/release/rules/yacc_yacc -isystem /home/myuan/.xmake/packages/c/cjson/1.7.15/385bd0d4d94d4d20b56a4adc35851b4c/include -DNDEBUG -o build/.objs/test-cjson/linux/x86_64/release/gens/rules/lex_yacc/calc.c.o build/.gens/test-cjson/linux/x86_64/release/rules/lex_yacc/calc.c [ 60%]: linking.release test-cjson /opt/cuda/bin/g++ -o build/linux/x86_64/release/test-cjson build/.objs/test-cjson/linux/x86_64/release/gens/rules/yacc_yacc/calc.tab.c.o build/.objs/test-cjson/linux/x86_64/release/gens/rules/lex_yacc/calc.c.o -m64 error: /usr/bin/ld: build/.objs/test-cjson/linux/x86_64/release/gens/rules/yacc_yacc/calc.tab.c.o: in function `main': calc.tab.c:(.text.startup+0x5): undefined reference to `cJSON_CreateObject' collect2: 错误:ld 返回 1
手动添加如下一行后:
add_ldflags("-L/home/myuan/.xmake/packages/c/cjson/1.7.15/385bd0d4d94d4d20b56a4adc35851b4c/lib/ -lcjson")
可以正常编译. 在新的普通的 xmake C 项目中, 无此行也可以正常编译
The text was updated successfully, but these errors were encountered:
那是因为你没加任何 .c/cpp 文件参与编译,xmake 无法识别作为 c++ 项目,会缺少执行 c++ 相关的 rules。。
一种就是你加个空的 .c/.cpp 文件参与编译,要么就是人为配置上 add_rules("c++") 作为 c++ 项目
add_rules("c++")
Sorry, something went wrong.
理想的做法应该是添加包又没有 C/C++ 规则时给出一些警告, 或者使用 yacc/lex 时自动添加 C/C++ 规则, 毕竟这套规则就是基于 C/C++ 的. 普通的做法应该是给文档加上两句提示.
你打算实现一些新功能吗? 不打算的话, 我去文档加两句话
加上了
呃 好吧 谢啦, 期待下一个大版本
No branches or pull requests
Xmake 版本
v2.6.9
操作系统版本和架构
Linux myuan-precision7920tower 5.10.129-1-MANJARO #1 SMP PREEMPT Thu Jul 7 16:56:51 UTC 2022 x86_64 GNU/Linux
描述问题
当使用规则
add_rules("lex", "yacc")
时, 添加的包无效, 在最终的命令中无法体现对包的 link.期待的结果
正确添加 link 相关参数
工程配置
最小复现: https://github.com/myuanz/test-packages-with-yacc
附加信息和错误日志
命令行输出:
手动添加如下一行后:
可以正常编译. 在新的普通的 xmake C 项目中, 无此行也可以正常编译
The text was updated successfully, but these errors were encountered: