Solved Port testing - make stage issues

Hello,
I am trying to port a small application dos2unix http://waterlan.home.xs4all.nl/dos2unix.html , I have prepared a Makefile which is attached.

Facing errors when testing the port with steps mentioned in https://www.freebsd.org/doc/en/books/porters-handbook/porting-testing.html

The problem is with this section of the makefile:
Code:
do-install:
  ${INSTALL_PROGRAM} ${WRKDIR}/dos2unix ${STAGEDIR}${PREFIX}/bin/dos2unix
  ${INSTALL_PROGRAM} ${WRKDIR}/unix2dos ${STAGEDIR}${PREFIX}/bin/unix2dos
  ${LN} -f ${STAGEDIR}${PREFIX}/bin/dos2unix ${STAGEDIR}${PREFIX}/bin/mac2unix
  ${LN} -f ${STAGEDIR}${PREFIX}/bin/unix2dos ${STAGEDIR}${PREFIX}/bin/unix2mac
  ${INSTALL_MAN} ${WRKDIR}/man1/dos2unix.1 ${STAGEDIR}$(MANPREFIX}/man/man1

I get following error when I run make stage:

Code:
cc dos2unix.o querycp.o common.o  -L/usr/local/lib  -lintl -o dos2unix
cc unix2dos.o querycp.o common.o  -L/usr/local/lib  -lintl -o unix2dos
ln -sf dos2unix mac2unix
ln -sf unix2dos unix2mac
gmake[2]: Leaving directory '/usr/ports/converters/dos2unix/work/dos2unix-7.2.2'
===>  Staging for dos2unix-7.2.2
===>  Generating temporary packing list
install  -s -o root -g wheel -m 555 /usr/ports/converters/dos2unix/work/dos2unix /usr/ports/converters/dos2unix/work/stage/usr/local/bin/dos2unix
*** Error code 71

Stop.
make[1]: stopped in /usr/ports/converters/dos2unix
*** Error code 1

Stop.
make: stopped in /usr/ports/converters/dos2unix

If I comment the do-install block, I get warnings, but it builds fine:

Code:
gmake[3]: Leaving directory '/usr/ports/converters/dos2unix/work/dos2unix-7.2.2'
gmake[2]: Leaving directory '/usr/ports/converters/dos2unix/work/dos2unix-7.2.2'
====> Compressing man pages (compress-man)
====> Running Q/A tests (stage-qa)
Warning: '/usr/ports/converters/dos2unix/work/stage/usr/bin/unix2dos' is not stripped consider trying INSTALL_TARGET=install-strip or using ${STRIP_CMD}
Warning: '/usr/ports/converters/dos2unix/work/stage/usr/bin/dos2unix' is not stripped consider trying INSTALL_TARGET=install-strip or using ${STRIP_CMD}

Confused what could be wrong here.
 

Attachments

  • Makefile.txt
    1.4 KB · Views: 292
  • dos2unix_error.txt
    3 KB · Views: 246
dos2unix and unix2dos are already in ports as part of the converters/unix2dos.

EDIT: Disregard. I see you are using an updated variant of the program from a different source.

Change the WRKDIR to WRKSRC and you will be pointing to the right place.
 
Thanks, it worked. I have done port check using portlint, port test

I am facing another issue, I have included following line in Makefile

Code:
BUILD_DEPENDS=  binutils:${PORTSDIR}/devel/binutils coreutils:${PORTSDIR}/sysutils/coreutils

However, when I run make stage in the new port directory it fails at this:

Code:
gmake[7]: Entering directory '/usr/ports/devel/binutils/work/binutils-2.25.1/libiberty/testsuite'
gmake[7]: Nothing to be done for 'install'.
gmake[7]: Leaving directory '/usr/ports/devel/binutils/work/binutils-2.25.1/libiberty/testsuite'
gmake[6]: Leaving directory '/usr/ports/devel/binutils/work/binutils-2.25.1/libiberty'
gmake[5]: Nothing to be done for 'install-target'.
gmake[5]: Leaving directory '/usr/ports/devel/binutils/work/binutils-2.25.1'
gmake[4]: Leaving directory '/usr/ports/devel/binutils/work/binutils-2.25.1'
install  -m 0644 /usr/ports/devel/binutils/work/binutils-2.25.1/include/plugin-api.h /usr/ports/devel/binutils/work/stage/usr/local/include/
/bin/rm -f /usr/ports/devel/binutils/work/stage/usr/local/include/ansidecl.h
/usr/bin/sed -i.bak '/#include "ansidecl.h"/d' /usr/ports/devel/binutils/work/stage/usr/local/include/bfd.h
====> Compressing man pages (compress-man)
===>  Installing for binutils-2.25.1
===>  Checking if binutils already installed
===>  binutils-2.25.1 is already installed
  You may wish to ``make deinstall'' and install this port again
  by ``make reinstall'' to upgrade it properly.
  If you really wish to overwrite the old port of binutils
  without deleting it first, set the variable "FORCE_PKG_REGISTER"
  in your environment or the "make install" command line.
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/devel/binutils
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/devel/binutils
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/converters/dos2unix
*** Error code 1

