OpenWrt Forum Archive

Topic: Cross compiling big project.

The content of this topic has been archived on 31 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello everyone,

I'm new in cross compiling. if theire is any interrest document that I had to read please pass me the links.

My Crrent problem:

I want to cross compile tow projects librarys for -OpenWRT 25875 target RT3883-.
the project are called:
* sphinxbase : https://sourceforge.net/projects/cmusph … xbase/0.8/
* pocketsphinx : https://sourceforge.net/projects/cmusph … phinx/0.8/

I Compiled those project on my computer ubuntu 12.04 LTS 64 bits. I tested its libraries they work.

Now I want to compile to cross compile it because I needing its libraryes in my recognition project whitch will be implimented on a routter RT3883 OS OpenWRT.

The thing is that when I compiled those project in my computer I had to excute those commands :

/-\ for sphinxs base
$sudo ./autogen.sh
$sudo  ./configure
$sudo make

/-\ for pocketsphinx
$sudo ./configure
$sudo make

So how should I write the OpenWRT package to be abel to make those configuration ?

I think you should add a package( user applicaiton) in OpenWRT.
Please refer to http://wiki.openwrt.org/doc/devel/packages.
Normally, you should write a Makefile(OpenWRT format) under package/YOUR_PACKAGE_NAME/.

