Code Monkey home page Code Monkey logo

gear-lib's People

Contributors

alenwp avatar dianjixz avatar gozfree avatar hanyli avatar leiless avatar luhuadong avatar mamins1376 avatar oopy avatar quasi-mod avatar szsam avatar xwyam avatar zhuocaihua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gear-lib's Issues

Segmentation fault at iniparser_getstring function

96 ini_test();
(gdb) n
ini_test
year = 2019

Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106 ../sysdeps/x86_64/strlen.S: No such file or directory.
(gdb) bt
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
#1 0x0000000000409cc2 in xstrdup (s=0x7fff0040a635 <error: Cannot access memory at address 0x7fff0040a635>) at ini/dictionary.c:68
#2 0x0000000000408d87 in iniparser_getstring (d=0x60f280, key=0x7fff0040a635 <error: Cannot access memory at address 0x7fff0040a635>, def=0x0)
at ini/iniparser.c:368
#3 0x0000000000401c02 in ini_get_string (c=0x60e010) at ini/ini_config.c:77
#4 0x000000000040115f in ini_test () at test_libconfig.c:41
#5 0x00000000004011e2 in main (argc=1, argv=0x7fffffffe598) at test_libconfig.c:96
(gdb) f 3
#3 0x0000000000401c02 in ini_get_string (c=0x60e010) at ini/ini_config.c:77
77 ret = iniparser_getstring(ini, type_list[cnt-1].cval, NULL);
(gdb) p type_list
$1 = (struct int_charp *) 0x60f080
(gdb) p *type_list
$2 = {type = 1, {ival = 4236853, cval = 0x7fff0040a635 <error: Cannot access memory at address 0x7fff0040a635>}}

Compile libdebug.c errpr

libdebug.c:75:5: error: ‘SIGUNUSED’ undeclared here (not in a function); did you mean ‘SI_USER’?
SIGUNUSED /* 31 */
^~~~~~~~~
SI_USER

Under Ubuntu 18.04, try to compile libraries, above is error information. How to fix it?
Thanks.

libdict dict_del function logic flaw

To reproduce:

char s[105];
int main()
{
dict *d = dict_new();
read( 0, s, 100 ); // input 100 zeros, i.e., '00000000'...
dict_del( d, s ); // successful, now d->used==-1
return 0;
}

By the way, dict_free(d) doesn't check if dict is valid, may lead to heap crash.
To reproduce:

int main()
{
dict *d = dict_new();
dict_free( d );
dict_free( d ); // heap crash
return 0;
}

windows gcc 编译,MsvcLibX库无法编译

我在 windows10 用 x86_64-w64-mingw32 编译这个库的时候,libposix 这个库一直没编译通过,主要是 libposix4win.h 这个头文件依赖 MsvcLibX 这个库的 msvclibx.h 这个头文件。但是这个库是是专为微软的 vc++ 使用的,这就造成了一个问题,我无法使用 windows下的x86_64-w64-mingw32-gcc 编译器编译通过。所以想求助一下,怎样让 x86_64-w64-mingw32-gcc 正常编译通过 libposix 库。

# gcc -v
Using built-in specs.
COLLECT_GCC=E:\aapstar\gcc\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=E:/aapstar/gcc/mingw32/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-win32-sjlj-rt_v6-rev0/mingw64 --enable-shared --enable-static --enable-targets=all --enable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-sjlj-exceptions --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch-32=i686 --with-arch-64=nocona --with-tune-32=generic --with-tune-64=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-sjlj-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-sjlj-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-sjlj-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-win32-sjlj-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-win32-sjlj-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: win32
gcc version 8.1.0 (x86_64-win32-sjlj-rev0, Built by MinGW-W64 project) 

Who to contact for security issues

Hey there!

I belong to an open source security research community, and a member (@geeknik) has found an issue, but doesn’t know the best way to disclose it.

If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

Thank you for your consideration, and I look forward to hearing from you!

(cc @huntr-helper)

内存池

现在设计一个内存池确实有些显得蛋疼,要是不用C语言,语言已经简化到不用关心内存是在堆内存还是在栈内存上了,内存管理算法这种高级货真是只为情怀而来

