1 (edited by diizzy 2010-01-02 21:09:46)

Topic: Issues with making a new package for OpenWRT (minidlna)

Hi,
I'm trying to make a package for minidlna but I'm stuck and I can't figure out what's wrong. I have no idea if it will work but it should at least in theory. Hopefully someone here can and tell me what stupid mistake I made ;-)

#
# Copyright (C) 2006-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=minidlna
PKG_VERSION:=1
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)
PKG_SOURCE:=minidlna-snapshot-010110.zip
PKG_SOURCE_URL:=http://projects.pyret.net/dump
PKG_MD5SUM:=005d345670dcd7491d97cb685763b510

include $(INCLUDE_DIR)/package.mk

define Package/minidlna
  SECTION:=network
  CATEGORY:=Network
  TITLE:=MiniDLNA
  DESCRIPTION:=MiniDLNA Server
  URL:=http://sourceforge.net/projects/minidlna/
  MAINTAINER:=Someone
  DEPENDS:=+libexif +libjpeg +libid3tag +libflac +libvorbis +libsqlite3 +ffmpeg +libuuid
endef

define Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR)
endef

define Package/minidlna/install
        $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_DATA) ./minidlna.conf $(1)/etc
endef

$(eval $(call BuildPackage,minidlna))

Putting this in ....trunk/packages/minidlna and running make menuconfig results in an error saying something like "please fix Makefile for minidlna" and building the port manually results in "dont know how to make target".

Best regards,
Daniel

Re: Issues with making a new package for OpenWRT (minidlna)

diizzy wrote:

Hi,
I'm trying to make a package for minidlna but I'm stuck and I can't figure out what's wrong. I have no idea if it will work but it should at least in theory. Hopefully someone here can and tell me what stupid mistake I made ;-)

#
# Copyright (C) 2006-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=minidlna
PKG_VERSION:=1
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)
PKG_SOURCE:=minidlna-snapshot-010110.zip
PKG_SOURCE_URL:=http://projects.pyret.net/dump
PKG_MD5SUM:=005d345670dcd7491d97cb685763b510

include $(INCLUDE_DIR)/package.mk

define Package/minidlna
  SECTION:=network
  CATEGORY:=Network
  TITLE:=MiniDLNA
  DESCRIPTION:=MiniDLNA Server
  URL:=http://sourceforge.net/projects/minidlna/
  MAINTAINER:=Someone
  DEPENDS:=+libexif +libjpeg +libid3tag +libflac +libvorbis +libsqlite3 +ffmpeg +libuuid
endef

define Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR)
endef

define Package/minidlna/install
        $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_DATA) ./minidlna.conf $(1)/etc
endef

$(eval $(call BuildPackage,minidlna))

Putting this in ....trunk/packages/minidlna and running make menuconfig results in an error saying something like "please fix Makefile for minidlna" and building the port manually results in "dont know how to make target".

Best regards,
Daniel

I would expect/suggest the following:

1.
PKG_BUILD_DIR: should there not be a package path added, so that it becomes something like:
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_RELEASE).
After all, that's where also your source Makefile should be (in a ./src directory).

2.
As far as I know, for Kamikaze, you should put the DESCRIPTION in a separate "define" section and not in the section "define Package/$(PKG_NAME)".  Something like this:
define Package/$(PKG_NAME)/description
    <your_description>
endef

3.
In the section "define Package/minidlna/install", didn't you forget to specify the $(INSTALL_BIN) variable?

Just some thoughts...

Best rgds,
--Geert

3 (edited by diizzy 2010-01-04 08:31:20)

Re: Issues with making a new package for OpenWRT (minidlna)

Thanks for the help, I now have a working Makefile unfortunately there seems to be some issues...
Running minidlna gives the following message (after installning it) on bcrm-2.6 platform:

root@OpenWrt:/usr/bin# ./minidlna
./minidlna: line 1: syntax error: unexpected ")"

Instead of the following:

Usage:
        ./minidlna [-d] [-f config_file]
                [-a listening_ip] [-p port]
                [-s serial] [-m model_number]
                [-t notify_interval] [-P pid_filename]
                [-w url] [-R] [-V] [-h]

