OpenWrt Forum Archive

Topic: Compiling new tinc

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

Greetings everyone.

I'm compiling a newer version of Tinc VPN because of some serious bug fixes in regards to how Tinc forwards broadcast packets (which it destroys). I've got the latest svn grab of this fix for Tinc, and was wanting to make sure that I have the process correct.

All of my endpoints use WhiteRussian 0.4 at the moment; and I dont want to have to upgrade every one (reconfig/reinstall) in order to get this fix applied.

So, having those two thoughts in mind, I've grabbed the whiterussian_rc4 file at http://downloads.openwrt.org/whiterussi … c4.tar.bz2 , and proceeded to follow these instructions: http://forum.openwrt.org/viewtopic.php?pid=21811 .

What I hope to have at the least is a binary I can SCP to the routers, and at the most a package.

Is this the correct proceedure?

Thx.

See BuildingPackagesHowTo. You don't have to build the full buildroot for a single package. Checkout the package from subversion via

svn co https://svn.openwrt.org/openwrt/branches/whiterussian/openwrt/package/tinc/

in the package directory of the SDK. Update it, build it and send a patch.

Btw. we are at RC5 now. RC4 is obsolete.

In regards to compiling, I also note that when I try to run 'make' for the whiterussian_rc4 I have the following error:

checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
make[3]: *** [configure-libiberty] Error 1
make[3]: Leaving directory `/home/gnome/openwrt/toolchain_build_mipsel/binutils-2.16.1-build'
make[2]: *** [/home/gnome/openwrt/toolchain_build_mipsel/binutils-2.16.1-build/binutils/objdump] Error 2
make[2]: Leaving directory `/home/gnome/openwrt/toolchain/binutils'
make[1]: *** [binutils-compile] Error 2
make[1]: Leaving directory `/home/gnome/openwrt/toolchain'
make: *** [toolchain/install] Error 2

Thanks for the followup;

I'm starting with the tinc package available for Tinc here: https://dev.openwrt.org/browser/trunk/o … ckage/tinc
Just for the Makefile and Config.in.

When I just try and use this, I follow the instructions here: http://wiki.openwrt.org/BuildingPackagesHowTo
and get to the compile part. When I try the 'make clean && make compile' part, I get nothing but bad news. Does anyone have any pointers?

$ make clean && make compile
make[1]: Entering directory `/home/gnome/OpenWrt-SDK-Linux-i686-1/package/tinc'
make[1]: *** virtual memory exhausted.  Stop.
make[1]: Leaving directory `/home/gnome/OpenWrt-SDK-Linux-i686-1/package/tinc'
make: *** [tinc-svn-clean] Error 2

None of the system 'swap' space is in use, and I have over half a gig of RAM free.
$  uname -a
Linux rancid 2.6.16.10 #1 SMP PREEMPT Sat Apr 29 23:37:45 EDT 2006 i686 unknown unknown GNU/Linux

Thanks!

Nevermind, I think this may be an issue is Make 3.80

Just incase anyone else was a blind as I was before: http://wrt54g.free.fr/openwrt/tools/mak … ed.tar.bz2

Now, the only other problem is

*** Error: CONTROL/control is missing field Package
*** Error: CONTROL/control is missing field Description
*** Error: CONTROL/control is missing field Section
The Section field should have one of the following values:
admin, base, comm, editors, extras, games, graphics, kernel, libs, misc, net, text, web, x11
*** Error: CONTROL/control is missing field Priority
The Priority field should have one of the following values:
required, important, standard, optional, extra.
If you don't know which priority value you should be using, then use `optional'

ipkg-build: Please fix the above errors and try again.
make[1]: *** [/home/gnome/OpenWrt-SDK-Linux-i686-1/bin/packages/tinc_1.0.4-1_mipsel.ipk] Error 1
make[1]: Leaving directory `/home/gnome/OpenWrt-SDK-Linux-i686-1/package/tinc'
make: *** [tinc-compile] Error 2


What does that mean?

NM- typo'd tinc.control

So, now I am stuck. I've tried a series of options, and none seem to work for the new tinc Makefile.

Here is the error

checking for openssl/pem.h... yes
checking openssl/engine.h usability... no
checking openssl/engine.h presence... no
checking for openssl/engine.h... no
configure: error: OpenSSL header files not found.
make[1]: *** [/home/gnome/OpenWrt-SDK-Linux-i686-1-old/build_mipsel/tinc-1.0.5/.configured] Error 1
make[1]: Leaving directory `/home/gnome/OpenWrt-SDK-Linux-i686-1-old/package/tinc'
make: *** [tinc-compile] Error 2

