Building a new Addon

In the IPFire 2.x - Building Addons wiki page it mentions Ubuntu 64-bit which I’ve never used. I do have a Debian x86_64 built up on a Dell Vostro 220s (Intel Core2 DUO).

Are there any issues or gotchas using Debian vs. Ubuntu for IPFire building? I’m assuming all is similar enough that I should be OK…

Hi Jon,
take alook in here --> https://wiki.ipfire.org/devel/ipfire-2-x/build-howto, you can also find the Debian DEPs for a building environment.

May this helps.

Best,

Erik

1 Like

This is supposed to be an example. I am sure that pretty much any Linux distribution works.

1 Like

Thanks for the info about Debian vs Ubuntu. (I’ll update the wiki in the next few days to include more info)

After that I got stuck again! In the Starting section I am at cache.

Is this a cache folder I create? Like:

mkdir -p /home/Jon/foo2zjs/cache

Or is this a cache folder located somewhere else on my build computer?

-AND-

If foomatic something I need to download and place in the cache folder? Or something I need to install as a Addon? Or???

Hi Jon,

if you´d already downloaded the sources -->

./make.sh downloadsrc

it is located in the IPFire source base directory */ipfire-2.x/cache

yes, every source code package which you want to compile for IPFire is located under cache.

Best,

Erik

1 Like

I’m missing the obvious… I have no make.sh. Are there other sources beside foo2zjs or foomatic??

I thought building an Addon (which I am interested in) would be simpler to learn then building IPFire (which seems WAY over my head).

So far this is done:

  1. built up and updated a Debian box.
  2. Installed IPFire 2.x - Build Howto > Debian
    • since I did not want to build IPFire I didn’t go down the entire wiki page.
    • I stopped before How To Build IPFire

Is this where I am going off the rails?

That depends on what you want to do. The foo* sources are all related to a print server. Unless you want to build your own print server, you don’t have to have these at all. It’s just an example!

Understood. I am just following the example for today. In the future I’ll try my own.

I may have gotten a little farther (or I may have gone down the wrong path!)

  1. built up and updated a Debian box.
  2. Installed IPFire 2.x - Build Howto > Debian
  3. I did the Initial Git setup
    • But got this error that I ignored for short term:
      $ git config sendemail.to development@lists.ipfire.org
      fatal: not in a git directory
      
  4. I downloaded the IPFire 2.x - master from git.
    • And the clone ended up at /home/Jon/ipfire-2.x. Hope this is OK.
  5. Then I ran:
    cd /home/Jon/ipfire-2.x
    ./make.sh downloadsrc
    
    from How To Build IPFire - Step 1: Grabbing the source.

Does this seem like the right path? I feel like I am jumping around from wiki page to wiki page…

and yes, I will update the wikis if I can figure it out!

Hi all,

it seems that

fatal: not in a git directory

is the problem since this command should work. You need to cd into */ipfire-2.x first before you can configure git. The other question is, would you like to send patches via mail to the developer mailinglist (does your account works for this ?)? To make your first steps, configuring the git mail system is not need.

As a fast one:

git clone git://git.ipfire.org/ipfire-2.x.git

cd into */ipfire-2.x

# Setup personal config
git config --global user.name FULLNAME
git config --global user.email EMAIL
git config --global color.ui auto

# To build a 64bit architecture
echo TARGET_ARCH=x86_64 > .config
# To build ARM
echo TARGET_ARCH=armv5tel > .config
# Nothing to do for 32 bit 

# Setup email config only needed to send patches to developer mailinglist
git config --global sendemail.smtpencryption ssl
git config --global sendemail.smtpserver submissions.ipfire.org
git config --global sendemail.smtpserverport 465
git config --global sendemail.smtpuser USERNAME
git config --global sendemail.smtppass PASSWORD

git config --global sendemail.smtpsslcertpath ''

# Get the sources, the toolchain and build it
# If you not su´ed into root or building on an IPFire DEV env, 
# you will need sudo before './make.sh'
./make.sh downloadsrc
./make.sh gettoolchain
./make.sh build

after the building process, */ipfire-2.x/build is presant to change into chroot use
./make.sh shell
and download your sources checkout howto build and/or test around with your addons or modifications, toolchains are available there.

For the first your playground is ready :slight_smile:

May this helps.

Best,

Erik

Got it! The cd into */ipfire-2.x was what I missed. Tnx!

Agreed. I am just learning for now and probably not needed at this time.

I did all of these steps before except the:

# To build a 64bit architecture
echo TARGET_ARCH=x86_64 > .config

and then I did:

