Compile single package questions/concerns

Hello,

I've managed to create a working Makefile for a package I wish to install:

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

include $(TOPDIR)/rules.mk

# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package:
$(PKG_BUILD_DIR)
PKG_NAME:=libax25
PKG_VERSION:=0.0.12-rc4
PKG_RELEASE:=1

PKG_MAINTAINER:=Ralf Baechle DL5RB <ralf@linux-mips.org>
PKG_LICENSE:=LGPL-2.1-only
PKG_LICENSE_FILES:=COPYING

PKG_BUILD_DIR:=/home/user/mypackages/examples/libax25

# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below
PKG_SOURCE:=libax25-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.linux-ax25.org/pub/libax25
PKG_MD5SUM:=9b2e6890ef20dd0cf8ac7fdb22e6a4b6

PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/package.mk

# Package definition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/libax25
  SECTION:=examples
  CATEGORY:=Examples
  TITLE:=ax25 library for hamradio applications
  URL:=http://www.linux-ax25.org/
  MAINTAINER:=Ralf Baechle DL5RB <ralf@linux-mips.org>, \
				Thomas Osterried DL9SAU <ax25@x-berg.in-berlin.de>
  DEPENDS:=+kmod-ax25
endef

# Package description; a more verbose description on what our package does
define Package/libax25/description
This library is for ham radio applications that use the ax25
protocol.  Included are routines to do ax25 address parsing, common
ax25 application config file parsing, etc.
endef

define Package/libax25/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
endef

$(eval $(call BuildPackage,libax25))

I modified this from the nano Makefile at: https://github.com/openwrt/packages/blob/master/utils/nano/Makefile

have setup SDK, path, feeds file, etc. and typed the commands:

cd /home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64
./scripts/feeds update mypackages
./scripts/feeds install -a -p mypackages
make package/libax25/compile

And my computer appears to be making a lot of IPK files...when I tested helloworld it only made one.

Is this because of the DEPENDS:=+kmod-ax25 argument?

If so...does this mean when I install this IPK on my router, that it will attempt to install kmod-ax25 first???

Is my Makefile missing something...?

I have further edited the Makefile, allowed hundreds of IPKs to compile, and I am now here:

daemon.c: In function 'daemon_start':
daemon.c:43:12: warning: implicit declaration of function 'open' [-Wimplicit-function-declaration]
  if ((fd = open("/dev/tty", O_RDWR)) >= 0) {
            ^
daemon.c:43:29: error: 'O_RDWR' undeclared (first use in this function)
  if ((fd = open("/dev/tty", O_RDWR)) >= 0) {
                             ^
daemon.c:43:29: note: each undeclared identifier is reported only once for each function it appears in
Makefile:461: recipe for target 'daemon.lo' failed
make[4]: *** [daemon.lo] Error 1
make[4]: Leaving directory '/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/build_dir/target-mips_24kc_musl-1.1.16/libax25-0.0.12-rc4'
Makefile:339: recipe for target 'all' failed

When compiling software, I recall I had to add the various arguments if errors appeared...but where in my Makefile do I specify to run with -Wimplicit-function-declaration ...and what is the proper syntax for the file (or provide a link to a tutorial on this specific topic)?

I may be wrong, and very well may be, but I don't believe a library should result in hundreds of additional packages being compiled (someone else will need to confirm if my understanding is correct, as I've never tried what you're doing).

  • As to your error, I'm not sure

It compiles without error with the following patch. Name it "patches/001_missing_includes.patch" or similar.

libax25-0.0.12-rc4/daemon.c.orig
diff -uN libax25-0.0.12-rc4/daemon.c.orig libax25-0.0.12-rc4/daemon.c
--- libax25-0.0.12-rc4/daemon.c.orig    2018-03-01 14:07:53.994106025 +0100
+++ libax25-0.0.12-rc4/daemon.c 2018-03-01 14:08:24.870789746 +0100
@@ -3,11 +3,13 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <errno.h>
+#include <fcntl.h>
 
 #include <sys/param.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 
 #include <netax25/daemon.h>

The install section also needs some changes.

And don't forget to remove PKG_BUILD_DIR if you are going to publish the Makefile for other people to use.

1 Like

Thanks!!!

I saw the header issue, but didn't know how to tell the compiler those headers would be in the downloaded TAR file.

Also, you noted:

Did you mean the local folder name? (I did remove it)

Also,does this line mean that OpenWRT will install kmod-ax25 before installing the IPK:

I'm now getting this error:

install: cannot stat '/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/build_dir/target-mips_24kc_musl-1.1.16/libax25-0.0.12-rc4/libax25': No such file or directory
Makefile:53: recipe for target '/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/bin/packages/mips_24kc/mypackages/libax25_0.0.12-rc4-1_mips_24kc.ipk' failed
make[2]: *** [/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/bin/packages/mips_24kc/mypackages/libax25_0.0.12-rc4-1_mips_24kc.ipk] Error 1
make[2]: Leaving directory '/home/user/mypackages/examples/libax25'
package/Makefile:105: recipe for target 'package/feeds/mypackages/libax25/compile' failed
make[1]: *** [package/feeds/mypackages/libax25/compile] Error 2
make[1]: Leaving directory '/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64'
/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/include/toplevel.mk:191: recipe for target 'package/libax25/compile' failed
make: *** [package/libax25/compile] Error 2

Any ideas?

The following should fix problem with: '...libax25': No such file or directory

define Package/libax25/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/$(PKG_NAME).so.* $(1)/usr/lib/
endef
1 Like

Excellent, I have an IPK file!!!

Thank you!

That was one of three (now I have to compile the tools). On the second, I'm getting this response, but receiving no error...

make[2]: Entering directory '/home/user/mypackages/examples/ax25-tools'
if [ -f /home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/staging_dir/target-mips_24kc_musl-1.1.16/pkginfo/ax25-tools.default.install.clean ]; then rm -f /home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/staging_dir/target-mips_24kc_musl-1.1.16/pkginfo/ax25-tools.default.install /home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/staging_dir/target-mips_24kc_musl-1.1.16/pkginfo/ax25-tools.default.install.clean; fi
make[2]: Leaving directory '/home/user/mypackages/examples/ax25-tools'
make[1]: Leaving directory '/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64'

Completely starting from scratch:

checking for zlibVersion in -lz... no
checking for ax25_config_load_ports in -lax25... no
configure: error: Could not find the libax25 libraries; aborting
Makefile:55: recipe for target '/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/build_dir/target-mips_24kc_musl-1.1.16/ax25-tools-0.0.10-rc4/.configured_yynn' failed
make[2]: *** [/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/build_dir/target-mips_24kc_musl-1.1.16/ax25-tools-0.0.10-rc4/.configured_yynn] Error 1
make[2]: Leaving directory '/home/user/mypackages/examples/ax25-tools'
package/Makefile:105: recipe for target 'package/feeds/mypackages/ax25-tools/compile' failed
make[1]: *** [package/feeds/mypackages/ax25-tools/compile] Error 2
make[1]: Leaving directory '/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64'
/home/user/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/include/toplevel.mk:191: recipe for target 'package/ax25-tools/compile' failed
make: *** [package/ax25-tools/compile] Error 2

How do I add the proper libraries (they appear to be part of the first package I compiled)?

If anyone could provide a links to more detailed information regarding how to do this...I've successfully compiled the dependency, I jus don't know how to tell the SDK or makefile how to locate them...

  • Should I move the foo.h files to the correct folder, ot is it looking for the libax25 binaries?
  • I assume it's looking for the binaries (and not the header files from the other TAR). If so...does it want the x86_64 or mips_24kc binaries?

I've found this has been requested before, no action:

https://lists.openwrt.org/pipermail/openwrt-devel/2009-July/thread.html#4630

Can you give copy of succesful file ?

It might bee good idea to have make files
to all libax25 hamlib aprsx combined,..?

Like I try to get A5-V11 to work as aprx + modem
also try if enough power/sapce left for rtl-sdr !!

I took many hours to find fixes,... copy netax25 directory to build_dirs,...

But it could be better procedure to build aprx libax25 + all tools from
sources and I can not find make file's which should be added
to cloned git sources ,... BUT NOW I KNOW HOW TO MAKE ONE !