libuvc - test_libuvc.c - errno: 22

Hi, there.

I try to test linuvc library and got the following report.

[V4L2 Input information]:
	input.name: 	"Camera 1"
			 CAMERA
[V4L2 Capability Information]:
	cap.driver: 	"uvcvideo"
	cap.card: 	"XiaoMi USB 2.0 Webcam: XiaoMi U"
	cap.bus_info: 	"usb-0000:00:14.0-5"
	cap.version: 	"266002"
	cap.capabilities:
			 VIDEO_CAPTURE
			 STREAMING
[V4L2 Support Format]:
	0. [YUYV] "YUYV 4:2:2"
	1. [MJPG] "Motion-JPEG"
[V4L2 Supported Control]:
	Brightness, range: [-64, 64], default: 0, current: 0
	Contrast, range: [0, 95], default: 0, current: 0
	Saturation, range: [0, 100], default: 64, current: 64
	Hue, range: [-2000, 2000], default: 0, current: 0
	White Balance Temperature, Auto, range: [0, 1], default: 1, current: 1
	Gamma, range: [100, 300], default: 100, current: 100
	Power Line Frequency, range: [0, 2], default: 1, current: 1
	White Balance Temperature, range: [2800, 6500], default: 4600, current: 4600
	Sharpness, range: [1, 7], default: 2, current: 2
	Backlight Compensation, range: [0, 3], default: 3, current: 3
v4l2_buf_enqueue - ioctl(VIDIOC_QBUF) failed: 22

The last line report errno = 22. My host is Ubutun 16.04. And the output yuv file cannot be played by ffplay without any modification of source code.

license issue

Hi, nice work you have done here!

GPL v2 is somewhat problematic. It cannot be linked against GPLv3 code: http://gplv3.fsf.org/dd3-faq

I suggest to either release this as GPLv2+, or LGPL. LGPL is more appropriate for a library.

hisi35xx cross platform compiling failed [-Werror=strict-aliasing]

Hi I'm compiling the gear-lib using hisi-toolchain。
modify build/pi.inc config to CROSS_PREFIX=aarch64-himix200-linux-
Then ./build.sh all pi release

Error occurs:

==== clean hisi libipc done.
==== build hisi libposix done.
==== build hisi libtime done.
==== build hisi liblog done.
libserializer.c: In function 's_wlf':
libserializer.c:172:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     s_wl32(s, *(uint32_t *)&f);
     ^~~~~~
libserializer.c: In function 's_wld':
libserializer.c:177:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     s_wl64(s, *(uint64_t *)&d);
     ^~~~~~
libserializer.c: In function 's_wbf':
libserializer.c:206:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     s_wb32(s, *(uint32_t *)&f);
     ^~~~~~
libserializer.c: In function 's_wbd':
libserializer.c:211:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     s_wb64(s, *(uint64_t *)&d);
     ^~~~~~
cc1: all warnings being treated as errors

libconfig iniparser causes heap crash

To reproduce: use equal mark inside a bracket

crash testcase:

cat /tmp/testCase.ini
[000000000000000000=00000000]

./test_libconfig
realloc(): invalid next size
Aborted (core dumped)

关于编译版本问题

目前的Makefile/Android.mk/Makefile.nmake内容都是按debug模式编译输出。没有计划提供release模式?
由于涉及全部内容模块,我没有在版本中修改,每次使用都需要手工提换Makefile,你这边有没有统一修改计划?
我修改内容如下,可作参考
Linux debug版:
使用现在Makefile
release版
去除-g 添加,-O2后-Os,模块编译完毕添加strip

Android debug版:
使用现在Android.mk
release版
添加LOCAL_STRIP_MODULE=ture,LOCAL_CFLAGS += -O2

windows Debug 版本:
使用现在Makefile.nmake
Release 版本:
CFLAGS = $(CFLAGS) /Od /W3 /Zi
修改为
CFLAGS = $(CFLAGS) /O2 /GF

gear-lib/libposix.h: No such file or directory

  • When execute ./build.sh, output errors are as following:
In file included from libthread.c:26:0:
libthread.h:25:10: fatal error: gear-lib/libposix.h: No such file or directory
 #include <gear-lib/libposix.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [libthread.o] Error 1

