這天忽然想build一個static binary, 才發現SDK沒有static library, 於是只好重新build一下SDK with static package.
brook@vista:~/oe-src$ . /opt/oecore-x86_64/environment-setup-cortexa7-neon-vfpv4-oe-linux-gnueabi brook@vista:~/oe-src$ ${CC} -static kobj.c /opt/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/5.3.0/real-ld: error: cannot find -lc /opt/oecore-x86_64/sysroots/cortexa7-neon-vfpv4-oe-linux-gnueabi/usr/lib/crt1.o(.text+0x28): error: undefined reference to '__libc_start_main' /opt/oecore-x86_64/sysroots/cortexa7-neon-vfpv4-oe-linux-gnueabi/usr/lib/crt1.o(.text+0x2c): error: undefined reference to 'abort' /opt/oecore-x86_64/sysroots/cortexa7-neon-vfpv4-oe-linux-gnueabi/usr/lib/crt1.o(.text+0x30): error: undefined reference to '__libc_csu_fini' /opt/oecore-x86_64/sysroots/cortexa7-neon-vfpv4-oe-linux-gnueabi/usr/lib/crt1.o(.text+0x38): error: undefined reference to '__libc_csu_init' /tmp/ccDJTrij.o:kobj.c:function init_hotplug_sock: error: undefined reference to 'bzero' /tmp/ccDJTrij.o:kobj.c:function init_hotplug_sock: error: undefined reference to 'getpid' /tmp/ccDJTrij.o:kobj.c:function init_hotplug_sock: error: undefined reference to 'socket' /tmp/ccDJTrij.o:kobj.c:function init_hotplug_sock: error: undefined reference to 'perror' /tmp/ccDJTrij.o:kobj.c:function init_hotplug_sock: error: undefined reference to 'setsockopt' /tmp/ccDJTrij.o:kobj.c:function init_hotplug_sock: error: undefined reference to 'bind' /tmp/ccDJTrij.o:kobj.c:function init_hotplug_sock: error: undefined reference to 'perror' /tmp/ccDJTrij.o:kobj.c:function init_hotplug_sock: error: undefined reference to 'close' /tmp/ccDJTrij.o:kobj.c:function main: error: undefined reference to 'memset' /tmp/ccDJTrij.o:kobj.c:function main: error: undefined reference to 'recv' /tmp/ccDJTrij.o:kobj.c:function main: error: undefined reference to 'puts' collect2: error: ld returned 1 exit status
這是因為沒有加入staticdev-pkgs
SDKIMAGE_FEATURES += "staticdev-pkgs"
SDKIMAGE_FEATURES相當於IMAGE_FEATURES, 但SDKIMAGE_FEATURES用於建立SDK image用, 如
$ bitbake -c populate_sdk imagename
SDKIMAGE_FEATURES可用的參數與IMAGE_FEATURES相同, 條列如下
- allow-empty-password: Allows Dropbear and OpenSSH to accept root logins and logins from accounts having an empty password string.
- dbg-pkgs: Installs debug symbol packages for all packages installed in a given image.
- debug-tweaks: Makes an image suitable for development (e.g. allows root logins without passwords and enables post-installation logging). See the 'allow-empty-password', 'empty-root-password', and 'post-install-logging' features in this list for additional information.
- dev-pkgs: Installs development packages (headers and extra library links) for all packages installed in a given image.
- doc-pkgs: Installs documentation packages for all packages installed in a given image.
- empty-root-password: Sets the root password to an empty string, which allows logins with a blank password.
- package-management: Installs package management tools and preserves the package manager database.
- post-install-logging: Enables logging postinstall script runs to the /var/log/postinstall.log file on first boot of the image on the target system.
- ptest-pkgs: Installs ptest packages for all ptest-enabled recipes.
- read-only-rootfs: Creates an image whose root filesystem is read-only. See the "Creating a Read-Only Root Filesystem" section in the Yocto Project Development Manual for more information.
- splash: Enables showing a splash screen during boot. By default, this screen is provided by psplash, which does allow customization. If you prefer to use an alternative splash screen package, you can do so by setting the SPLASH variable to a different package name (or names) within the image recipe or at the distro configuration level.
- staticdev-pkgs: Installs static development packages, which are static libraries (i.e. *.a files), for all packages installed in a given image.
- eclipse-debug: Provides Eclipse remote debugging support.
- hwcodecs: Installs hardware acceleration codecs.
- nfs-server: Installs an NFS server.
- qt4-pkgs: Supports Qt4/X11 and demo applications.
- ssh-server-dropbear: Installs the Dropbear minimal SSH server.
- ssh-server-openssh: Installs the OpenSSH SSH server, which is more full-featured than Dropbear. Note that if both the OpenSSH SSH server and the Dropbear minimal SSH server are present in IMAGE_FEATURES, then OpenSSH will take precedence and Dropbear will not be installed.
- tools-debug: Installs debugging tools such as strace and gdb. For information on GDB, see the "Debugging With the GNU Project Debugger (GDB) Remotely" section in the Yocto Project Development Manual. For information on tracing and profiling, see the Yocto Project Profiling and Tracing Manual.
- tools-profile: Installs profiling tools such as oprofile, exmap, and LTTng. For general information on user-space tools, see the "User-Space Tools" section in the Yocto Project Application Developer's Guide.
- tools-sdk: Installs a full SDK that runs on the device.
- tools-testapps: Installs device testing tools (e.g. touchscreen debugging).
- x11: Installs the X server.
- x11-base: Installs the X server with a minimal environment.
- x11-sato: Installs the OpenedHand Sato environment.
-
參考資料:
- https://www.yoctoproject.org/pipermail/yocto/2017-March/035377.html
沒有留言:
張貼留言