Notes:
        Notify interval is in seconds. Default is 895 seconds.
        Default pid file is /var/run/minidlna.pid.
        With -d minidlna will run in debug mode (not daemonize).
        -w sets the presentation url. Default is http address on port 80
        -h displays this text
        -R forces a full rescan
        -V print the version number

Here's the working Makefile:

#
# Copyright (C) 2006-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=minidlna
PKG_VERSION:=0.1
PKG_RELEASE:=0

PKG_SOURCE:=minidlna-snapshot-010110.zip
PKG_SOURCE_URL:=http://projects.pyret.net/dump
PKG_MD5SUM:=0163fb10f8a70ec17bffe54a5fa329e5

include $(INCLUDE_DIR)/package.mk

define Package/minidlna
        TITLE:=minidlna - A small DLNA Server
        SECTION:=network
        CATEGORY:=Network
        DEPENDS:=+libexif +libjpeg +libid3tag +libflac +libvorbis +libsqlite3 +ffmpeg +libuuid
        MAINTAINER:=Someone
        URL:=http://sourceforge.net/projects/minidlna/
endef

define Package/minidlna/description
        This package contains minidlna, a small DLNA Server.
endef

define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR)
endef

define Package/minidlna/install
        $(INSTALL_DIR) $(1)/etc/
        $(INSTALL_CONF) $(PKG_BUILD_DIR)/minidlna.conf $(1)/etc/
        $(INSTALL_DIR) $(1)/usr/bin/
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/minidlna $(1)/usr/bin/

endef

$(eval $(call BuildPackage,minidlna))

...having a closer look it seems that there are some linking issues(?)

root@OpenWrt:/usr/bin# ldd minidlna
        libcrypt.so.0 => /lib/libcrypt.so.0 (0x2aabe000)
        libm.so.0 => /lib/libm.so.0 (0x2aae2000)
        libc.so.0 => /lib/libc.so.0 (0x2ab0b000)
        ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)

Compiled on Debian... (x86)

ldd minidlna
        linux-gate.so.1 =>  (0xb7fd6000)
        libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7fb3000)
        libexif.so.12 => /usr/lib/libexif.so.12 (0xb7f7e000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0xb7f5e000)
        libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0xb7edd000)
        libavformat.so.52 => /usr/lib/i686/cmov/libavformat.so.52 (0xb7e1c000)
        libid3tag.so.0 => /usr/lib/libid3tag.so.0 (0xb7e0b000)
        libFLAC.so.8 => /usr/lib/libFLAC.so.8 (0xb7dbb000)
        libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0xb7d92000)
        libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7c33000)
        libogg.so.0 => /usr/lib/libogg.so.0 (0xb7c2d000)
        /lib/ld-linux.so.2 (0xb7fd7000)
        libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7c07000)
        libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7c02000)
        libavcodec.so.52 => /usr/lib/i686/cmov/libavcodec.so.52 (0xb7233000)
        libavutil.so.50 => /usr/lib/i686/cmov/libavutil.so.50 (0xb7221000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb720c000)
        libbz2.so.1.0 => /lib/libbz2.so.1.0 (0xb71fc000)
        libdirac_encoder.so.0 => /usr/lib/libdirac_encoder.so.0 (0xb7161000)
        libfaac.so.0 => /usr/lib/libfaac.so.0 (0xb7150000)
        libfaad.so.2 => /usr/lib/libfaad.so.2 (0xb7111000)
        libgsm.so.1 => /usr/lib/libgsm.so.1 (0xb7104000)
        libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0xb708f000)
        libopencore-amrnb.so.0 => /usr/lib/libopencore-amrnb.so.0 (0xb705a000)
        libopencore-amrwb.so.0 => /usr/lib/libopencore-amrwb.so.0 (0xb7041000)
        libopenjpeg.so.2 => /usr/lib/libopenjpeg.so.2 (0xb7024000)
        libschroedinger-1.0.so.0 => /usr/lib/libschroedinger-1.0.so.0 (0xb6fa8000)
        libspeex.so.1 => /usr/lib/libspeex.so.1 (0xb6f93000)
        libtheoraenc.so.1 => /usr/lib/libtheoraenc.so.1 (0xb6f5a000)
        libtheoradec.so.1 => /usr/lib/libtheoradec.so.1 (0xb6f40000)
        libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0xb6e47000)
        libx264.so.79 => /usr/lib/libx264.so.79 (0xb6dae000)
        libxvidcore.so.4 => /usr/lib/libxvidcore.so.4 (0xb6c9e000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6bad000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6b8f000)
        liboil-0.3.so.0 => /usr/lib/liboil-0.3.so.0 (0xb6b1f000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0xb6a02000)
        librt.so.1 => /lib/i686/cmov/librt.so.1 (0xb69f9000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb69e0000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0xb69dc000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb69d7000)

