gnulib+glib+glibc+libc的不同-转

C库解析
本文介绍了三种C语言库:glibc作为核心C库,提供系统调用和基本函数;gnulib致力于实现POSIX标准,确保跨平台兼容性;glib则为GTK+和Gnome等项目提供了丰富的数据结构和实用功能。

ZZ: http://blog.sina.com.cn/s/blog_5420e00001016r8r.html

============================================

libc指C函数库,这是一个通称

GNU libc就是glibcglibc 是提供系统调用和基本函数的 C 库,比如open, malloc, printf等等。所有动态链接的程序都要用到它。是GNU开发的C库(GNU libc)。
glibc2是glibc的version 2(第二版)。

glib是Gtk +库和Gnome的基础。glib可以在多个平台下使用,比如Linux、Unix、Windows等。GLib为许多标准的、常用的C语言结构提供了相应的替代物。GLib是一组较高层的函数库,其中定义了好多有用的数据结构,如单(双)向链表,可变长的数组等Hash,线程池等有用的东西,在linux中glib是建立在glibc之上的。使用GLib库的程序都应该包含GLib的头文件glib.h。

glib2是glib的第二版。

libstdc++是C++标准I/O库,任何使用GNU的C++编译器G++来编译的C++程序都可以使用libstdc++,它包括了常规的C++例程,比如stl,在linux下,这个库一般放在/usr/lib目录下。

 

有个错误的观点:认为Glib是GNU的东东.(因为前面那个"g"),而Glibc是Glib的一个子集.
    其实,Glib和Glibc基本上没有太大的联系,可能唯一的共同点就是他们都是UNIX下C编程调用的库而已. Glib是GTK+调用的底层核心库.(GTK+由开发GIMP的一些工具包集合发展而来).GIMP和Gnome这样的图形界面程序都是基于GTK+的.
    大家都知道C本身缺少数据结构,和一些重要的处理函数,C本身最复杂的数据结构也就是数组了.那么当你需要一个数据结构的话就自己得定义.幸好前人已经帮我们完成这个工作.他们把这写常用的数据结构和处理方法包装成一个库.其中之一就是Glib了.Glib中 定义了很多有用的数据结构.如数组(长度可变),单(双)向链表,hash表,队列,还有关系(学过关系型数据库的都应该知道这个概念).一些常用的处理 方法如:字符串的处理,标准输出(g_print等),错误输出,日志记录,为了portable而定义的一些基本数据类型(gint,gchar, guint等)极其他们的限制,还有事件循环,线程,IO操作等.
    GTK+和如今的多数GUI编程语言一样,基于消息传递与事件处理(GTK+里用信号,和消息的本质是一样的,只不过是前人帮我们定义好了而已).象 JAVA一样,GTK+中为我们定义好了容器,面板,组件等器件,调用就行了.而他本身又调用了Glib的好多东西.
    Glibc是GNU开发的C库,和libc中好多东西重复.

=====================================================================================

这个应该理解成:三者各自适合不同的开发场景;相似的例子:什么时候项目用C开发,什么项目又可以基于JVM用JAVA开发;