编译报错

make: *** No rule to make target 'libipc/msgq.o', needed by 'liblightlib.a'。 停止。

顶层Makefile的问题
-libipc/msgq.o
+libipc/msgq_posix.o
+libipc/msgq_sysv.o \

Linux complie problem.

root@ubuntu:/libraries# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1
14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)

root@ubuntu:~/libraries# ./build.sh
==== clean linux libmacro done.
==== clean linux libatomic done.
==== clean linux libtime done.
==== clean linux liblog done.
==== clean linux libgevent done.
==== clean linux libworkq done.
==== clean linux libdict done.
==== clean linux libsort done.
==== clean linux librbtree done.
==== clean linux libringbuffer done.
==== clean linux liblock done.
==== clean linux libthread done.
==== clean linux libconfig done.
==== clean linux libosal done.
==== clean linux libvector done.
==== clean linux libdebug done.
==== clean linux libfile done.
==== clean linux libskt done.
==== clean linux libstun done.
==== clean linux libptcp done.
==== clean linux librpc done.
==== clean linux libp2p done.
==== clean linux libipc done.
==== build linux libmacro done.
==== build linux libatomic done.
==== build linux libtime done.
==== build linux liblog done.
==== build linux libgevent done.
==== build linux libworkq done.
==== build linux libdict done.
==== build linux libsort done.
==== build linux librbtree done.
==== build linux libringbuffer done.
test_liblock.c: In function ‘print_mutex_lock’:
test_liblock.c:45:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (uint64_t i = 0; i < n; ++ i) {
^
test_liblock.c:45:5: note: use option -std=c99 or -std=gnu99 to compile your code
test_liblock.c: In function ‘print_spin_lock’:
test_liblock.c:72:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (uint64_t i = 0; i < n; ++ i) {
^
make: *** [test_liblock.o] Error 1
==== build linux liblock failed
In file included from libthread.c:13:0:
libthread.h:14:21: fatal error: liblock.h: No such file or directory
#include <liblock.h>
^
compilation terminated.
make: *** [libthread.o] Error 1
==== build linux libthread failed
Package lua5.2 was not found in the pkg-config search path.
Perhaps you should add the directory containing lua5.2.pc' to the PKG_CONFIG_PATH environment variable No package 'lua5.2' found Package lua5.2 was not found in the pkg-config search path. Perhaps you should add the directory containinglua5.2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua5.2' found
Package lua5.2 was not found in the pkg-config search path.
Perhaps you should add the directory containing lua5.2.pc' to the PKG_CONFIG_PATH environment variable No package 'lua5.2' found Package lua5.2 was not found in the pkg-config search path. Perhaps you should add the directory containinglua5.2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua5.2' found
Package lua5.2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua5.2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua5.2' found
json/json_config.c:8:21: fatal error: jansson.h: No such file or directory
#include <jansson.h>
^
compilation terminated.
make: *** [json/json_config.o] Error 1
==== build linux libconfig failed
==== build linux libosal done.
==== build linux libvector done.
libdebug.c: In function ‘debug_backtrace_init’:
libdebug.c:121:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (uint32_t i = 0; i < (sizeof(signum) / sizeof(uint32_t)); ++i) {
^
libdebug.c:121:5: note: use option -std=c99 or -std=gnu99 to compile your code
make: *** [libdebug.o] Error 1
==== build linux libdebug failed
==== build linux libfile done.
test_libskt.c:17:23: fatal error: libthread.h: No such file or directory
#include <libthread.h>
^
compilation terminated.
make: *** [test_libskt.o] Error 1
==== build linux libskt failed
==== build linux libstun done.
==== build linux libptcp done.
librpc.c:15:20: fatal error: libskt.h: No such file or directory
#include <libskt.h>
^
compilation terminated.
make: *** [librpc.o] Error 1
==== build linux librpc failed
libp2p.c:21:20: fatal error: libskt.h: No such file or directory
#include <libskt.h>
^
compilation terminated.
make: *** [libp2p.o] Error 1
==== build linux libp2p failed
netlink.c:20:23: fatal error: libthread.h: No such file or directory
#include <libthread.h>
^
compilation terminated.
make: *** [netlink.o] Error 1
==== build linux libipc failed

能出一个CMAKE版本的吗?

我用camke的编译总是编译不过。
camkeLists.txt文件
cmake_minimum_required(VERSION 3.9)
project(JinchengTest)

set(CMAKE_CXX_STANDARD 11)
set(MYLINUX /usr/src/linux-headers-4.2.0-27-generic/include)
include_directories(${MYLINUX})
add_executable(JinchengTest main.cpp
./libipc/libipc.c
./libipc/libipc.h
./libipc/libipc_stub.h
./libipc/msgq_posix.c
./libipc/msgq_sysv.c
./libipc/netlink.c
./libipc/netlink_driver.c
./libipc/netlink_driver.h
./libipc/shm.c
./libipc/unix_socket.c
./libipc/libdict.h
./libipc/libdict.c
./libipc/libmacro.c
./libipc/libmacro.h
./libipc/libgevent.c
./libipc/libgevent.h
./libipc/kernel_list.h
./libipc/kernel_list_win32.h
./libipc/libthread.h
./libipc/libthread.c

    )

编译结果:
7%] Building C object CMakeFiles/JinchengTest.dir/libipc/netlink.c.o
[ 15%] Building C object CMakeFiles/JinchengTest.dir/libipc/netlink_driver.c.o
In file included from /usr/src/linux-headers-4.2.0-27-generic/include/linux/kernel.h:6:0,
from /root/work/c++/JinchengTest/libipc/netlink_driver.c:22:
/usr/src/linux-headers-4.2.0-27-generic/include/linux/linkage.h:7:25: fatal error: asm/linkage.h: No such file or directory
#include <asm/linkage.h>
^
compilation terminated.
In file included from /usr/src/linux-headers-4.2.0-27-generic/include/uapi/linux/capability.h:16:0,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/capability.h:15,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/netlink.h:5,
from /root/work/c++/JinchengTest/libipc/netlink.c:29:
/usr/src/linux-headers-4.2.0-27-generic/include/linux/types.h:14:26: error: conflicting types for ‘fd_set’
typedef __kernel_fd_set fd_set;
^
In file included from /usr/include/i386-linux-gnu/sys/types.h:219:0,
from /usr/include/stdlib.h:314,
from /root/work/c++/JinchengTest/libipc/netlink.c:23:
/usr/include/i386-linux-gnu/sys/select.h:75:5: note: previous declaration of ‘fd_set’ was here
} fd_set;
^
In file included from /usr/src/linux-headers-4.2.0-27-generic/include/uapi/linux/capability.h:16:0,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/capability.h:15,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/netlink.h:5,
from /root/work/c++/JinchengTest/libipc/netlink.c:29:
/usr/src/linux-headers-4.2.0-27-generic/include/linux/types.h:15:25: error: conflicting types for ‘dev_t’
typedef __kernel_dev_t dev_t;
^
In file included from /usr/include/stdlib.h:314:0,
from /root/work/c++/JinchengTest/libipc/netlink.c:23:
/usr/include/i386-linux-gnu/sys/types.h:60:17: note: previous declaration of ‘dev_t’ was here
typedef __dev_t dev_t;
^
In file included from /usr/src/linux-headers-4.2.0-27-generic/include/uapi/linux/capability.h:16:0,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/capability.h:15,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/netlink.h:5,
from /root/work/c++/JinchengTest/libipc/netlink.c:29:
/usr/src/linux-headers-4.2.0-27-generic/include/linux/types.h:17:26: error: conflicting types for ‘mode_t’
typedef __kernel_mode_t mode_t;
^
In file included from /usr/include/stdlib.h:314:0,
from /root/work/c++/JinchengTest/libipc/netlink.c:23:
/usr/include/i386-linux-gnu/sys/types.h:70:18: note: previous declaration of ‘mode_t’ was here
typedef __mode_t mode_t;
^
In file included from /usr/src/linux-headers-4.2.0-27-generic/include/uapi/linux/capability.h:16:0,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/capability.h:15,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/netlink.h:5,
from /root/work/c++/JinchengTest/libipc/netlink.c:29:
/usr/src/linux-headers-4.2.0-27-generic/include/linux/types.h:25:26: error: conflicting types for ‘timer_t’
typedef __kernel_timer_t timer_t;
^
In file included from /usr/include/i386-linux-gnu/sys/types.h:132:0,
from /usr/include/stdlib.h:314,
from /root/work/c++/JinchengTest/libipc/netlink.c:23:
/usr/include/time.h:103:19: note: previous declaration of ‘timer_t’ was here
typedef __timer_t timer_t;
^
In file included from /usr/src/linux-headers-4.2.0-27-generic/include/uapi/linux/capability.h:16:0,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/capability.h:15,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/netlink.h:5,
from /root/work/c++/JinchengTest/libipc/netlink.c:29:
/usr/src/linux-headers-4.2.0-27-generic/include/linux/types.h:134:23: error: conflicting types for ‘blkcnt_t’
typedef unsigned long blkcnt_t;
^
In file included from /usr/include/stdlib.h:314:0,
from /root/work/c++/JinchengTest/libipc/netlink.c:23:
/usr/include/i386-linux-gnu/sys/types.h:235:20: note: previous declaration of ‘blkcnt_t’ was here
typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
^
In file included from /usr/src/linux-headers-4.2.0-27-generic/include/linux/kernel.h:6:0,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/skbuff.h:17,
from /usr/src/linux-headers-4.2.0-27-generic/include/linux/netlink.h:6,
from /root/work/c++/JinchengTest/libipc/netlink.c:29:
/usr/src/linux-headers-4.2.0-27-generic/include/linux/linkage.h:7:25: fatal error: asm/linkage.h: No such file or directory
#include <asm/linkage.h>
^
compilation terminated.
make[2]: *** [CMakeFiles/JinchengTest.dir/libipc/netlink_driver.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/JinchengTest.dir/libipc/netlink.c.o] Error 1
make[1]: *** [CMakeFiles/JinchengTest.dir/all] Error 2
make: *** [all] Error 2

liblog.c bug report

你好,我在您liblog.c 的get_proc_name 函数中,觉得有两处地方不妥,您看看是否正确

line 191 原 proc = (char *)calloc(1, i); 应改为 proc = (char *)calloc(1, ret - i);
line 193 原 strncpy(proc, ptr, i); 应改为 strncpy(proc, ptr, ret - i);

测试场景:(当proc_name 长度大于 路径长度时,原有代码功能就不对了。)
example: /home/proc_name_test.out

librtmp发送h264数据到nginx-rtmp无法播放

librtmp发送h264数据到nginx-rtmp无法播放,
const char *url = "rtmp://127.0.0.1:1935/live/test";
rtmp = rtmp_create(url);
rtmp_stream_start(rtmp);
int ret = rtmp_stream_add(rtmp, RTMP_DATA_H264, &h264_data); 这个是需要什么时候调用
live555 出来的数据直接发送到
rtmp_send_data(rtmp, RTMP_DATA_H264, (uint8_t *)data, h264_data.iov_len, 0);
示例代码比较少,不知道哪儿有问题,还是h264裸数据流需要特殊处理下,谢谢大神!

libp2p编译出错

./build.sh libp2p

libp2p.h:25:10: fatal error: libskt.h: No such file or directory
25 | #include <libskt.h>

修改部分并头文件包含语句后,编译出现如下错误:
libp2p.c: In function ‘on_rpc_read’:
libp2p.c:208:5: error: too few arguments to function ‘process_msg’
208 | process_msg(r, buf);
| ^~~~~~~~~~~

...

libp2p库是没有维护了吗?

One compile issue.

==== clean linux libmacro done.
==== clean linux libatomic done.
==== clean linux libtime done.
==== clean linux liblog done.
==== clean linux libgevent done.
==== clean linux libworkq done.
==== clean linux libdict done.
==== clean linux libsort done.
==== clean linux librbtree done.
==== clean linux libringbuffer done.
==== clean linux liblock done.
==== clean linux libthread done.
==== clean linux libconfig done.
==== clean linux libosal done.
==== clean linux libvector done.
==== clean linux libdebug done.
==== clean linux libfile done.
==== clean linux libskt done.
==== clean linux libstun done.
==== clean linux libptcp done.
==== clean linux librpc done.
==== clean linux libp2p done.
==== clean linux libipc done.
==== build linux libmacro done.
==== build linux libatomic done.
==== build linux libtime done.
==== build linux liblog done.
==== build linux libgevent done.
==== build linux libworkq done.
==== build linux libdict done.
==== build linux libsort done.
==== build linux librbtree done.
==== build linux libringbuffer done.
==== build linux liblock done.
==== build linux libthread done.
==== build linux libconfig done.
test_libosal.c:10:21: fatal error: libosal.h: No such file or directory
#include <libosal.h>
^
compilation terminated.
make: *** [test_libosal.o] Error 1
==== build linux libosal failed
==== build linux libvector done.
==== build linux libdebug done.
==== build linux libfile done.
==== build linux libskt done.
==== build linux libstun done.
==== build linux libptcp done.
==== build linux librpc done.
==== build linux libp2p done.
==== build linux libipc done.

[Bug][compile] compile error on Ubuntu 16.04 with commit c3315ef46d3e4038cac3c8df43a53c4172425102

问题描述:

  1. git clone拿到代码编译运行,会报一系列的编译错误。
  2. 这些错误的原因都是因为有开源库的依赖,比如lua.h 找不到,x264的库找不到
    这些在INSTALL.md里面都找不到说明,有以下两点建议:
    a. 在install.md 说明相关依赖
    b. install.md 里面新增单个模块的编译指令的说明,build.sh 也支持单个模块编译的方法(看了下build.sh 找到单独编译的指令啦)

liblock.c mutex_cond_wait() bug report

liblock.c line 237 and 238 in the mutex_cond_wait() function:

ts.tv_sec += ms / 1000;
ts.tv_nsec += (ms % 1000) * 1000000;

But personally , I think it should be :

struct timespec now;
ts.tv_sec = now.tv_sec + ms / 1000 + ( now.tv_nsec + (ms % 1000) * 1000000 ) / (1000_1000_1000);

ts.tv_nsec = ( now.tv_nsec + (ms % 1000) * 1000000 ) % (1000 * 1000 *1000);

example:
ts.tv_sec = 0 ts.tv_nsec = 999 000 000 ms = 2

then after calculate, the right time should be :
ts.tv_sec = 1 ts.tv_nsec = 001 000 000
but you code will calculate the time will be wrong .

The same as line 507, in function sem_lock_wait()
if any question, contact me [email protected]

libipc compile error

libipc compile error as follows:

msgq_posix.c: In function ‘_mq_notify_update’:
msgq_posix.c:69:23: error: ‘SIGEV_THREAD’ undeclared (first use in this function); did you mean ‘EVENT_READ’?
sv.sigev_notify = SIGEV_THREAD;
^~~~~~~~~~~~
EVENT_READ
msgq_posix.c:69:23: note: each undeclared identifier is reported only once for each function it appears in
make: *** [msgq_posix.o] Error 1
==== build linux libipc failed

I fix it by adding #include <signal.h> in the file.

aarch64 ubuntu release compile error

hi, I'm compile in arm box with ubuntu 16.04 , debug is ok ,but release print errors ,
==== clean linux libmacro done.
==== clean linux libtime done.
==== clean linux liblog done.
==== clean linux libgevent done.
==== clean linux libworkq done.
==== clean linux libdict done.
==== clean linux libhash done.
==== clean linux libsort done.
==== clean linux librbtree done.
==== clean linux libringbuffer done.
==== clean linux libthread done.
==== clean linux libconfig done.
==== clean linux libvector done.
==== clean linux libbase64 done.
==== clean linux libdebug done.
==== clean linux libfile done.
==== clean linux libuvc done.
==== clean linux libmp4parser done.
==== clean linux libqueue done.
==== clean linux libplugin done.
==== clean linux libhal done.
==== clean linux libsubmask done.
==== clean linux libskt done.
==== clean linux librpc done.
==== clean linux librtsp done.
==== clean linux libipc done.
==== build linux libmacro done.
libtime.c: In function ‘int time_get_info_by_utc(uint32_t, time_info*)’:
libtime.c:193:5: error: ‘%03d’ directive output may be truncated writing between 3 and 5 bytes into a region of size 4 [-Werror=format-truncation=]
int time_get_info_by_utc(uint32_t utc, struct time_info ti)
^~~~~~~~~~~~~~~~~~~~
libtime.c:193:5: note: directive argument in the range [0, 65535]
In file included from /usr/include/stdio.h:862:0,
from libtime.c:22:
/usr/include/aarch64-linux-gnu/bits/stdio2.h:65:44: note: ‘__builtin___snprintf_chk’ output between 4 and 6 bytes into a destination of size 4
__bos (__s), __fmt, __va_arg_pack ());
^
libtime.c: In function ‘int time_get_info_by_msec(uint64_t, time_info
)’:
libtime.c:227:5: error: ‘%03d’ directive output may be truncated writing between 3 and 5 bytes into a region of size 4 [-Werror=format-truncation=]
int time_get_info_by_msec(uint64_t msec, struct time_info ti)
^~~~~~~~~~~~~~~~~~~~~
libtime.c:227:5: note: directive argument in the range [0, 65535]
In file included from /usr/include/stdio.h:862:0,
from libtime.c:22:
/usr/include/aarch64-linux-gnu/bits/stdio2.h:65:44: note: ‘__builtin___snprintf_chk’ output between 4 and 6 bytes into a destination of size 4
__bos (__s), __fmt, __va_arg_pack ());
^
libtime.c: In function ‘int time_get_info(time_info
)’:
libtime.c:267:5: error: ‘%03d’ directive output may be truncated writing between 3 and 5 bytes into a region of size 4 [-Werror=format-truncation=]
int time_get_info(struct time_info *ti)
^~~~~~~~~~~~~
libtime.c:267:5: note: directive argument in the range [0, 65535]
In file included from /usr/include/stdio.h:862:0,
from libtime.c:22:
/usr/include/aarch64-linux-gnu/bits/stdio2.h:65:44: note: ‘__builtin___snprintf_chk’ output between 4 and 6 bytes into a destination of size 4
__bos (__s), __fmt, __va_arg_pack ());
^
cc1plus: all warnings being treated as errors
make: *** [libtime.o] Error 1