Stop.
make: stopped in /usr/ports/converters/dos2unix

If I comment the line and install devel/binutils, sysutils/coreutils using pkg, make stage completes without errors.
 
Ok, from the previous error,

Code:
===> binutils-2.25.1 is already installed
You may wish to ``make deinstall'' and install this port again
by ``make reinstall'' to upgrade it properly.
If you really wish to overwrite the old port of binutils
without deleting it first, set the variable "FORCE_PKG_REGISTER"
in your environment or the "make install" command line.
*** Error code 1

To remove this I removed the packages which caused this error,

Code:
pkg remove binutils coreutils
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 2 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
   binutils-2.25.1
   coreutils-8.23

The operation will free 54 MiB.

Proceed with deinstalling packages? [y/N]: y
[1/2] Deinstalling binutils-2.25.1...
[1/2] Deleting files for binutils-2.25.1: 100%
[2/2] Deinstalling coreutils-8.23...
[2/2] Deleting files for coreutils-8.23: 100%

After which I tried make stage again from dos2unix directory.

Code:
> make stage
===>  License BSD accepted by the user
===>  Found saved configuration for dos2unix-7.2.2
===>  dos2unix-7.2.3 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by dos2unix-7.2.3 for building
===>  Extracting for dos2unix-7.2.3
=> SHA256 Checksum OK for dos2unix-7.2.3.tar.gz.
===>  Patching for dos2unix-7.2.3
===>  dos2unix-7.2.3 depends on executable: binutils - not found
===>  License GPLv3 LGPL3 accepted by the user
===>  Found saved configuration for binutils-2.25.1
===>  binutils-2.25.1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by binutils-2.25.1 for building
===>  Extracting for binutils-2.25.1
=> SHA256 Checksum OK for binutils-2.25.1.tar.bz2.

.
.
.

gmake[7]: Entering directory '/usr/ports/devel/binutils/work/binutils-2.25.1/libiberty/testsuite'
gmake[7]: Nothing to be done for 'install'.
gmake[7]: Leaving directory '/usr/ports/devel/binutils/work/binutils-2.25.1/libiberty/testsuite'
gmake[6]: Leaving directory '/usr/ports/devel/binutils/work/binutils-2.25.1/libiberty'
gmake[5]: Nothing to be done for 'install-target'.
gmake[5]: Leaving directory '/usr/ports/devel/binutils/work/binutils-2.25.1'
gmake[4]: Leaving directory '/usr/ports/devel/binutils/work/binutils-2.25.1'
install  -m 0644 /usr/ports/devel/binutils/work/binutils-2.25.1/include/plugin-api.h /usr/ports/devel/binutils/work/stage/usr/local/include/
/bin/rm -f /usr/ports/devel/binutils/work/stage/usr/local/include/ansidecl.h
/usr/bin/sed -i.bak '/#include "ansidecl.h"/d' /usr/ports/devel/binutils/work/stage/usr/local/include/bfd.h
====> Compressing man pages (compress-man)
===>  Installing for binutils-2.25.1
===>  Checking if binutils already installed
===>  Registering installation for binutils-2.25.1 as automatic
Installing binutils-2.25.1...
===>  dos2unix-7.2.3 depends on executable: binutils - not found
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/converters/dos2unix
*** Error code 1

Stop.
make: stopped in /usr/ports/converters/dos2unix

It installs when I run make install from within devel/binutils

Any ideas?
 
You are incorrectly handling devel/binutils dependency. Note that this dependency is handled automatically by binutils suite version from base.

Also you need to format the Makefile options properly:
https://www.freebsd.org/doc/en/books/porters-handbook/makefile-options.html

More readings required to fix your port:
https://www.freebsd.org/doc/en/books/porters-handbook/makefile-depend.html
https://www.freebsd.org/doc/en/books/porters-handbook/building.html

Always use ports-mgmt/portlint to check if your port is sanitized.
Code:
# cd /usr/ports/converters/dos2unix
# portlint -AC
FATAL: no /usr/ports/converters/dos2unix/pkg-descr in ".".
FATAL: Makefile: [7]: use a tab (not space) after a variable name
WARN: Makefile: [14]: whitespace before end of line.
WARN: Makefile: [15]: whitespace before end of line.
WARN: Makefile: [31]: whitespace before end of line.
FATAL: Makefile: [31]: use a tab (not space) after a variable name
FATAL: Makefile: [33]: use a tab (not space) after a variable name
FATAL: Makefile: [34]: use a tab (not space) after a variable name
FATAL: Makefile: [1]: incorrect header; use Created by: with a single space, then $FreeBSD$.
FATAL: Makefile: non-comment line in comment section.
WARN: Conflict "unix2dos" specified too narrow. You should end it with a wildcard (-[0-9]*).
WARN: Makefile: Consider defining LICENSE.
FATAL: no /usr/ports/converters/dos2unix/distinfo in ".".
FATAL: breaks INDEX (cannot open /usr/ports/converters/dos2unix/pkg-descr: No such file or directory).
WARN: Consider to set DEVELOPER=yes in /etc/make.conf
9 fatal errors and 6 warnings found.
There shouldn't be any error :)
 
