Comments (16)
噢,你是不是没装libevhtp库,先去https://github.com/ellzey/libevhtp 拉下来然后build好之后会生成一个.a文件和所需的.h文件,复制到系统指定目录或者zimg文件夹下面,再make的时候应该就可以了~
from zimg.
libevhtp编译好了,已经将所需的{evhtp.h,evthr.h,htparse.h,onigposix.h}放入/usr/include.
不过memcache照这样做make的时候会遇到这个问题(不知这个依赖应该怎么搞?):
------------执行make ----------
MichaelShiehtekiMacBook-Pro:zimg michael2008s$ make
cc -Wall -c -o zhttpd.o zhttpd.c
In file included from zhttpd.c:22:
In file included from ./zhttpd.h:26:
./zcommon.h:51:3: error: redefinition of 'settings' with a different type
} settings;
^
/usr/local/include/libmemcached/memcached.h:315:24: note: previous definition is here
extern struct settings settings;
^
zhttpd.c:152:2: error: no member named 'log_name' in 'struct settings'
LOG_PRINT(LOG_INFO, "Received a %s request for %s", method_strmap[req_method], uri);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./zcommon.h:69:40: note: expanded from macro 'LOG_PRINT'
int log_id = log_open(settings.log_name, "a"); \
~~~~~~~~ ^
......
from zimg.
哇,你这个问题我得跟一下,这是由于我的zcommon.h中定义的配置文件对象settings和memcached.h中的对象重名了,应该是个BUG,不过在我这边没出现过,我需要追查一下。
from zimg.
其实我也不知道是不是我这边环境的问题,所以麻烦确认一下。
from zimg.
---------------执行make----------
cc -Wall -c -o zhttpd.o zhttpd.c
在包含自 zhttpd.h:26 的文件中,
从 zhttpd.c:22:
zcommon.h:29:36: 错误:libmemcached/memcached.h:没有那个文件或目录
make: *** [zhttpd.o] 错误 1
依赖的库都已经从github上下载下来了,并且都执行了make和make install,能帮我看下什么问题么,本人c语言比较小白。。。
from zimg.
楼上这位,你是因为找不到memcached的头文件。可以去几个常用include目录下找一找,比如/usr/local/include之类,当然如果你是直接github上下的话,去memcached的makefile里看一下它安装到哪儿了,找到libmemcached/memcached.h之后增加一下系统变量,方法网上有,比如这个:http://www.cppblog.com/bujiwu/archive/2009/01/25/72575.html ,应该加入进去之后编译就没问题了。
^_^
from zimg.
昨天刚刚查出来是没有安装libmemcached的库,只安装了memcached这个库。现在问题已经解决了,可以正常编译和运行。
另外有个问题,不知道有没有使用方面的文档?比如如何上传图片、下载图片?
看到了有个test目录,我先试试
from zimg.
恩,test目录下有一些脚本可以参考,由于我自己最近被琐事缠身,文档一直没来得及弄,实在抱歉。
| >_<
from zimg.
我在调用test的post.sh的时候,程序异常退出了。。。
./post.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 29804 0 0 100 29804 0 9257 0:00:03 0:00:03 --:--:-- 9261
curl: (52) Empty reply from server
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) couldn't connect to host
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) couldn't connect to host
服务器显示“段错误 (核心已转储)”然后退出了。
是什么问题呢?
另外,下载图片的时候是通过MD5的值来索引的,那上传图片后服务器是否会返回图片的MD5值呢?还是需要客户端自己生成保存?
多谢抽空回答。。。!
test目录里面的一些脚本无法使用,缺少一些函数定义或者相关文件,比如upload.html点击上传后找不到页面。是没上传全么?望能加下我qq,qq号码已发微博私信。
from zimg.
我挨个答复一下你提到的问题:
我在调用test的post.sh的时候,程序异常退出了。。。
答:你提到的post.sh的错误,post脚本其实是我做的一个压力脚本,你cat出来中间那句:
curl -F "[email protected];type=image/jpeg" "http://127.0.0.1:4869/upload"
单独发一下试试zimg是否还崩溃。
服务器显示“段错误 (核心已转储)”然后退出了。
答:这个问题比较复杂,有可能是压力脚本发送错误请求造成的,也可能是程序BUG,可能需要更多的信息。
那上传图片后服务器是否会返回图片的MD5值呢
答:上传成功后会返回MD5值,如果你用的是upload.html这种通过浏览器上传完了直接返回一个带MD5的页面;如果你用的是上面提到的curl命令上传的话也能收到代码。
upload.html点击上传后找不到页面
答:upload.html不能直接拿去用的,你需要稍微修改一下其中的代码,比如这一段:
action="upload"
你可以改成
action="127.0.0.1:4869/upload"
具体需要依据你的环境来设置。
###最后###
以上这些问题都是因为我没有系统的介绍文档造成的,因为我不用QQ,而且把答案公布在github上也方便别人看,所以就不加了。然后看样子这份文档是迫在眉睫了,毕竟不是所有人都懂这些七七八八的东西,最近实在是参加校招忙晕了都快,各位大大再忍耐几天吧。
from zimg.
感谢回答,期待文档。。。好不容易把环境搭建好,不会使用方法实在是不甘心啊。。。
我在启动zimg的时候加上了日志参数-l,然后启动的时候显示了两个fail:
#./zimg -l
2013/10/10 14:53:47:533478 Thread ID: 3069126464 [INFO] main.c:153 main() Begin to Init the Path zimg Using...
2013/10/10 14:53:47:533917 Thread ID: 3069126464 [INFO] zutil.c:189 is_dir() Path[./log] is A Dir.
2013/10/10 14:53:47:603897 Thread ID: 3069126464 [INFO] zutil.c:189 is_dir() Path[./img] is A Dir.
2013/10/10 14:53:47:604220 Thread ID: 3069126464 [INFO] main.c:187 main() Paths Init Finished.
2013/10/10 14:53:47:604482 Thread ID: 3069126464 [INFO] main.c:191 main() Begin to Init Memcached Connection...
2013/10/10 14:53:47:604858 Thread ID: 3069126464 [INFO] main.c:204 main() Memcached Connection Init Finished.
2013/10/10 14:53:47:605628 Thread ID: 3069126464 [WARNING] zcache.c:177 set_cache() Cache Set(Key: zimg Value: 1) Failed!
2013/10/10 14:53:47:605893 Thread ID: 3069126464 [INFO] zcache.c:179 set_cache() Cache Result: CONNECTION FAILURE
2013/10/10 14:53:47:606149 Thread ID: 3069126464 [WARNING] main.c:207 main() Memcached[127.0.0.1:11211] Connect Failed!
2013/10/10 14:53:47:606392 Thread ID: 3069126464 [INFO] main.c:218 main() Begin to Start Httpd Server...
是哪里没设置好么?
from zimg.
memcached没有启动或者端口不是11211,所以尝试写入缓存的时候失败了,检查一下memcached就好了~
^_^
from zimg.
果然是memcached没有启动。。。
现在启动memcached的时候也报错:
$ ./memcached
Failed writing to notify pipe: Bad file descriptor
Failed writing to notify pipe: Bad file descriptor
Failed writing to notify pipe: Bad file descriptor
Failed writing to notify pipe: Bad file descriptor
Writing to thread notify pipe: Bad file descriptor
Writing to thread notify pipe: Bad file descriptor
Writing to thread notify pipe: Bad file descriptor
Writing to thread notify pipe: Bad file descriptor
Writing to thread notify pipe: Bad file descriptor
Writing to thread notify pipe: Bad file descriptor
Writing to thread notify pipe: Bad file descriptor
Writing to thread notify pipe: Bad file descriptor
在网上和官方网站上都没有找到相应的错误信息,请问知道这是啥问题不。。。
from zimg.
你这问题太有意思了,我查了一下memcached的源码,thread.c里头有这么一段:
191 pthread_mutex_lock(&init_lock);
192 init_count = 0;
193 for (i = 0; i < settings.num_threads; i++) {
194 if (write(threads[i].notify_send_fd, buf, 1) != 1) {
195 perror("Failed writing to notify pipe");
196 /* TODO: This is a fatal problem. Can it ever happen temporarily? */
197 }
198 }
这是在尝试向worker线程发一个字节为1的notify信号的时候,发不过去了弹出的错误,然后memcached的作者还饶有兴致地说“难道这个是随机问题?”,笑死我了。
大致意思就是这属于系统问题,应该是文件描述服开得太多了,是不是你最近起了什么压力测试,有很多连接没关闭什么的,或者你的内存满了,系统能打开的文件描述服是跟剩余内存有关的,建议重启一下电脑试试估计就好了。
^_^
from zimg.
我是在ubuntu虚拟机下做测试的,难道跟这个有关系。。。?分配的内存1g应该够用了吧。。
实在不行我还是找个真机再搞搞吧。。仍然期待作者的文档哈~
刚才试了下,我把虚拟机内存调整到了2g,仍然还是报同样的错误。。。memcached最低内存要求是多少啊?我看启动参数说明好像是默认64M?也不多啊。
亲,好消息,我新建了个centos的虚拟机,把环境重新建了一遍,运行正常了,测试post和get也都可以了,不容易啊。不过还是不知道ubuntu是啥问题。
我用upload.html测试了下,可以正常上传和下载图片,但是我在获取图片的时候在链接后加上w=300&h=300为什么显示404错误呢?
万事具备,只欠使用文档了啊。。。我是要在android下面使用的,所以如果有java调用的例子就最好不过了^_^嘿嘿
from zimg.
现在的版本编译已经十分方便了,故将这个issue close了。
另外zimg加入了默认index.html,比较方便第一次使用了。
from zimg.
Related Issues (20)
- 如何返回base64的图片格式?
- 图片显示不完整
- 官网文档里的很多链接都失效了,辛苦维护一下吧
- 怎么删除图片呢 HOT 1
- zimg 进程异常退出,提示内存越界 HOT 2
- how zimg restart after change config?
- PNG image uploaded successfully, but cannot be accessed HOT 1
- 官方文档wget libevent安装cloud.github.com域名无法解析问题
- 各位大佬 能不能把小视频也集成进来?支持图片和视频 HOT 1
- info 接口获取图片信息很慢,请问可以通过什么参数做优化吗 HOT 1
- 基于centos 8.0 及以上 安装 有问题
- make error HOT 2
- 出现大量 Error from accept() call: Too many open files 错误 HOT 1
- [Building error]: /usr/bin/ld: CMakeFiles/zimg.dir/zaccess.c.o:(.bss+0x0): multiple definition of `settings'; CMakeFiles/zimg.dir/main.c.o:(.bss+0x20): first defined here HOT 2
- make error HOT 1
- 请问zimg硬盘写满了会怎么办,会删除历史数据吗 HOT 2
- centos7 需要安装依赖 HOT 1
- 请求图片导致服务异常退出 HOT 1
- using MinIO or AWS S3 API standard compatible components as the optional Storage replacement? HOT 1
- How does libgsl.a compile into libzimg.a? HOT 1
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 zimg.