hisi35xx cross platform compile

hisi cross platform compile error ,
modify build.sh pi config to CROSS_PREFIX=aarch64-himix100-linux-
use ./build.sh all pi release
and i got this error :
==== build pi libhal done.
==== build pi libsubmask done.
==== build pi libskt done.
gcc: error: missing argument to ‘-L’
make: *** [test_librpc] Error 1

another problem is i use run objdump -d libbase64.so
it show libbase64.so: elf64-x86-64, not elf64-little

thansk.

raspi board build failed

下的release压缩包 直接解压build
image
这个头文件是有的 怎么还是提示缺少 路径也已经包含进去了
而且我在build all 的时候 会出现各种错误
image
这是gcc版本
image

optimize the liblog splite feature

hello , I have reviewed the liblog.c and I personally think that the _log_write() function could be optimized.
your code are bellow:(from line 382)
log_get_time(_log_name_time, sizeof(_log_name_time), 1);
snprintf(_log_name, sizeof(log_name), "%s%s%s",
_log_path, _log_name_prefix, _log_name_time);
_log_open(_log_name);
fprintf(stderr, "splited file %s\n", _log_name);

but I think they can may be:
log_get_time(_log_name_time, sizeof(log_name_time), 1);
char log_rename[FILENAME_LEN];
snprintf(log_rename, sizeof(log_rename), "%s%s
%s",
_log_path, _log_name_prefix, _log_name_time);
int ret = rename(_log_name,log_rename );
if (ret == -1)
{
fprintf(stderr, "log file splited rename error:%s\n",log_rename );
}
_log_open(_log_name);