$ cd ipfire-2.x
$ ./make.sh downloadsrc
$ ./make.sh gettoolchain
$ ./make.sh build
. . .
ERROR: root privileges required for building                                                                                                 [ FAIL ]
    Check /home/pi/ipfire-2.x/log/_build.preparation.log for errors if applicable                                                            [ FAIL ]

$ sudo ./make.sh build
. . .

And ./make.sh build ran for a REALLY long time… :sleeping:

How do I rebuild my playground after adding in echo TARGET_ARCH=x86_64 > .config ?
 

Also, near the end of the 1st build I got this error:

ipset (7.3)                                                                                                                      [       34 ][ DONE ]
dnsdist (1.4.0)                                                                                                                  [       17 ][ FAIL ]

    -j [N], --jobs[=N]          Allow N jobs at once; infinite jobs with no arg.
    -k, --keep-going            Keep going when some targets can't be made.
    -l [N], --load-average[=N], --max-load[=N]
    Don't start multiple jobs unless load is below N.
    -L, --check-symlink-times   Use the latest mtime between symlinks and target.
    -n, --just-print, --dry-run, --recon
    . . .
    Consider FILE to be infinitely new.
    --warn-undefined-variables  Warn when an undefined variable is referenced.
    
    This program built for x86_64-pc-linux-gnu
    Report bugs to <bug-make@gnu.org>
    make: *** [dnsdist:84: /usr/src/log/dnsdist-1.4.0] Error 2

ERROR: Building dnsdist                                                                                                                      [ FAIL ]
    Check /home/pi/ipfire-2.x/log/_build.ipfire.log for errors if applicable                                                                 [ FAIL ]
pi@dellDeb:~/ipfire-2.x $ 

What is Error 2??

I didn’t see an error in _build.ipfire.log but I think it may have gotten overwritten when I ran
sudo ./make.sh build a second time.

I’m not sure I understand "change into chroot use ./make.sh shell". Am I running make.sh shell after sudo su or???

i build on an IPFire ENV therefore i didn´t need sudo an have forgotten to mentioned it but adapted it above.

this is the current actual development, this can happens if not all patches are integrated, ‘Error 2’ have something to do with ‘make $(MAKETUNING)’ in dnsdist LFS. If you comment it e.g.:
cd $(DIR_APP) && make #$(MAKETUNING)
the build runs through but that one can be reported in the developer mailinglist which needs to be fixed there and 99%, it will be fixed in another way as i did it with my workaround.

the error has been displayed like you posted it, it should be findable also in _build.ipfire.log e.g.:
tail -100 log_build.ipfire.log

The chroot environment is a complete build of IPFire with all addons but also with all your modifications in it. If you clean up
sudo ./make.sh clean
this directory disappears and IPFire needs to be completely rebuild again (this does not take so long as the first time), so far you can make what ever you want in this directory. You can test there your addons, modifications or try to make a Windows system out of it :crazy_face: .

Hopefully not all clarity has been disappeared.

Best,

Erik

Sorry - all clarity is gone! :exploding_head:

I got lost here:

  • What is dnsdist LFS?
  • what and where is the file with make $(MAKETUNING)?

EDIT: I found a file but I don’t know what it is or what is does…

and I see LFS mentioned: IPFire Wiki - LFS build fragment for building Addons.

$ cat /home/pi/ipfire-2.x/lfs/dnsdist

###############################################################################
#                                                                             #
# IPFire.org - A linux based firewall                                         #
# Copyright (C) 2007-2018  IPFire Team  <info@ipfire.org>                     #
#                                                                             #
# This program is free software: you can redistribute it and/or modify        #
# it under the terms of the GNU General Public License as published by        #
# the Free Software Foundation, either version 3 of the License, or           #
# (at your option) any later version.                                         #
#                                                                             #
# This program is distributed in the hope that it will be useful,             #
# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
# GNU General Public License for more details.                                #
#                                                                             #
# You should have received a copy of the GNU General Public License           #
# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
#                                                                             #
###############################################################################

###############################################################################
# Definitions
###############################################################################

include Config

VER        = 1.4.0

THISAPP    = dnsdist-$(VER)
DL_FILE    = $(THISAPP).tar.bz2
DL_FROM    = $(URL_IPFIRE)
DIR_APP    = $(DIR_SRC)/$(THISAPP)
TARGET     = $(DIR_INFO)/$(THISAPP)
SUP_ARCH   = x86_64 i586
PROG       = dnsdist
PAK_VER    = 4

DEPS       = ""

MAX_PARALLELISM = $(shell echo $$(( $(SYSTEM_MEMORY) / 2048)))

###############################################################################
# Top-level Rules
###############################################################################