If someone with greater knowledge could have a look at it I would be very pleased. As it seems to work with optware I would guess it's just a minor issue.

Best regards,
Daniel

Re: Issues with making a new package for OpenWRT (minidlna)

root@OpenWrt:/usr/bin# ./minidlna
./minidlna: line 1: syntax error: unexpected ")"

This kind of error mostly indicates you're compiling your target for the wrong architecture.  You have that kind of errors if you run an application on, for instance, an ARM architecture while the code has been compiled for an i386 architecture.

Take your application and on a Linux terminal, run readelf -h minidlna.  Check if you see the architecture your application should suppose to run.

Here's an example:

geertvc@ubuntu904:/home/netusg20/openwrt/build_dir/target-arm_uClibc-0.9.30.1/helloworld-1$ readelf -h helloworld
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x83a8
  Start of program headers:          52 (bytes into file)
  Start of section headers:          1936 (bytes into file)
  Flags:                             0x4000002, has entry point, Version4 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         6
  Size of section headers:           40 (bytes)
  Number of section headers:         24
  Section header string table index: 21

You see this application has been built for the ARM machine, not for an i386.

If I see this in your makefile:

define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR)
endef

then I think the default build will be for an i386 machine.  Is this what you want?  If not, then you should specify here what target options the compiler has to take/choose, by adding something like this:

define Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS)
endef

where the TARGET_CONFIGURE_OPTS is defining the correct compiler, linker etc.

For the ARM processor, TARGET_CONFIGURE_OPTS is defined as follows:

 Value of TARGET_CONFIGURE_OPTS = 
      AR=arm-openwrt-linux-uclibcgnueabi-ar 
      AS=arm-openwrt-linux-uclibcgnueabi-gcc -c -Os -pipe -march=armv5te -mtune=arm926ej-s \
         -funit-at-a-time -fhonour-copts -msoft-float 
      LD=arm-openwrt-linux-uclibcgnueabi-ld 
      NM=arm-openwrt-linux-uclibcgnueabi-nm 
      CC=arm-openwrt-linux-uclibcgnueabi-gcc 
      GCC=arm-openwrt-linux-uclibcgnueabi-gcc 
      CXX=arm-openwrt-linux-uclibcgnueabi-g++ 
      RANLIB=arm-openwrt-linux-uclibcgnueabi-ranlib 
      STRIP=arm-openwrt-linux-uclibcgnueabi-strip 
      OBJCOPY=arm-openwrt-linux-uclibcgnueabi-objcopy 
      OBJDUMP=arm-openwrt-linux-uclibcgnueabi-objdump 
      SIZE=arm-openwrt-linux-uclibcgnueabi-size

Up to you to figure out what it has to be in your case.

Best rgds,

--Geert

5 (edited by aport 2010-01-04 22:13:10)

Re: Issues with making a new package for OpenWRT (minidlna)

If your package doesn't require any special voodoo to compile, you can simply remove the Compile define in the Makefile to use the default. This will ensure that it is cross compiled for your target.

6 (edited by diizzy 2010-01-05 19:37:48)

Re: Issues with making a new package for OpenWRT (minidlna)