Thanks,
I have already ran portlint -A, port test /usr/ports/convertors/dos2unix and corrected most of the warnings or errors.
For instance added a license, from my previous post:
Code:
> make stage
===> License BSD accepted by the user

Have not uploaded the new Makefile. And yes I suspected whether the port can use the binutils from base OS, but I was trying to adhere to the requirements given in the install guide of the application.

I have read the slow porting guide and following whatever comes next, so may have missed lot of things.
Please bear with me as this is my first port. :)
 
I have removed the dependencies, as it can use the utils provided by base.
Changed the format of the options.

Code:
OPTIONS_DEFINE= NLS GHOSTSCRIPT
OPTIONS_SUB=  yes
NLS_DESC=  Framework to help GNU packages produce multi-lingual messages.
GHOSTSCRIPT_DESC=  An interpreter for the PostScript language and for PDF (ps2pdf)

NLS_USES=  gettext
NLS_CONFIGURE_ENABLE=  nls

GHOSTSCRIPT_USES=  ghostscript
GHOSTSCRIPT_CONFIGURE_ENABLE=  ghostscript

.include <bsd.port.options.mk>

Let me know if I missed something.

I am now stuck at compressing man pages and at make check-orphans.

I read this https://www.freebsd.org/doc/en/books/porters-handbook/makefile-manpages.html which was not clear to me, so I tried understanding what other ports have implemented, which looked simple.

For example from www/chromium:


Code:
less /usr/ports/www/chromium/pkg-plist

bin/chrome
man/man1/chrome.1.gz

and in,

Code:
less /usr/ports/www/chromium/Makefile

${INSTALL_MAN} ${WRKSRC}/out/${BUILDTYPE}/chrome.1 ${STAGEDIR}${MANPREFIX}/man/man1

In my port,
pkg-plist
Code:
bin/dos2unix
bin/mac2unix
bin/unix2dos
bin/unix2mac
man/man1/dos2unix.1.gz

Makefile

Code:
${INSTALL_MAN} ${WRKSRC}/man/man1/dos2unix.1 ${STAGEDIR}$(PREFIX}/man/man1

I tried a variant of this,
Code:
${INSTALL_MAN} ${WRKSRC}/man/man1/dos2unix.1 ${STAGEDIR}$(MANPREFIX}/man/man1

With both, I get file dos2unix.1 placed in the same wrong location, causing the check-orphans test to fail.

Code:
root@freebsd:/usr/ports/converters/dos2unix # find work/stage/ -type f
work/stage/dos2unix.1
work/stage/usr/local/bin/unix2mac
work/stage/usr/local/bin/mac2unix
work/stage/usr/local/bin/unix2dos
work/stage/usr/local/bin/dos2unix
work/stage/usr/local/share/licenses/dos2unix-7.2.3/BSD2CLAUSE
work/stage/usr/local/share/licenses/dos2unix-7.2.3/catalog.mk
work/stage/usr/local/share/licenses/dos2unix-7.2.3/LICENSE

I have attached all the files which were created for this port.
 

Attachments

  • dos2unix.zip
    2.3 KB · Views: 154
Thanks cpm,
I understood many of the things you added/modified with the help of documentation, I need to read and practice more, I have some questions,

Code:
INSTALL_TARGET= install-strip
Why is this necessary when INSTALL_PROGRAM strips the binary by default?

When we have the following for a port named dos2unix,
Code:
USES=  dos2unix gettext-tools ghostscript gmake perl5
Won't this create cyclic dependency?


The ports self tests, shouldn't they be run before staging the port as part of pre-install?
Code:
regression-test: extract
  cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} check
 
Code:
INSTALL_TARGET= install-strip
Why is this necessary when INSTALL_PROGRAM strips the binary by default?
If portlint(1) doesn't complain from the staging Q/A checks then you can remove it safely from the Makefile.

When we have the following for a port named dos2unix,
Code:
USES=  dos2unix gettext-tools ghostscript gmake perl5
Won't this create cyclic dependency?
No, read the simple automatic replacements to understand how Mk/Uses/dos2unix works

The ports self tests, shouldn't they be run before staging the port as part of pre-install?
Code:
regression-test: extract
  cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} check
Sure, the regression-test only is performed if you run it manually as following make regression-test

You can add the regression-test in post-build stage.
 
Thanks cpm. With a bunch of other things going on for me at the moment I appreciate you taking the time to make sure things were in good hands here.
 
Back
Top