SourceForge has been redesigned. Learn more.

undefined reference _ext2fs_get_device_size2

  • Chris Brown

    Chris Brown - 2010-05-26


    I'm trying to install gearman under cygwin. One of its dependencies is libuuid so I'm now trying to build e2fsprogs.

    I've set environment variables CC, CXX, CPPFLAGS, LDFLAGS, & LIBS.
    CPPFLAGS=-I/usr/win32/include -I./lib/ext2fs
    LDFLAGS=-L/usr/win32/lib -L./lib

    I'm running ./configure -with-gnu-ld;make

    The output I get is

    make: Entering directory `/cygdrive/c/tmp/e2fsprogs-1.41.12/e2fsck'
            CC gen_crc32table
            GEN32TABLE crc32table.h
            CC crc32.c
            CC dict.c
            CC unix.c
            CC e2fsck.c
            CC super.c
            CC pass1.c
            CC pass1b.c
            CC pass2.c
            CC pass3.c
            CC pass4.c
            CC pass5.c
            CC journal.c
            CC badblocks.c
            CC util.c
            CC dirinfo.c
            CC dx_dirinfo.c
            CC ehandler.c
            CC problem.c
            CC message.c
            CC recovery.c
            CC region.c
            CC revoke.c
            CC ea_refcount.c
            CC rehash.c
            CC profile.c
            CC prof_err.c
            LD e2fsck
    unix.o: In function `main':
    /cygdrive/c/tmp/e2fsprogs-1.41.12/e2fsck/unix.c:1131: undefined reference to `_ext2fs_get_device_size2'
    /cygdrive/c/tmp/e2fsprogs-1.41.12/e2fsck/unix.c:1144: undefined reference to `_ext2fs_get_device_size2'
    collect2: ld returned 1 exit status
    make: ***  Error 1
    make: Leaving directory `/cygdrive/c/tmp/e2fsprogs-1.41.12/e2fsck'
    make: ***  Error 1
    make: Leaving directory `/cygdrive/c/tmp/e2fsprogs-1.41.12'
    make: ***  Error 2

    I think the header file should be ext2fs.h which is in ./lib/ext2fs, hence the references to ext2fs in my env variables. This doesn't make any difference and I'm not sure what else to try.

    Any suggestions as to what I might have missed out would be much appreciated.


  • Chris Brown

    Chris Brown - 2010-05-28

    Problem resolved by building the libs tarball

  • mutex

    mutex - 2011-06-22


    I am getting the same error , please help.


  • chaithra

    chaithra - 2017-06-27

    Hi @Chris Brown,

    I am trying to compile e2fsprogs 1.43.4 in cygwin? And facing the same error
    undefined reference to `_ext2fs_get_device_size2'

    Can you please share the compilation steps you followed to resolve this error?
    How did you build the libs tarball? Where to get the libs tar ball?

    I have built the libs tarball available in
    And then tried building the e2fsprogs 1.43.4, but still facing the same linker issue. Can you suggest on this?

    Last edit: chaithra 2017-06-27
  • chaithra

    chaithra - 2017-06-30

    Issue Resolved:

    For cygwin environment ext2fs_get_device_size2() method is not defined. It is defined for non-cygwin environment.

    Hence replaced ext2fs_get_device_size2() with ext2fs_get_device_size() in all files where the call was made.

    Compilation was succesfull after replacing.


Log in to post a comment.