objects = $(DL_FILE)

$(DL_FILE) = $(DL_FROM)/$(DL_FILE)

$(DL_FILE)_MD5 = 0fecd7d600c1c094b9fffffd27c44369

install : $(TARGET)

check : $(patsubst %,$(DIR_CHK)/%,$(objects))

download :$(patsubst %,$(DIR_DL)/%,$(objects))

md5 : $(subst %,%_MD5,$(objects))

dist: 
	@$(PAK)

###############################################################################
# Downloading, checking, md5sum
###############################################################################

$(patsubst %,$(DIR_CHK)/%,$(objects)) :
	@$(CHECK)

$(patsubst %,$(DIR_DL)/%,$(objects)) :
	@$(LOAD)

$(subst %,%_MD5,$(objects)) :
	@$(MD5)

###############################################################################
# Installation Details
###############################################################################

$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
	@$(PREBUILD)
	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
	cd $(DIR_APP) && ./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--enable-openssl \
		--disable-gnutls \
		--enable-dns-over-tls \
		--with-lua \
		--without-net-snmp

	cd $(DIR_APP) && make $(MAKETUNING)
	cd $(DIR_APP) && make install

	#install initscripts
	$(call INSTALL_INITSCRIPT,dnsdist)

	install -v -m 644 $(DIR_SRC)/config/backup/includes/dnsdist \
		 /var/ipfire/backup/addons/includes/dnsdist

	@rm -rf $(DIR_APP)
	@$(POSTBUILD)

And I see this line: cd $(DIR_APP) && make $(MAKETUNING).

Can you explain LFS? And why commenting this line out would help? Wouldn’t this have shown up in the recent build for the Core Update 142 release on March 18?

No worries, this can happen.

Every package have it´s own LFS file, so does dnsdist too

This LFS (= Linux From Scratch) file includes primarily the building instructions and you will need your own if you want to build an addon. Check out the wiki page, it explains the different points well i think. The ‘# Installation Details’ are important and can (but not necessarily) differ pretty much, also the ‘# Definitions’ differs all the time since it defines the package name and version. The ‘# Top-level Rules’ are mostly the same except the MD5 sum which always differs and needs to be checked out via

md5sum {packagename}

. If you compare some simple packages e.g. fping --> https://git.ipfire.org/?p=ipfire-2.x.git;a=blob;f=lfs/fping;h=f82c28b67e64fc46134b4f459666bad4628ea8c5;hb=HEAD and e.g. mtr --> https://git.ipfire.org/?p=ipfire-2.x.git;a=blob;f=lfs/mtr;h=da856f4178b3830d1cbbcab53c7a796199b96477;hb=HEAD you can see the differences of the files which can give you an idea what kind of work it is to build a simple addon by your own.

This is not Core 142, and what you cloned is also not released ;-), this was the current next state of IPFire, so as i said, this could happen that the build don´t get through cause not all needed patches are included. I commented this line cause there was the error and i needed a complete build, MAKETUNING defines the ‘-j’ option in make --> https://linux.die.net/man/1/make which specifies the number of jobs to run simultaneously and the system does have there a problem with.

Some more news for the first.

Best,

Erik

1 Like

Thank you for all of your help! I truly appreciate it!

I started with git clone git://git.ipfire.org/ipfire-2.x.git and I thought it was core 142 (stable).

How do I take ½ step back and download 142?

I tried to build Core 142 but I am not running the right commands.

I tried:

git clone git://git.ipfire.org/ipfire-2.x.git

then:

git checkout 70af65df4198c58f99a333748faa39b39ad1c3c4

and that didn’t work. I also tried:

git reset --hard 70af65df4198c58f99a333748faa39b39ad1c3c4

And that didn’t work.

It takes real time of 13 hours (~20 hours user time). Long way to go for an error:

How do I build Core 142 (stable? released?) and not a Next state?

Hi Jon,
did reported that on the dev mailinglist --> https://lists.ipfire.org/pipermail/development/2020-April/007326.html and Michael have had the reminder for this problem which appeared longer time ago. In that case it was a problem with the RAM, have here on my old system only 2GB (check the ‘MAX_PARALLELISM’ VAR). Since the conversation in the mailinglist is not complete, am not sure about this but i think it have something to do with the updates of the building system (the toolchain). If so, you would also have this problem even you try it with an older Core.
How is it with your system resources ?

Best,

Erik

Same as yours. Only 2GB of RAM on my build machine.

Since I cannot move back to an older Core version, is my fix to upgrade RAM?

Yes, this might be one way or comment the $(MAKETUNING) for the first build.

Doh! Forgot the obvious! :crazy_face:
Thank you!