What's new

Need help on cross compile

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

maxduke

Occasional Visitor
I currently have 3.0.0.4.374.32 (Merlin build) on my RT-AC66U and that is working fine.
Now I'm going to use some applications other than the existing packages in the repository. That means I have to compile those apps by myself.

The question is how can I setup the cross compile environment for asswrt-merlin so that I can make the apps run on my device?

Please advise.

Thanks.
 
Thanks for the reply.

Did you mean that the cross-compilation environment for the custom firmware can also be used to compile custom application that can run on the device?

sudo ln -s ~/asuswrt-merlin/tools/brcm /opt/brcm

export PATH=$PATH:/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin
export AR=mipsel-linux-ar
export AS=mipsel-linux-as
export LD=mipsel-linux-ld
export NM=mipsel-linux-nm
export CC=mipsel-linux-gcc
export CPP=mipsel-linux-cpp
export GCC=mipsel-linux-gcc
export CXX=mipsel-linux-g++
export RANLIB=mipsel-linux-uclibc-ranlib
export ac_cv_linux_vers=2.6.32
export LDFLAGS=”-static”
export CFLAGS=”-Os -s”

./configure --host=mips-linux --prefix=/tmp

The above statements are what I input to "configure" before "make", are they correct?

I'm going to compile something which depends on openssl (libssl-dev), but I found there's no related headers in toolchain's "/includes" and there's no related ".so" in toolchain's "/lib".
What should I do for this scenario? Download the source code for openssl and compile that first? or there's any other way to solve this?
 
openssl is part of the firmware, so you would have to link against the FW version of it.
 
Thanks for the information and the asuswrt-merlin build!

For openssl libs I can only find "libcrypto.so" in
asuswrt-merlin / release / src-rt-6.x.4708 / toolchains / hndtools-arm-linux-2.6.36-uclibc-4.5.3 / arm-brcm-linux-uclibcgnueabi / sysroot / usr / lib / libcrypto.so
I think that is from rt-ac56u build, can I use that for my rt-ac66u?

Also for openssl headers , can I use
asuswrt-merlin / release / src / router / openssl / include / openssl /
for my device?
 
Thanks for the information and the asuswrt-merlin build!

For openssl libs I can only find "libcrypto.so" in

I think that is from rt-ac56u build, can I use that for my rt-ac66u?

Also for openssl headers , can I use

for my device?

The RT-AC56U toolchain is only for ARM-based devices. You must use the toolchain from asuswrt/toolchain/ for MIPS routers.

libcrypto is part of openssl. As pointed out, you must link against the firmware version of libcrypto, as compiled from asuswrt/release/src/router/openssl .
 
I tried to compile asuswrt/release/src/router/openssl and I want to get a ".so".
So I'm using
./config no-asm shared --prefix=/opt/ac66u/openssl/install
to do the config.

And I get the below information after config:
You gave the option 'shared'. Normally, that would give you shared libraries.
Unfortunately, the OpenSSL configuration doesn't include shared library support
for this platform yet, so it will pretend you gave the option 'no-shared'. If
you can inform the developpers (openssl-dev\@openssl.org) how to support shared
libraries on this platform, they will at least look at it and try their best
(but please first make sure you have tried with a current version of OpenSSL).
 
Also if I continue to compile I will get an error:

../libcrypto.a(eng_all.o) : In function`ENGINE_load_builtin_engines':
eng_all.c: (.text+0x30) : undefined reference to `ENGINE_load_4758cca'
eng_all.c: (.text+0x48) : undefined reference to `ENGINE_load_aep'
eng_all.c: (.text+0x60) : undefined reference to `ENGINE_load_atalla'
eng_all.c: (.text+0x78) : undefined reference to `ENGINE_load_cswift'
eng_all.c: (.text+0x90) : undefined reference to `ENGINE_load_chil'
eng_all.c: (.text+0xa8) : undefined reference to `ENGINE_load_nuron'
eng_all.c: (.text+0xc0) : undefined reference to `ENGINE_load_sureware'
eng_all.c: (.text+0xd8) : undefined reference to `ENGINE_load_ubsec'
eng_all.c: (.text+0xf0) : undefined reference to `ENGINE_load_padlock'
eng_all.c: (.text+0x108) : undefined reference to `ENGINE_load_gost'
collect2: ld returned 1 exit status

Anyway I can bypass this error by editing the Makefile

change
DIRS= crypto ssl apps
to
DIRS= crypto ssl

The issue is that I can only get ".a" from the compile.
 
Cross compiling is a complex task, i've had the same problem when i tried to compile pure-ftpd with ssl support, i was able to native compile it on the router but i never got it working with the cross compiler, i haven't touch it anymore but i can take a look around. What's the apps you are trying to compile?!!
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top