Comments (6)
发现:无论是main
还是co_main
都需要存在一个thread_group
类型的变量才能正常静态链接/运行。
from libgo.
首先建议不要使用 -I这种方式, 而是把libgo通过make install安装到系统目录里来include,当然这不影响结果。
1.会出现链接错误是因为gcc静态链接的向后查找机制,libgo_main是依赖于libgo的,所以链接选项中应该把-llibgo_main放在-llibgo的前面!
2.运行时错误是因为gcc的thread相关导致的问题,你可以尝试把-lpthread改为-pthread来解决问题,详细原因参见gcc manpage.
from libgo.
您好!感谢回复:
- 链接的问题已经解决了(无论是调整顺序还是把库重复一遍)
- -pthread没有解决运行时的问题
from libgo.
我比较好奇为什么你不使用libgo里面的cmake来编译教程代码呢?
from libgo.
g++ -std=c++11 sample2_yield.cpp -llibgo_main -llibgo -lboost_coroutine -lboost_context -lboost_thread -lboost_system -ldl -pthread -static -static-libstdc++
这是我刚刚测试使用编译命令,你可以试一下
from libgo.
额,因为CMake好像是用动态链接的方式来的
我只是很好奇为什么会有这种奇怪的现象
至少在g++ (Debian 6.3.0-18) 6.3.0 20170516 + debian 9下还是不行
有可能是debian或者g++的bug
一个会被优化掉的变量不应该对运行时行为产生影响
多谢!
from libgo.
Related Issues (20)
- Apple M2编译成功,但是调用时报错 HOT 1
- 这个库是废了吗 HOT 2
- mutex destroyed while busy问题找到了
- 如果我使用了这个库,是不是我的mysql所有操作,自动就协程化了?同步写代码,实际已经异步i/o。 HOT 1
- stable3.1实现协程亲缘性了吗 HOT 2
- 使用g++11等高版本的编译器去编译master分支,会出现编译错误 HOT 3
- cpu占用高 HOT 6
- 协程内外都调用的同一个函数,函数内有锁有休眠,必锁
- linux下编译错误 undefined reference to 'libgo_jump_fcontext' HOT 1
- hook机制中使用epoll事件唤醒,为什么全部唤醒,直接唤醒fd对应的entry性能不是更高吗?
- windows下协程
- tcp读取数据的时候,断开后一段时间后出现死锁 HOT 17
- AsyncCoroutinePool怎么Post带参数的函数
- win动态库有么 HOT 1
- 支持协程迭代器吗?
- 不阻塞的http post调用 HOT 5
- 有交流群或者联系方式么
- 连接池bug
- 空载延迟达到20us HOT 4
- 请教一下libgo是如何实现栈扩容的
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libgo.