It looks indeed that it compiles against wrong target, this is apparently hardcoded in minidlna's makefile. Optware uses some sed-magic which I have no idea how to convert for OpenWRT. Any ideas?

http://trac.nslu2-linux.org/optware/browser/trunk/make/minidlna.mk (around the middle)

Best regards,
Daniel

Re: Issues with making a new package for OpenWRT (minidlna)

diizzy wrote:

It looks indeed that it compiles against wrong target, this is apparently hardcoded in minidlna's makefile. Optware uses some sed-magic which I have no idea how to convert for OpenWRT. Any ideas?

http://trac.nslu2-linux.org/optware/browser/trunk/make/minidlna.mk (around the middle)

Best regards,
Daniel

Hey diizy

How did you go getting minidlna compiled for openwrt? I'm keen to run the package, so would love an update before I attempt to do so myself.

Re: Issues with making a new package for OpenWRT (minidlna)

look at other packages on how it is done.
You may need to create a patch directory under ./package/$(PKG_NAME) containing all your patches.
In your case, you need to patch the source makefile and/or add some macros for your target.
The message you are getting is that because your target is wrong

Re: Issues with making a new package for OpenWRT (minidlna)

Well, I did get some help and it does indeed compile but unfortunately I haven't been able to test it yet due to lack of time hmm
http://openwrt.pastebin.com/m23601d83
Please give some feedback if you try it
//Danne

Re: Issues with making a new package for OpenWRT (minidlna)

diizzy wrote:

Well, I did get some help and it does indeed compile but unfortunately I haven't been able to test it yet due to lack of time hmm
http://openwrt.pastebin.com/m23601d83
Please give some feedback if you try it
//Danne

Hey man,

It looks like that pastebin has gone away. Could you repost, please?

- Rob

Re: Issues with making a new package for OpenWRT (minidlna)

http://projects.pyret.net/dump/minidlna.patch

Re: Issues with making a new package for OpenWRT (minidlna)

or open a ticket and attach your patch to the ticket

Re: Issues with making a new package for OpenWRT (minidlna)

Uhm... you have it above?

Re: Issues with making a new package for OpenWRT (minidlna)

I know, why open a ticket ? Because Openwrt Dev/ and other users can modify/enhance/revise patches in compliance to openwrt with historical log

Re: Issues with making a new package for OpenWRT (minidlna)

I already got some help from OpenWRT developers, it just needs testing that it actually works

Re: Issues with making a new package for OpenWRT (minidlna)

Hmm... I've finally had some time to test it and unfortunately it doesn't seem to parse mkv-files (only ones I tried) correctly so obviously something is wrong but I can't figure out what. minidlna just reports that it failed to parse it correctly.
//Danne

Re: Issues with making a new package for OpenWRT (minidlna)

diizzy wrote:

Hmm... I've finally had some time to test it and unfortunately it doesn't seem to parse mkv-files (only ones I tried) correctly so obviously something is wrong but I can't figure out what. minidlna just reports that it failed to parse it correctly.
//Danne

could you post the .ipk and I will test it on my wgt634u. I would like to try minidlna, and I'm not sure where to begin compiling a package for openwrt.

thanks

18 (edited by DkSoul 2010-07-27 23:15:59)

Re: Issues with making a new package for OpenWRT (minidlna)

Hi, I was having some trouble compiling minidlna so I tweaked a bit the patch from diizzy.

It's available here: http://bit.ly/dBh0a8
Package for OpenWRT 8.09.2 (for Fonera router): http://bit.ly/auWDT5
Package for OpenWRT 10.03 (for Fonera router): http://bit.ly/aGHs3g