No matter what I try, I cannot get the compiler to find the libs for openssl. I've even tried, in the Makefile entering

--with-openssl-include=/home/gnome/OpenWrt-SDK-Linux-i686-1-old/build_mipsel/openssl-0.9.7i/include/openssl/ \

Any pointers would be great on this one. I am definately stuck now.

look in the config.log.  See what it says about engine.h...  Post the results.

--Yan

Same as above- it cant find the openssl headers.

| #include <openssl/engine.h>
configure:10130: result: no
configure:10165: checking for openssl/engine.h
configure:10172: result: no
configure:10182: error: OpenSSL header files not found.


I'm going to try and copy them into the mipsel include directory

Before you do that, add the appropraite -I to the CFLAGS.  See my tail of woe: http://forum.openwrt.org/viewtopic.php?id=5631

Somewhere in your makefile you have a CFLAGS=....  Just add the appropriate directory in there (taken from my attempt to build gphoto) - I had to include headers from libusb:

CFLAGS="$(TARGET_CFLAGS) -I. -I$(STAGING_DIR)/lib/gcc/mipsel-linux-uclibc/3.4.4/include/ -I$(BUILD_DIR)/$(LIBUSB) -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include/linux/ -nostdinc "

In the long run, it's much easier to live within the framework of your toolchain than to mess with it....

--Yan

Thanks cptdondo. So taking your suggestion

CFLAGS="$(TARGET_CFLAGS) -I. -I$(STAGING_DIR)/lib/gcc/mipsel-linux-uclibc/3.4.4/include/ -I$(BUILD_DIR)/$(LIBOPENSSL) -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include/linux/ -nostdinc" \

I still get the same error

