Disable run test for pthread detection. In case of build with only static library, CMake fails to detect the pthread library (-lpthread), so it falls back trying to link using -pthread and execute the test program. <snip> [...] -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - not found -- Check if compiler accepts -pthread CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately: THREADS_PTHREAD_ARG (advanced) For details see /home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/TryRunResults.cmake -- Check if compiler accepts -pthread - no -- Found Threads: TRUE -- Udev rules not being installed, install them with -DINSTALL_UDEV_RULES=ON -- Building with kernel driver detaching disabled, use -DDETACH_KERNEL_DRIVER=ON to enable -- Building for version: 0.5.3 / 0.5.3 -- Using install prefix: /usr -- Configuring incomplete, errors occurred! See also "/home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeOutput.log". See also "/home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeError.log". </snip> Here it fails because, in the CMake FindThreads.cmake file, the 'try_run' function is unconditionally called [1]. Also, the CMakeError.log gives more details why linking with -lpthread fails: <snip> [...] Run Build Command:"/usr/bin/make" "cmTryCompileExec3012181287/fast" make[1]: Entering directory '/home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp' /usr/bin/make -f CMakeFiles/cmTryCompileExec3012181287.dir/build.make CMakeFiles/cmTryCompileExec3012181287.dir/build make[2]: Entering directory '/home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp' /home/buildroot/instance-1/output/host/usr/bin/cmake -E cmake_progress_report /home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec3012181287.dir/CheckFunctionExists.c.o /home/buildroot/instance-1/output/host/usr/bin/arm-linux-gcc -pipe -Os -static -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTryCompileExec3012181287.dir/CheckFunctionExists.c.o -c /home/buildroot/instance-1/output/host/usr/share/cmake-3.0/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec3012181287 /home/buildroot/instance-1/output/host/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3012181287.dir/link.txt --verbose=1 /home/buildroot/instance-1/output/host/usr/bin/arm-linux-gcc -pipe -Os -static -DCHECK_FUNCTION_EXISTS=pthread_create -static CMakeFiles/cmTryCompileExec3012181287.dir/CheckFunctionExists.c.o -o cmTryCompileExec3012181287 -rdynamic -lpthread -Wl,-Bstatic -lusb-1.0 -Wl,-Bdynamic /home/buildroot/instance-1/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libpthread.a(init.os): In function `__pthread_initialize_minimal': init.c:(.text+0x270): undefined reference to `__libc_setup_tls' collect2: error: ld returned 1 exit status CMakeFiles/cmTryCompileExec3012181287.dir/build.make:89: recipe for target 'cmTryCompileExec3012181287' failed make[2]: *** [cmTryCompileExec3012181287] Error 1 make[2]: Leaving directory '/home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp' Makefile:118: recipe for target 'cmTryCompileExec3012181287/fast' failed make[1]: *** [cmTryCompileExec3012181287/fast] Error 2 make[1]: Leaving directory '/home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp' Determining if compiler accepts -pthread returned PLEASE_FILL_OUT-FAILED_TO_RUN instead of 2. The compiler had the following output: Change Dir: /home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/make" "cmTryCompileExec1361818630/fast" make[1]: Entering directory '/home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp' /usr/bin/make -f CMakeFiles/cmTryCompileExec1361818630.dir/build.make CMakeFiles/cmTryCompileExec1361818630.dir/build make[2]: Entering directory '/home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp' /home/buildroot/instance-1/output/host/usr/bin/cmake -E cmake_progress_report /home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec1361818630.dir/CheckForPthreads.c.o /home/buildroot/instance-1/output/host/usr/bin/arm-linux-gcc -pipe -Os -static -o CMakeFiles/cmTryCompileExec1361818630.dir/CheckForPthreads.c.o -c /home/buildroot/instance-1/output/host/usr/share/cmake-3.0/Modules/CheckForPthreads.c Linking C executable cmTryCompileExec1361818630 /home/buildroot/instance-1/output/host/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1361818630.dir/link.txt --verbose=1 /home/buildroot/instance-1/output/host/usr/bin/arm-linux-gcc -pipe -Os -static -static CMakeFiles/cmTryCompileExec1361818630.dir/CheckForPthreads.c.o -o cmTryCompileExec1361818630 -rdynamic -pthread make[2]: Leaving directory '/home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp' make[1]: Leaving directory '/home/buildroot/instance-1/output/build/librtlsdr-v0.5.3/CMakeFiles/CMakeTmp' </snip> While falling back on -pthread is correct when using only static libraries to get some tls-related macros defined [2,3], it is wrong to try to run the test program in case of cross-compilation. So, this patch only disable run test when pthread support is done using -pthread, i.e. in case of the type of libraries is "static only". Fixes: http://autobuild.buildroot.org/results/26c/26cb8c2e5f867d49451f61304bf0a1a6f7b825d9/ [1] http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/FindThreads.cmake;h=a0bc4d133eb3f9d3ae096f0e03e419ef7be66ce8;hb=HEAD#l84 [2] http://lists.busybox.net/pipermail/buildroot/2014-June/100690.html [3] http://stackoverflow.com/questions/23250863/difference-between-pthread-and-lpthread-while-compiling Signed-off-by: Samuel Martin <s.martin49@gmail.com> Cc: Baruch Siach <baruch@tkos.co.il> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com> |
||
---|---|---|
arch | ||
board | ||
boot | ||
configs | ||
docs | ||
fs | ||
linux | ||
package | ||
support | ||
system | ||
toolchain | ||
.defconfig | ||
.gitignore | ||
CHANGES | ||
Config.in | ||
Config.in.legacy | ||
COPYING | ||
Makefile | ||
Makefile.legacy | ||
README |
To build and use the buildroot stuff, do the following: 1) run 'make menuconfig' 2) select the packages you wish to compile 3) run 'make' 4) wait while it compiles 5) Use your shiny new root filesystem. Depending on which sort of root filesystem you selected, you may want to loop mount it, chroot into it, nfs mount it on your target device, burn it to flash, or whatever is appropriate for your target system. You do not need to be root to build or run buildroot. Have fun! Offline build: ============== In order to do an offline-build (not connected to the net), fetch all selected source by issuing a $ make source before you disconnect. If your build-host is never connected, then you have to copy buildroot and your toplevel .config to a machine that has an internet-connection and issue "make source" there, then copy the content of your dl/ dir to the build-host. Building out-of-tree: ===================== Buildroot supports building out of tree with a syntax similar to the Linux kernel. To use it, add O=<directory> to the make command line, E.G.: $ make O=/tmp/build And all the output files (including .config) will be located under /tmp/build. More finegrained configuration: =============================== You can specify a config-file for uClibc: $ make UCLIBC_CONFIG_FILE=/my/uClibc.config And you can specify a config-file for busybox: $ make BUSYBOX_CONFIG_FILE=/my/busybox.config To use a non-standard host-compiler (if you do not have 'gcc'), make sure that the compiler is in your PATH and that the library paths are setup properly, if your compiler is built dynamically: $ make HOSTCC=gcc-4.3.orig HOSTCXX=gcc-4.3-mine Depending on your configuration, there are some targets you can use to use menuconfig of certain packages. This includes: $ make HOSTCC=gcc-4.3 linux-menuconfig $ make HOSTCC=gcc-4.3 uclibc-menuconfig $ make HOSTCC=gcc-4.3 busybox-menuconfig Please feed suggestions, bug reports, insults, and bribes back to the buildroot mailing list: buildroot@buildroot.org