This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

mtd-utils build error on Ubuntu 10.04 host

I strictly followed the instructions on this page to build my own host tools for mtd-utils. http://processors.wiki.ti.com/index.php/MTD_Utilities#MTD-Utils_Compilation

But I am getting error when I try to do make on mtd-utils build.

---------------------------------------------------------------------------------------------------------------------

root@NX-W-3:~/mtd/mtd-utils-d37fcc0# WITHOUT_XATTR=1 make
  CHK     include/version.h
  LD      mkfs.jffs2
/usr/bin/ld: cannot find -llzo2
collect2: ld returned 1 exit status
---------------------------------------------------------------------------------------------------------------------

I think linker was failing to find libs for lzo but apparently I already add

LZOLDFLAGS = -I$(PREFIX)/lib

in the Makefile. Could someone give some help with this?

Makefile changes:

---------------------------------------------------------------------------------------------------------------

# -*- sh -*-

VERSION = 1.4.8

PREFIX = /root/mtd/install
ZLIBCPPFLAGS = -I$(PREFIX)/include
LZOCPPFLAGS = -I$(PREFIX)/include
ZLIBLDFLAGS = -I$(PREFIX)/lib
LZOLDFLAGS = -I$(PREFIX)/lib
LDFLAGS += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
CFLAGS ?= -O2 -g $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)

CPPFLAGS += -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)

-----------------------------------------------------------------------------------------------------------

common.mk changes:

-----------------------------------------------------------------------------------------------------------

CC := $(CROSS)gcc
AR := $(CROSS)ar
RANLIB := $(CROSS)ranlib

# Stolen from Linux build system
comma = ,
try-run = $(shell set -e; ($(1)) >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
cc-option = $(call try-run, $(CC) $(1) -c -xc /dev/null -o /dev/null,$(1),$(2))

CFLAGS ?= -O2 -g
WFLAGS := -Wall \
    $(call cc-option,-Wextra) \
    $(call cc-option,-Wwrite-strings) \
    $(call cc-option,-Wno-sign-compare)
CFLAGS += $(WFLAGS)
SECTION_CFLAGS := $(call cc-option,-ffunction-sections -fdata-sections -Wl$(comma)--gc-sections)
CFLAGS += $(SECTION_CFLAGS)

ifneq ($(WITHOUT_LARGEFILE), 1)
  CPPFLAGS += -D_FILE_OFFSET_BITS=64
endif

DESTDIR?=
#PREFIX=/usr
EXEC_PREFIX=$(PREFIX)
SBINDIR=$(EXEC_PREFIX)/sbin
MANDIR=$(PREFIX)/share/man
INCLUDEDIR=$(PREFIX)/include

--------------------------------------------------------------------------------------------------------------------

  • This issue was solved now.

    Silly me for the typos:

               PREFIX = /home/user/mtd/install
    ZLIBCPPFLAGS = -I$(PREFIX)/include
    LZOCPPFLAGS = -I$(PREFIX)/include
    ZLIBLDFLAGS = -L$(PREFIX)/lib
    LZOLDFLAGS = -L$(PREFIX)/lib
    LDFLAGS += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
    CFLAGS ?= -O2 -g $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
  • Lucky you ;-), I went through that exercise too because the mtd-utils package for 10.04 is stuck at version 1.3 (can't upgrade it with the package manager) and the latter is missing the -F option. I need that option to build UBIFS file systems with mkfs.ubifs utility.

    I tried to compile mtd-utils under Ubuntu 10.04 but the build process did not go that far for me: the compiler could not find sys/acl.h. That file did not exist at all on my Linux workstation. The closest header file was linux/posix_acl.h but it lead me to many more errors so I gave up building mtd-utils.

    So, as a workaround, I downloaded a Debian package for mtd-utils version 1.5 and installed it on my Linux box. That worked and I was able to build my filesystem, but I have other issues with UBIFS itself.

    I'm curious here: what is the path to sys/acl.h?

    Cheers! 

  • I did not find sys/acl.h on my host machine either.