Lenz Grimmer
2012-Jun-27 12:11 UTC
Error compiling btrfs-tools from git (undefined reference to `pthread_create'')
On Ubuntu 11.10 "Oneiric" with gcc 4.6.1, compiling the btrfs tools from git fails for me with the following error: [lenz@metis btrfs-progs]% make bash version.sh gcc -lpthread -g -Werror -Os -o btrfs btrfs.o btrfs_cmds.o scrub.o \ ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o btrfs-list.o btrfslabel.o -luuid scrub.o: In function `scrub_start'': /space/tmp/btrfs-progs/scrub.c:1342: undefined reference to `pthread_create'' /space/tmp/btrfs-progs/scrub.c:1360: undefined reference to `pthread_create'' /space/tmp/btrfs-progs/scrub.c:1374: undefined reference to `pthread_join'' /space/tmp/btrfs-progs/scrub.c:1430: undefined reference to `pthread_cancel'' /space/tmp/btrfs-progs/scrub.c:1432: undefined reference to `pthread_join'' collect2: ld returned 1 exit status make: *** [btrfs] Error 1 The following change fixed this for me, not sure if it''s the appropriate approach: diff --git a/Makefile b/Makefile index edee1a0..9e3a06f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CC = gcc AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -CFLAGS = -g -Werror -Os +CFLAGS = -g -Werror -Os -pthread objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \ root-tree.o dir-item.o file-item.o inode-item.o \ inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o \ -- Lenz Grimmer <lenz@grimmer.com> - http://www.lenzg.net/
cwillu
2012-Jun-27 12:20 UTC
Re: Error compiling btrfs-tools from git (undefined reference to `pthread_create'')
On Wed, Jun 27, 2012 at 6:11 AM, Lenz Grimmer <lenz@grimmer.com> wrote:> On Ubuntu 11.10 "Oneiric" with gcc 4.6.1, compiling the btrfs tools from git > fails for me with the following error:Which git repo? git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git builds on ubuntu just fine (just checked on a fresh checkout), and likewise the integration repo (but note that the integration repo''s master branch is not useful to build; you need to check out one of the actual integration branches as described on the wiki). -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Lenz Grimmer
2012-Jun-29 08:46 UTC
Re: Error compiling btrfs-tools from git (undefined reference to `pthread_create'')
Hi, thank you for your reply. On 06/27/2012 02:20 PM, cwillu wrote:> On Wed, Jun 27, 2012 at 6:11 AM, Lenz Grimmer <lenz@grimmer.com> wrote: >> On Ubuntu 11.10 "Oneiric" with gcc 4.6.1, compiling the btrfs tools from git >> fails for me with the following error: > > Which git repo? > git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git > builds on ubuntu just fine (just checked on a fresh checkout), and > likewise the integration repo (but note that the integration repo''s > master branch is not useful to build; you need to check out one of the > actual integration branches as described on the wiki).That''s likely the issue - the following commands reproduce the compile error for me: git clone http://git.darksatanic.net/repo/btrfs-progs-unstable.git btrfs-progs cd btrfs-progs make [...] gcc -lpthread -g -Werror -Os -o btrfs btrfs.o btrfs_cmds.o scrub.o \ ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o btrfs-list.o btrfslabel.o -luuid scrub.o: In function `scrub_start'': /space/tmp/btrfs-progs/scrub.c:1342: undefined reference to `pthread_create'' /space/tmp/btrfs-progs/scrub.c:1360: undefined reference to `pthread_create'' /space/tmp/btrfs-progs/scrub.c:1374: undefined reference to `pthread_join'' /space/tmp/btrfs-progs/scrub.c:1430: undefined reference to `pthread_cancel'' /space/tmp/btrfs-progs/scrub.c:1432: undefined reference to `pthread_join'' collect2: ld returned 1 exit status However, using the integration-20120605 branch compiles fine. Thanks and sorry for the noise! Bye, LenZ -- Lenz Grimmer <lenz@grimmer.com> - http://www.lenzg.net/