OpenWrt Forum Archive

Topic: [Workaround-Solved]how to compile a program?

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

Hello all, im new at the forum but kind of old using openwrt for routers and other aplications.

I have a bash scripton my computer running on centos 5.9, This script is made to make a custom configuration in some equipments that i use via ssh, but the equipments by default have a password, i cant use ssh keys because i only need to config the outof the box equipment to our needs and plug it off so i used a tool called ssh-pass (http://sourceforge.net/projects/sshpass/).

with this tool i can make commands like:

sshpass -p 'password' ssh admin@192.168.1.1 'reboot'

and run a lot of commands sending the password, if i dont have this tool i need to put the password every time a command its set.

Im not really sure how to do this, i need it running on openwrt, and i dont know where to start. Can you give me a hint?

Best regards.

Ps. on Centos i installed it via yum in case you wonder how i did it on the computer.

JB.

(Last edited by CyB3RMX on 9 Apr 2013, 16:29)

i tried to do what the INSTALL file says.. but i get this:

root@OpenWrt:/opt/sshpass-1.05# ./configure       
checking for a BSD-compatible install... ./install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/opt/sshpass-1.05':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

Aparently i dont have any C compiler, its there one available via opgk? i installed libgcc but it seems that i dont have any compiler and thats my problem sad

Thanks in advance.

(Last edited by CyB3RMX on 4 Apr 2013, 19:55)

The idea with openwrt (and often embedded programming in general) is that you cross-compile things.

You compile them on on kind of machine (e.g. your  x86  Centos box)  to run on some other kind of machine (e.g. mips based  router running openwrt)

Setting that up is often a big pain, but the openwrt environment makes it relatively easy (though it IS still more involved than installing a package):
http://wiki.openwrt.org/doc/howto/obtain.firmware.sdk

An alternative:
If your "equipment" supports keys you can do one command up front to copy over (or append a line to  ~admin/.ssh/authorized_keys

and then have all the subsequent commands use certificate auth.

however... why do you need to run this from the router anyway? 
If you can ssh into the router can't you just ssh directly to the machine ?
(or, if you need to get through the firewall, use an ssh tunnel port forwarding to allow you to ssh to the  target equipment )

vhrm wrote:

The idea with openwrt (and often embedded programming in general) is that you cross-compile things.

You compile them on on kind of machine (e.g. your  x86  Centos box)  to run on some other kind of machine (e.g. mips based  router running openwrt)

Setting that up is often a big pain, but the openwrt environment makes it relatively easy (though it IS still more involved than installing a package):
http://wiki.openwrt.org/doc/howto/obtain.firmware.sdk

An alternative:
If your "equipment" supports keys you can do one command up front to copy over (or append a line to  ~admin/.ssh/authorized_keys

and then have all the subsequent commands use certificate auth.

however... why do you need to run this from the router anyway? 
If you can ssh into the router can't you just ssh directly to the machine ?
(or, if you need to get through the firewall, use an ssh tunnel port forwarding to allow you to ssh to the  target equipment )


Hello vhrm,
i was writing you all the problem and then i realize that it supports keys smile

i think that will do it, i need to change all the script tough.

Thanks!

Best regards!

JB

Roman79148 wrote:

Great idea for  hot to compile a program.

Yeah, works like charm but i had to get rid of the dropbear ssh server and install openssh client/server as i have it on my CentOS box to unify all criteria. Works like a swiss clock now. smile

Thanks all for your help / interest smile

JB

The discussion might have continued from here.