checking openssl/evp.h usability... yes
checking openssl/evp.h presence... yes
checking for openssl/evp.h... yes
checking openssl/rsa.h usability... yes
checking openssl/rsa.h presence... yes
checking for openssl/rsa.h... yes
checking openssl/rand.h usability... yes
checking openssl/rand.h presence... yes
checking for openssl/rand.h... yes
checking openssl/err.h usability... yes
checking openssl/err.h presence... yes
checking for openssl/err.h... yes
checking openssl/sha.h usability... yes
checking openssl/sha.h presence... yes
checking for openssl/sha.h... yes
checking openssl/pem.h usability... yes
checking openssl/pem.h presence... yes
checking for openssl/pem.h... yes
checking openssl/engine.h usability... no
checking openssl/engine.h presence... no
checking for openssl/engine.h... no
configure: error: OpenSSL header files not found.
make[1]: *** [/home/gnome/OpenWrt-SDK-Linux-i686-1-old/build_mipsel/tinc-1.0.5/.configured] Error 1
make[1]: Leaving directory `/home/gnome/OpenWrt-SDK-Linux-i686-1-old/package/tinc'
make: *** [tinc-compile] Error 2


Attached now is the Makefile for this version tinc that I'm trying to compile.

# $Id$

include $(TOPDIR)/rules.mk

PKG_NAME:=tinc
PKG_VERSION:=1.0.5
PKG_RELEASE:=1
PKG_MD5SUM:=63887373dd763f8d90cecc5a3616c363

PKG_SOURCE_URL:=http://www.mywebserver.com
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_CAT:=zcat

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install

include $(TOPDIR)/package/rules.mk

$(eval $(call PKG_template,TINC,tinc,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))

$(PKG_BUILD_DIR)/.configured:
        (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
                $(TARGET_CONFIGURE_OPTS) \
                CFLAGS="$(TARGET_CFLAGS) -I. -I$(STAGING_DIR)/lib/gcc/mipsel-linux-uclibc/3.4.4/include/ -I$(BUILD_DIR)/$(LIBOPENSSL) -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include/linux/ -nostdinc" \
                CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
                LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
                ./configure \
                  --target=$(GNU_TARGET_NAME) \
                  --host=$(GNU_TARGET_NAME) \
                  --build=$(GNU_HOST_NAME) \
                  --program-prefix="" \
                  --program-suffix="" \
                  --prefix=/usr \
                  --exec-prefix=/usr \
                  --bindir=/usr/bin \
                  --datadir=/usr/share \
                  --includedir=/usr/include \
                  --infodir=/usr/share/info \
                  --libdir=/usr/lib \
                  --libexecdir=/usr/lib \
                  --localstatedir=/var \
                  --mandir=/usr/share/man \
                  --sbindir=/usr/sbin \
                  --sysconfdir=/etc \
                  $(DISABLE_NLS) \
                  $(DISABLE_LARGEFILE) \
                  --with-kernel=$(LINUX_DIR) \
                  --with-zlib=$(STAGING_DIR)/usr/ \
        );
        touch $@

$(PKG_BUILD_DIR)/.built:
        rm -rf $(PKG_INSTALL_DIR)
        mkdir -p $(PKG_INSTALL_DIR)
        $(MAKE) -C $(PKG_BUILD_DIR) \
                CC=$(TARGET_CC) \
                CFLAGS="$(TARGET_CFLAGS)" \
                DESTDIR="$(PKG_INSTALL_DIR)" \
                all install
        touch $@

$(IPKG_TINC):
        install -m0755 -d $(IDIR_TINC)/usr/sbin
        $(CP) $(PKG_INSTALL_DIR)/usr/sbin/tincd $(IDIR_TINC)/usr/sbin/
        $(RSTRIP) $(IDIR_TINC)
        $(IPKG_BUILD) $(IDIR_TINC) $(PACKAGE_DIR)

Dumb quesiton: does openssl/engine.h actually exist?  It's finding all the others....

--Yan

One more thing.... configure creates a file called config.log which is a very detailed log of all the tests it performs.  You need to look inside that file, and find out why the test for engine.h is failing.... Often it's a compile issue, not directly related to the file...

--Yan

It exists, but it cant find it- it's a path issue and I dont know that path for where it is looking for the libs. I can paste the whole log, but it doesnt tell me where it is looking for the includes, and as such it just complains that it cant find the header files. Without pasting the whole log, here is a grep.

grep "engine.h" build_mipsel/tinc-1.0.5/config.log
configure:10049: checking openssl/engine.h usability
conftest.c:133:28: openssl/engine.h: No such file or directory
| #include <openssl/engine.h>
configure:10094: checking openssl/engine.h presence
conftest.c:99:28: openssl/engine.h: No such file or directory
| #include <openssl/engine.h>
configure:10165: checking for openssl/engine.h
ac_cv_header_openssl_engine_h=no

When I compile hte package outside of this SDK, I have to be very specific as to where the files are located for the configure build.

Did you define LIBOPENSSL before using it in CFLAGS?

--Yan

Good point- I did not. I tried a variety of configurations with the basics below (specifying full path, partial paths, etc etc)

LIBOPENSSL:=/openssl-0.9.7i/include/

and also even replacing the above with

$(eval $(call PKG_template,LIBOPENSSL,libopenssl,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
$(eval $(call PKG_template,OPENSSL_UTIL,openssl-util,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))

which came from the openssl Makefile

Still the same error and same results in the config.log file.

It struck me to find where one of the other files are located that it could locate easily, IE 'sha.h' and then run a diff on where 'engine.h' exists. I think I may have found the path for which it is stating it cannot find the libs.

/staging_dir_mipsel/usr/include/openssl/

This is just becoming a headache smile

In the Makefile, I've 'gone back to basics' using the origional Makefile that came with the previous version of Tinc. I've then added the following lines to get out of the 'compile'

                  --with-openssl-include=/usr/include/ \
                  --with-openssl-lib=/home/gnome/OpenWrt-SDK-Linux-i686-1-old/staging_dir_mipsel/usr/lib/ \

for which I get

checking openssl/engine.h usability... no
checking openssl/engine.h presence... yes
configure: WARNING: openssl/engine.h: present but cannot be compiled
configure: WARNING: openssl/engine.h:     check for missing prerequisite headers?
configure: WARNING: openssl/engine.h: see the Autoconf documentation
configure: WARNING: openssl/engine.h:     section "Present But Cannot Be Compiled"
configure: WARNING: openssl/engine.h: proceeding with the preprocessor's result
configure: WARNING: openssl/engine.h: in the future, the compiler will take precedence
configure: WARNING:     ## ------------------------------------------ ##
configure: WARNING:     ## Report this to the AC_PACKAGE_NAME lists.  ##
configure: WARNING:     ## ------------------------------------------ ##
checking for openssl/engine.h... yes

Configure continues to build, then I get to the next error:

net.c: In function `main_loop':
net.c:123: error: impossible constraint in `asm'
net.c:124: error: impossible constraint in `asm'
net.c:297: error: impossible constraint in `asm'
net.c:309: error: impossible constraint in `asm'
net.c:332: error: impossible constraint in `asm'
net.c:341: error: impossible constraint in `asm'
net.c:344: error: impossible constraint in `asm'
{standard input}: Assembler messages:
{standard input}:509: Error: unrecognized opcode `btsl $2,0($3)'
{standard input}:519: Error: unrecognized opcode `btsl $3,0($2)'
{standard input}:551: Error: unrecognized opcode `btsl $3,0($2)'
{standard input}:562: Error: unrecognized opcode `btsl $4,0($2)'
{standard input}:585: Error: unrecognized opcode `btsl $3,0($2)'
make[4]: *** [net.o] Error 1
make[4]: Leaving directory `/home/gnome/OpenWrt-SDK-Linux-i686-1-old/build_mipsel/tinc-1.0.5/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/gnome/OpenWrt-SDK-Linux-i686-1-old/build_mipsel/tinc-1.0.5'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/gnome/OpenWrt-SDK-Linux-i686-1-old/build_mipsel/tinc-1.0.5'
make[1]: *** [/home/gnome/OpenWrt-SDK-Linux-i686-1-old/build_mipsel/tinc-1.0.5/.built] Error 2
make[1]: Leaving directory `/home/gnome/OpenWrt-SDK-Linux-i686-1-old/package/tinc'
make: *** [tinc-compile] Error 2