In the real production environment, maybe we want to splite the log file to a new renamed file,and connitue to write on the file with old name. So in the code , I suggest to add a rename() function.
Of course, it's all up to you decide.

My English is limited ,if any question , you can contact me [email protected], thanks!

libgevent交叉编译移植到arm上定时器功能并未生效?

这是我在x86 ubuntu下编译运行的结果:
➜ libgevent git:(master) ✗ ./test_libgevent
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
xxx

当我交叉编译到arm linux下运行的结果却如下:
root@imx6d:/home/apps/bin# ./test_libgevent
[ INFO][test_libgevent.c:33: on_input] on_input fd = 7
[ INFO][test_libgevent.c:33: on_input] on_input fd = 6
xxx
现象表明TIMER_PERSIST定时器未生效。是否表明此处存在一个bug?或者是我哪些步骤存在问题导致的?我需要怎么验证找出问题出在哪里?

对了,我是修改了build.sh加了自己的编译工具链,编译出来的arm可执行文件的。
arm交叉编译器为:
➜ libgevent git:(master) ✗ arm-poky-linux-gnueabi-gcc --version
arm-poky-linux-gnueabi-gcc-real (GCC) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

arm cpuinfo 为:
root@imx6d:/home/apps/bin#cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 10 (v7l)
BogoMIPS : 6.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x2
CPU part : 0xc09
CPU revision : 10