1. glibc 
[ http://www.gnu.org/s/libc/ ]
任何类unix系统都需要一个C库,功能上包括系统调用与基本C函数。可以理解成实现C函数库一个最基本的库,也就是CRT(C Runtime C运行时库)。不同的平台上都各自有自己的C运行库,windows的包含在VC里;
重点:C语言基本库

2. gnulib
[ http://www.gnu.org/software/gnulib/ ]
GUN组织有一个美好的愿景:只要是遵守GNU POSIX标准开发的软件,可以运行在任何GNU POSIX标准操作系统上。当你需要开发POSIX标准的软件时,你自然先需要这么一个标准库,这就是GNULIB;现实中,各操作系统所提供的开发API甚至C标准函数都不是完全一样的。
重点:POSIX标准

3. glib
[ http://www.gtk.org/ ]
A. 理解GLib的关键在于了解它的历史,简单说来,GLib来自于GTK,GTK源自于GIMP.GIMP是GNU Image Manipulation Program(GNU图像处理程序)的缩写;
B. Glib是什么,有什么?Glib的开发并不与glibc冲突,Glib延伸了C的功能,添加了许多数据结果,添加了一些开发图形系统需要的一些消息处理机制...,它是GIMP组织在实际开发中不断地提炼出来的产物。

ERROR: qtwayland-5.15.3+gitAUTOINC+f9dfeb6e72-r0 do_configure: Error calling /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/recipe-sysroot-native/usr/bin/qmake -makefile -o Makefile QT_BUILD_PARTS-=examples QT_BUILD_PARTS-=tests /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/git/qtwayland.pro -- -no-feature-wayland-brcm -feature-wayland-client -no-feature-wayland-drm-egl-server-buffer -feature-wayland-egl -no-feature-wayland-libhybris-egl-server-buffer -feature-wayland-server -feature-wayland-vulkan-server-buffer -no-feature-xcomposite-egl -no-feature-xcomposite-glx ERROR: qtwayland-5.15.3+gitAUTOINC+f9dfeb6e72-r0 do_configure: ExecutionError('/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/temp/run.do_configure.120055', 1, None, None) ERROR: Logfile of failure stored in: /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/temp/log.do_configure.120055 Log data follows: | DEBUG: Executing python function extend_recipe_sysroot | NOTE: Direct dependencies are ['/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta-joynext/meta-qt5/recipes-qt/qt5/qtbase-native_git.bb:do_populate_sysroot', '/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta-joynext/meta-qt5/recipes-qt/qt5/qtbase_git.bb:do_populate_sysroot', '/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta-joynext/meta-qt5/recipes-qt/qt5/qtdeclarative_git.bb:do_populate_sysroot', '/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta-qti-distro/recipes-graphics/vulkan/vulkan-headers_1.2.162.0.bb:do_populate_sysroot', '/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta-qti-gfx-prop/recipes/adreno/adreno_2.0.bb:do_populate_sysroot', '/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta/recipes-core/glibc/glibc_2.35.bb:do_populate_sysroot', '/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta/recipes-devtools/gcc/gcc-cross_11.5.bb:do_populate_sysroot', '/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta/recipes-devtools/gcc/gcc-runtime_11.5.bb:do_populate_sysroot', '/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta/recipes-devtools/quilt/quilt-native_0.67.bb:do_populate_sysroot', '/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta/recipes-graphics/wayland/wayland_1.20.0.bb:do_populate_sysroot', '/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta/recipes-graphics/xorg-lib/libxkbcommon_1.4.1.bb:do_populate_sysroot', 'virtual:native:/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta-joynext/meta-qt5/recipes-qt/qt5/qtwayland_git.bb:do_populate_sysroot', 'virtual:native:/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta/recipes-devtools/patch/patch_2.7.6.bb:do_populate_sysroot', 'virtual:native:/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb:do_populate_sysroot', 'virtual:native:/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', 'virtual:native:/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta/recipes-graphics/wayland/wayland_1.20.0.bb:do_populate_sysroot'] | NOTE: Installed into sysroot: [] | NOTE: Skipping as already exists in sysroot: ['qtbase-native', 'qtbase', 'qtdeclarative', 'vulkan-headers', 'adreno', 'glibc', 'gcc-cross-aarch64', 'gcc-runtime', 'quilt-native', 'wayland', 'libxkbcommon', 'qtwayland-native', 'patch-native', 'pkgconfig-native', 'pseudo-native', 'wayland-native', 'qtdeclarative-native', 'zlib-native', 'dbus-native', 'libgcc', 'linux-libc-headers', 'libsync', 'liblog', 'libdmabufheap', 'gbm', 'libutils', 'libcutils', 'linux-msm-headers', 'glib-2.0', 'libtool-native', 'libxml2', 'libffi', 'expat', 'wayland-protocols', 'python3-native', 'expat-native', 'xz-native', 'libffi-native', 'libxml2-native', 'attr-native', 'flex-native', 'libmpc-native', 'binutils-cross-aarch64', 'texinfo-dummy-native', 'gnu-config-native', 'mpfr-native', 'gmp-native', 'zstd-native', 'gettext-minimal-native', 'glib-2.0-native', 'libion', 'libbase', 'libvmmem', 'displaydlkm-headers', 'display-commonsys', 'safe-iop', 'util-linux', 'libselinux', 'bash-completion', 'zlib', 'libpcre', 'python3', 'ncurses-native', 'readline-native', 'libnsl2-native', 'util-linux-libuuid-native', 'openssl-native', 'sqlite3-native', 'bzip2-native', 'gdbm-native', 'libtirpc-native', 'cmake-native', 'm4-native', 'util-linux-native', 'libpcre-native', 'gettext-native', 'libvmmem-headers', 'llvm-arm-toolchain-libs-ship', 'libcap-ng', 'opkg-utils', 'libxcrypt', 'util-linux-libuuid', 'libpam', 'ncurses', 'libsepol', 'bzip2', 'openssl', 'sqlite3', 'libnsl2', 'readline', 'libtirpc', 'xz', 'gdbm', 'perl-native', 'curl-native', 'libpcre2-native', 'libcap-ng-native', 'flex', 'cracklib', 'make-native'] | DEBUG: Python function extend_recipe_sysroot finished | DEBUG: Executing shell function qmake5_base_preconfigure | DEBUG: Shell function qmake5_base_preconfigure finished | DEBUG: Executing shell function do_configure | NOTE: qmake prevar substitution: ' QT_BUILD_PARTS-=examples QT_BUILD_PARTS-=tests ' | NOTE: qmake configure substitution: ' -no-feature-wayland-brcm -feature-wayland-client -no-feature-wayland-drm-egl-server-buffer -feature-wayland-egl -no-feature-wayland-libhybris-egl-server-buffer -feature-wayland-server -feature-wayland-vulkan-server-buffer -no-feature-xcomposite-egl -no-feature-xcomposite-glx' | | Running configuration tests... | Done running configuration tests. | | Configure summary: | | Qt Wayland Drivers: | EGL .................................... yes | Raspberry Pi ........................... no | XComposite EGL ......................... no | XComposite GLX ......................... no | DRM EGL ................................ no | libhybris EGL .......................... no | Linux dma-buf server buffer integration . no | Vulkan-based server buffer integration . no | Shm emulation server buffer integration . yes | Qt Wayland Client Shell Integrations: | xdg-shell .............................. yes | xdg-shell unstable v5 (deprecated) ..... yes | xdg-shell unstable v6 .................. yes | ivi-shell .............................. yes | wl-shell (deprecated) .................. yes | Qt Wayland Client ........................ yes | Qt Wayland Compositor .................... yes | Qt Wayland Compositor Layer Plugins: | VSP2 hardware layer integration ........ no | | ERROR: Feature 'wayland-vulkan-server-buffer' was enabled, but the pre-condition 'features.wayland-client && features.vulkan && features.opengl && features.egl && tests.vulkan-server-buffer' failed. | | ERROR: Feature 'wayland-vulkan-server-buffer' was enabled, but the pre-condition 'features.wayland-server && features.vulkan && features.opengl && features.egl && tests.vulkan-server-buffer' failed. | | Check config.log for details. | ERROR: Error calling /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/recipe-sysroot-native/usr/bin/qmake -makefile -o Makefile QT_BUILD_PARTS-=examples QT_BUILD_PARTS-=tests /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/git/qtwayland.pro -- -no-feature-wayland-brcm -feature-wayland-client -no-feature-wayland-drm-egl-server-buffer -feature-wayland-egl -no-feature-wayland-libhybris-egl-server-buffer -feature-wayland-server -feature-wayland-vulkan-server-buffer -no-feature-xcomposite-egl -no-feature-xcomposite-glx | WARNING: /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/temp/run.do_configure.120055:210 exit 1 from 'exit 1' | WARNING: Backtrace (BB generated script): | #1: bbfatal_log, /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/temp/run.do_configure.120055, line 210 | #2: die, /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/temp/run.do_configure.120055, line 200 | #3: qmake5_base_do_configure, /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/temp/run.do_configure.120055, line 186 | #4: do_configure, /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/temp/run.do_configure.120055, line 154 | #5: main, /DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/build-qti-distro-rb-debug/tmp-glibc/work/aarch64-oe-linux/qtwayland/5.15.3+gitAUTOINC+f9dfeb6e72-r0/temp/run.do_configure.120055, line 214 ERROR: Task (/DATA/Joynext/zhao_w1/SA8538/LE.PRODUCT.2.1.R3/poky/meta-joynext/meta-qt5/recipes-qt/qt5/qtwayland_git.bb:do_configure) failed with exit code '1'
最新发布
08-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值