For which I think the error may actually be in the source for Tinc. So, I open up net.c, and jump to line 123.... I see no reference to this error. So, I go to main_loop.... and am even more baffled as to why this error was kicked out.

The only other thing is that in order to get this to 'configure' I had to rebuild the SDK's openssl libs to include 'engine.h' and other headers.

I'm now really really lost...

OK, this is *exactly * what I was running up against....

something (libtool maybe) is pulling in header files from your local system - i.e. /usr/include, rather than $STAGING_DIR/inlcude.

That was the whole purpose of the -nostdinc in my CFLAGS....

So you can specify the entire path in the LIBOPENSSL:= line:

(And don't feel bad; I've been fighting with this since about last Sunday, and just figured it out yesterday....  And I try to do this for a living....)

:-)

I really need to update the wiki with this stuff....

--Yan

Thanks Yan,

I'm going to give this a shot first thing tomorrow; i didnt realize how much time I put into this today until it started getting dark out tongue

I keep yielding the same result unfortunately. I've engaged the developer for tinc again. It should be noted that this version compiles just fine under the x86 environment; it's just the cross compile which is being a pain.

Has anyone seen error's like this before?:

net.c: In function `main_loop':
net.c:123: error: impossible constraint in `asm'
net.c:124: error: impossible constraint in `asm'
net.c:297: error: impossible constraint in `asm'
net.c:309: error: impossible constraint in `asm'
net.c:332: error: impossible constraint in `asm'
net.c:341: error: impossible constraint in `asm'
net.c:344: error: impossible constraint in `asm'
{standard input}: Assembler messages:
{standard input}:509: Error: unrecognized opcode `btsl $2,0($3)'
{standard input}:519: Error: unrecognized opcode `btsl $3,0($2)'
{standard input}:551: Error: unrecognized opcode `btsl $3,0($2)'
{standard input}:562: Error: unrecognized opcode `btsl $4,0($2)'
{standard input}:585: Error: unrecognized opcode `btsl $3,0($2)'


I'm attributing this to being the SDK. I dont know why that would be happening either (I'm probably asking the wrong questions to google).

Anyways, if anyone has additional pointers, please let me know. I'm going to keep working on this, and once it does work I'll paste the info here.

I hate to sound repetitive, but you have a header problem....

If you want to see how I got around it, grab the patch for gphoto2  from https://dev.openwrt.org/attachment/tick … o2-1.patch and see what I did.  The patch assumes that you have built the required libraries as part of the SDK.

Have you done that?  Do you have the appropriate ssl source and binaries built within the SDK?

To see how I did it, again, grab all of the patches from https://dev.openwrt.org/attachment/ticket/545  and look at them.  Basically, they assume you build libusb and libexif, then libgphoto, and finally gphoto2.  (I am not suggesting that what I did is the canonical way of doing it; it's the first time I used the SDK and I know I made all sorts of bonehead errors.  In fact I should be checking for libpopt and libltdl but I don't....)

--Yan

The discussion might have continued from here.