processor : 1
model name : ARMv7 Processor rev 10 (v7l)
BogoMIPS : 6.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x2
CPU part : 0xc09
CPU revision : 10

Hardware : Freescale i.MX6 Quad/DualLite (Device Tree)
Revision : 0000
Serial : 0000000000000000

arm linux信息:
root@imx6d:/home/apps/bin#uname -a
Linux imx6d 4.1.15+gb63f3f5 #1 SMP PREEMPT Thu Dec 20 16:51:02 CST 2018 armv7l GNU/Linux

是否还需要其他的信息?希望得到您的回复,十分感谢~
---Rayree

liblog.c bug report

hello , there is a bug in your liblog module source:
liblog.c get_proc_name() line 191 : proc = (char *)calloc(1, i);
=======> proc = (char *)calloc(1, ret - i);

liblog.c get_proc_name() line 193 : strncpy(proc, ptr, i);
=========> strncpy(proc, ptr, ret - i);

bug report :
in order to prevent the follow issue

/home/liblogtest.out

if any question or my report is wrong , please contact me [email protected] for email, thanks

wishlist/愿望清单

gear-lib is a library for IOT, and force on network protocol, multi-media stream,
please write down the feature list you want to use on this issue.
I will plan to achieve them.

gear-lib作为IOT的库,偏向于底层+网络协议+流媒体方向
作为使用者的你,希望新加入什么样的feature,请在该issue下畅所欲言
我会按计划逐步丰富该库