I wrote the Makefile for sphinxsbase ( https://sourceforge.net/projects/cmusph … xbase/0.8/ )
here is the makefile:
________________________________________________________________________________________________________________
#begin makefile
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=sphinxbase-0.8
PKG_RELEASE:=1
PKG_VERSION:=0.8

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

define Package/sphinxbase-0.8/Default
  SECTION:=Am
  CATEGORY:=Amir
#  DEPENDS:=+
endef

define Package/sphinxbase-0.8
$(call Package/sphinxbase-0.8/Default)
  TITLE:=sphinxbase-0.8
endef

define Package/sphinxbase-0.8/description
Open,configurate sound device or sources,
Read voice samples.
endef

MAKE_OPTS:= \
    ARCH="$(LINUX_KARCH)" \
    CROSS_COMPILE="$(TARGET_CROSS)" \
    SUBDIRS="$(PKG_BUILD_DIR)"

define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    $(CP) ./src/* $(PKG_BUILD_DIR)/
endef

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

define Package/sphinxbase-0.8/install
    $(INSTALL_DIR) $(1)/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR) $(1)/bin/
#    $(INSTALL_BIN) $(PKG_BUILD_DIR)/sphinxbase-0.8 $(1)/bin/
endef

define Build/Configure
    $(call Build/Configure/Default,)
#$(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR))
endef

$(eval $(call BuildPackage,sphinxbase-0.8))

#end makefile
________________________________________________________________________________________________________________
I runned the cross-compiling toolchaine by running the commande :       "" make package/sphinxbase-0.8/compile V=99 ""
________________________________________________________________________________________________________________
!!!!!!!!!!!! but it end with errors: !!!!!!!!!!!!!!!!

make[4]: Leaving directory `/home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8'
make[3]: Leaving directory `/home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8'
touch /home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8/.built
mkdir -p /home/amir/Bureau/openwrt/bin/ramips/packages /home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8/ipkg-ramips/sphinxbase-0.8/CONTROL
install -d -m0755 /home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8/ipkg-ramips/sphinxbase-0.8/bin
install -m0755 /home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8 /home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8/ipkg-ramips/sphinxbase-0.8/bin/
install: omitting directory `/home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8'
make[2]: *** [/home/amir/Bureau/openwrt/bin/ramips/packages/sphinxbase-0.8_0.8-1_ramips.ipk] Error 1
make[2]: Leaving directory `/home/amir/Bureau/openwrt/package/sphinxbase-0.8'
make[1]: *** [package/sphinxbase-0.8/compile] Error 2
make[1]: Leaving directory `/home/amir/Bureau/openwrt'
make: *** [package/sphinxbase-0.8/compile] Error 2

Post the full log on some pastebin and link to it here. The actual error is way up, Error 2 doesn't tell anything.

Borromini wrote:

Post the full log on some pastebin and link to it here. The actual error is way up, Error 2 doesn't tell anything.

Yes I know, and that why I posted it in the forum !
I chked the hole log file theire is no error or warning. just those I posted any way here is the log file :

    http://www.speedyshare.com/ZsAmc/logfile.txt

I get the log file by tupping this commade :

    make package/sphinxbase-0.8/compile V=99 > logfile.txt


The log file don't containe any error or warning I chekked it.
the error and warning are showed on the Terminal :

    configure: WARNING: unrecognized options: --disable-nls
    configure: WARNING: Disabling python since development headers were not found
    configure: WARNING: unrecognized options: --disable-nls
    install: omitting directory `/home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8'
    make[2]: [/home/amir/Bureau/openwrt/bin/ramips/packages/sphinxbase-0.8_0.8-1_ramips.ipk] Error 1
    make[1]: [package/sphinxbase-0.8/compile] Error 2
    make: *** [package/sphinxbase-0.8/compile] Error 2

If you need here is my Makefile :
      http://www.speedyshare.com/K6zPW/Makefile

I asked the community of shinxbase they told me :
" In your sphinxbase openwrt package you have additional --disable-nls option to configure. You need to remove that option to not confuse configure. "
 
Now I'm searching for a way to remove that option "--disable-nls" !

So I succed to remove that option "--disable-nls"

by modificate the file : "~/openwrt/rules.mk"
in fact I changed those lignes :
_____________________________________________
ifeq ($(CONFIG_ENABLE_LOCALE),true)
  DISABLE_NLS:=--enable-nls
else
  DISABLE_NLS:=--disable-nls
endif
_____________________________________________
to be ;
_____________________________________________
ifeq ($(CONFIG_ENABLE_LOCALE),true)
  DISABLE_NLS:=
else
  DISABLE_NLS:=
endif
_____________________________________________

so the worning "  configure: WARNING: unrecognized options: --disable-nls" don't appear any more.

but the excution of
$make package/sphinxbase-0.8/compile V=99 > logfile.txt
always end with the same error.

here is the log file :
     http://speedy.sh/hvFYP/logfile.txt

& here is the messages showed in the Terminal :
________________________________________________________________________________________
configure: WARNING: Disabling python since development headers were not found
install: omitting directory `/home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8'
make[2]: *** [/home/amir/Bureau/openwrt/bin/ramips/packages/sphinxbase-0.8_0.8-1_ramips.ipk] Error 1
make[1]: *** [package/sphinxbase-0.8/compile] Error 2
make: *** [package/sphinxbase-0.8/compile] Error 2
________________________________________________________________________________________
//for the first warning it's normal even when I compile the project for my PC it show and it end with succes.

******************************************

when I excute { $./configure } manualy for my PC configuration this script show error and telling me
./configure: line 2116: config.log: Permission denied
./configure: line 2126: config.log: Permission denied

unless I excute it with root : { $sudo ./configure }

any way I don't think that this is the source of problem cause what is done in my pc when I excute the configure script with root is maked when the configure is ecuted by the OpenWRT SDK.

louwi wrote:

So I succed to remove that option "--disable-nls"

by modificate the file : "~/openwrt/rules.mk"
in fact I changed those lignes :
_____________________________________________
ifeq ($(CONFIG_ENABLE_LOCALE),true)
  DISABLE_NLS:=--enable-nls
else
  DISABLE_NLS:=--disable-nls
endif
_____________________________________________
to be ;
_____________________________________________
ifeq ($(CONFIG_ENABLE_LOCALE),true)
  DISABLE_NLS:=
else
  DISABLE_NLS:=
endif
_____________________________________________

so the worning "  configure: WARNING: unrecognized options: --disable-nls" don't appear any more.

After all, it is just a warning and is harmless, AFAICT.

but the excution of
$make package/sphinxbase-0.8/compile V=99 > logfile.txt
always end with the same error.

here is the log file :
     http://speedy.sh/hvFYP/logfile.txt

Please upload your log file to PasteBin service.

& here is the messages showed in the Terminal :
________________________________________________________________________________________
configure: WARNING: Disabling python since development headers were not found
install: omitting directory `/home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8'
make[2]: *** [/home/amir/Bureau/openwrt/bin/ramips/packages/sphinxbase-0.8_0.8-1_ramips.ipk] Error 1
make[1]: *** [package/sphinxbase-0.8/compile] Error 2
make: *** [package/sphinxbase-0.8/compile] Error 2
________________________________________________________________________________________
//for the first warning it's normal even when I compile the project for my PC it show and it end with succes.

******************************************

Please enclose your dump in [ code ] ... [ /code ] to show as a plain text block.

when I excute { $./configure } manualy for my PC configuration this script show error and telling me
./configure: line 2116: config.log: Permission denied
./configure: line 2126: config.log: Permission denied

unless I excute it with root : { $sudo ./configure }

Never use any sudo nor any privilege (root) account to run any configure scripts. It is very dangerous. If you run into the above problem, then chances are your account settings are to blame. In this case, you should use sudo to fix the permission issue.

any way I don't think that this is the source of problem cause what is done in my pc when I excute the configure script with root is maked when the configure is ecuted by the OpenWRT SDK.

I don't know about others, but please kindly check your spellings before you click the Submit reply button.

Thank you for your reply.


$make package/sphinxbase-0.8/compile V=99 > logfile.txt

here is the log file
      http://pastebin.com/CJj4juvJ

and here are the messages shown in the Terminal :
[ code ] configure: WARNING: Disabling python since development headers were not found
install: omitting directory `/home/amir/Bureau/openwrt/build_dir/target-mipsel_r2_uClibc-0.9.32/sphinxbase-0.8'
make[2]: *** [/home/amir/Bureau/openwrt/bin/ramips/packages/sphinxbase-0.8_0.8-1_ramips.ipk] Error 1
make[1]: *** [package/sphinxbase-0.8/compile] Error 2
make: *** [package/sphinxbase-0.8/compile] Error 2 [ /code ]

(Last edited by louwi on 8 Apr 2014, 14:24)

I am not sure I understood the problem you have encountered. It looked like the package compiled OK. Can you confirm the existence of this file /home/amir/Bureau/openwrt/bin/ramips/packages/sphinxbase-0.8_0.8-1_ramips.ipk ?

TIP: If you want PasteBin to highlight a certain line, you can prefix the line with @h@.

mazilo wrote:

I am not sure I understood the problem you have encountered. It looked like the package compiled OK. Can you confirm the existence of this file /home/amir/Bureau/openwrt/bin/ramips/packages/sphinxbase-0.8_0.8-1_ramips.ipk ?

The file don't exist.

The problem is theses errors :

make[2]: *** [/home/amir/Bureau/openwrt/bin/ramips/packages/sphinxbase-0.8_0.8-1_ramips.ipk] Error 1
make[1]: *** [package/sphinxbase-0.8/compile] Error 2
make: *** [package/sphinxbase-0.8/compile] Error 2

I know it succeed cross-compilation but when packaging the error is made.
All I need is the libraries that will be generated by this code.
theire is no way to get thoses libraries cross-compiled?

Try $make package/sphinxbase-0.8/compile BUILD_LOG=1 V=s to enable log and pastebin the content of the log file.

On line #45 of your OpenWRT Makefile for SphinxBase package, try replace the following:

$(INSTALL_BIN) $(PKG_BUILD_DIR) $(1)/bin/

with:

$(CP) $(PKG_BUILD_DIR)/bin $(1)

and see what happens.

thank you all for helping me smile problem had been solved.

it was that line
[cote]$(INSTALL_BIN) $(PKG_BUILD_DIR) $(1)/bin/[/cote}

$(PKG_BUILD_DIR) don't contain the sared librarie that had been compiled.
infact the *.so files are palced in the src directorie inside lib folders.

Hi,
I am try to cross-compile Sphinxbase and pockesphinx on TPlink MR3020 router. Im a jast noob, therefore i m use Makefile by Louwi. When i try to built Louwi test project (https://github.com/mwarning/openwrt-example-program) its work, but when i compile sphinxbase its end with error:

robot@ubuntu:~/openwrt$ make package/sphinxbase/compile V=s
make[1]: Entering directory `/home/robot/openwrt'
make[2]: Entering directory `/home/robot/openwrt/package/libs/toolchain'
...
bla bla bla
...
make[3]: Entering directory `/home/robot/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/sphinxbase'
cd .. && make  am--refresh
make[4]: Entering directory `/home/robot/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2'
make[4]: *** No rule to make target `am--refresh'.  Stop.
make[4]: Leaving directory `/home/robot/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2'
make[3]: *** [../aclocal.m4] Error 2
make[3]: Leaving directory `/home/robot/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/sphinxbase'
make[2]: *** [/home/robot/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/sphinxbase/.built] Error 2
make[2]: Leaving directory `/home/robot/openwrt/package/sphinxbase'
make[1]: *** [package/sphinxbase/compile] Error 2
make[1]: Leaving directory `/home/robot/openwrt'
make: *** [package/sphinxbase/compile] Error 2

Why its erroring? If i m right Louwi is get working ipk.
May be someone have pocketshinx ipk for MR3020 router? Please share it.

The discussion might have continued from here.