But I am also having the exact same problem has diizzy ("minidlna just reports that it failed to parse it correctly.") on OpenWRT 8.09.2 (haven't tried yet on OpenWRT 10.03).

EDIT: updated links

Re: Issues with making a new package for OpenWRT (minidlna)

DkSoul wrote:

Hi, I was having some trouble compiling minidlna so I tweaked a bit the patch from diizzy.

It's available here: http://bit.ly/dBh0a8
Package for OpenWRT 8.09.2 (for Fonera router): http://bit.ly/auWDT5
Package for OpenWRT 10.03 (for Fonera router): http://bit.ly/aGHs3g

But I am also having the exact same problem has diizzy ("minidlna just reports that it failed to parse it correctly.") on OpenWRT 8.09.2 (haven't tried yet on OpenWRT 10.03).

EDIT: updated links

It seems that it's a problem with ffmpeg. It needs to be recompiled to include some missing features.. Now minidlna is able to parse mkv.

Re: Issues with making a new package for OpenWRT (minidlna)

DkSoul wrote:

Hi, I was having some trouble compiling minidlna so I tweaked a bit the patch from diizzy.

It's available here: http://bit.ly/dBh0a8
Package for OpenWRT 8.09.2 (for Fonera router): http://bit.ly/auWDT5
Package for OpenWRT 10.03 (for Fonera router): http://bit.ly/aGHs3g

Can you make a Fonera 2.0g/n version (mips vs mipsel) ?
How is Openwrt 10.03 performing on a fonera ?
much difference?

is minidlna better than ushare?
on which devices did you test? music/video/pictures?

Re: Issues with making a new package for OpenWRT (minidlna)

skynetbbs wrote:

Can you make a Fonera 2.0g/n version (mips vs mipsel) ?

The packages were built for the Fonera 2.0g but should work with all Foneras (same chipset: http://wiki.openwrt.org/toh/start#fon)

skynetbbs wrote:

How is Openwrt 10.03 performing on a fonera ?
much difference?

I have OpenWRT 10.03 on a Fonera 1 and it's just like OpenWRT 8.09.2 tongue
I had some problems on the Fonera 2.0g so I reverted to 8.09.2.

skynetbbs wrote:

is minidlna better than ushare?

Sometimes uShare doesn't work for me..
Both my TV and XBOX360 are unable to "see" the server, but I haven't investigated the reasons (tested running uShare server on both Fonera and Netbook with the same results).

skynetbbs wrote:

on which devices did you test? music/video/pictures?

uShare and MiniDLNA: TV Samsung PS50C550 (videos only)
uShare only: XBOX360 (videos only)

Re: Issues with making a new package for OpenWRT (minidlna)

Looks like this minidlna is still not in the "openwrt packages feed"?


~/FON-N/openwrt$ ./scripts/feeds list |grep -i "dlna"

libdlna                             Reference DLNA implementation
ushare                              UPnP A/V & DLNA Media Server
luci-app-ushare                     ushare - UPnP A/V & DLNA Media Server
ushare                              UPnP A/V & DLNA Media Server

Re: Issues with making a new package for OpenWRT (minidlna)

skynetbbs wrote:

Looks like this minidlna is still not in the "openwrt packages feed"?


~/FON-N/openwrt$ ./scripts/feeds list |grep -i "dlna"

libdlna                             Reference DLNA implementation
ushare                              UPnP A/V & DLNA Media Server
luci-app-ushare                     ushare - UPnP A/V & DLNA Media Server
ushare                              UPnP A/V & DLNA Media Server

Nop, not yet. I have created a ticket requesting it (https://dev.openwrt.org/ticket/7685), but is still pending devs approval.
You can either use the patch from above, or extract the following tgz to the packages dir: http://bit.ly/cW3AiO

Re: Issues with making a new package for OpenWRT (minidlna)

DkSoul wrote:

You can either use the patch from above, or extract the following tgz to the packages dir: http://bit.ly/cW3AiO

hmmm... is the sqlite dependency really necessary?

ERROR!  Cannot continue.
-e The following required libraries are either missing, or are missing development headers:

-e libflac libvorbis libogg libexif libjpeg libsqlite3

Re: Issues with making a new package for OpenWRT (minidlna)

skynetbbs wrote:

hmmm... is the sqlite dependency really necessary?

ERROR!  Cannot continue.
-e The following required libraries are either missing, or are missing development headers:

-e libflac libvorbis libogg libexif libjpeg libsqlite3

Yes, MiniDLNA uses sqlite to maintain a local database with information about the shared files.