如何参与到该库的开发 / how to involve develop this project

0.项目起源:
最初是2014年,在工作中幸运的经历过从bootloader到linux到filesystem到media stream到android app到web server的整个开发流程,使用过许多开源代码,也造过许多丑陋的轮子.
 项目虽然早已结束,但回头看发现很多值得沉淀的东西,因此闲暇之余就想整理出来,最初想法只是为方便自己快速开发.作为小白码农,从liblog开始了第一个尝试.如果当时看到别人写的大而全的C库,很可能会因为珠玉在前就放弃坚持了,所幸发现这类库总会有各种用的不爽的地方.
 申明下,该项目不涉及公司代码,遵循POSIX/UNIX的原则,尽量做到小而完备.

1.项目定位:
 该库的定位是能基本满足IOT嵌入式/网络服务/流媒体等场景的开发,不再需要从POSIX的底层API写起,可以节省精力做业务逻辑.
 完全使用C代码开发,原因是我不会C++,汗颜...
 对于大部分公司,一般都会有自己完备的基础库,而且对License非常谨慎.因此该库主要面向开源群体或小团队等.

2.项目协作开发:
 如果是新手,可以先从Data Struct部分开始,再复杂庞大的项目,其骨干代码的基本**也是由基本算法数据结构实现的.
 如果是网络服务开发者,可以从Network和Async部分开始,IPC/RPC是绕不开的一环.
 如果是多媒体开发者,可以从MultiMedia部分开始,或者进入到另一个项目aquila
 如果你是高手,欢迎指正.

libvector

In the libvector directory, there is an error in line 66 in the test example and a function may need to be added with the vector_end modification of line 69 of libvector.h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.