# Unable to build ports index for months



## Morgan Wesström (Jul 21, 2015)

Running `make index` on my ports collection hasn't worked for months and I need help tracking down what's wrong with my system. I know I can run `make fetchindex` to download a working index for my ports collection but still I'd like to figure out why `make index` doesn't work.

Trying to solve the problem I first upgraded my system to latest 10-STABLE.


```
# freebsd-version
10.2-BETA2
# uname -a
FreeBSD host.mydomain 10.2-BETA2 FreeBSD 10.2-BETA2 #0 r285708: Mon Jul 20 20:39:30 CEST 2015  root@mydomain:/usr/obj/usr/src/sys/MYKERNEL  amd64
```

Then I wiped my /usr/ports and downloaded a fresh copy.


```
mv /usr/ports /usr/ports_backup
mkdir /usr/ports
svn checkout https://svn.FreeBSD.org/ports/head /usr/ports
<long snip>
Checked out revision 392642.
```

But I still can't build the ports index. This is the error I get every time.


```
# cd /usr/ports
# make index
Generating INDEX-10 - please wait..--- describe.accessibility ---
--- describe.arabic ---
--- describe.archivers ---
--- describe.astro ---
--- describe.audio ---
--- describe.benchmarks ---
--- describe.biology ---
--- describe.cad ---
--- describe.chinese ---
--- describe.comms ---
--- describe.converters ---
--- describe.databases ---
--- describe.deskutils ---
--- describe.devel ---
--- describe.dns ---
--- describe.editors ---
--- describe.emulators ---
--- describe.finance ---
--- describe.french ---
--- describe.ftp ---
--- describe.games ---
--- describe.german ---
--- describe.graphics ---
--- describe.hebrew ---
--- describe.hungarian ---
--- describe.irc ---
--- describe.japanese ---
--- describe.java ---
--- describe.korean ---
--- describe.lang ---
--- describe.graphics ---
make[5]: "/usr/ports/Mk/Uses/qmake.mk" line 52: Malformed conditional (${_QT_VERSION:M5*})
make[5]: Fatal errors encountered -- cannot continue===> graphics/qtawesome failed
*** [describe.graphics] Error code 1

make[2]: stopped in /usr/ports
1 error

make[2]: stopped in /usr/ports

********************************************************************
Before reporting this error, verify that you are running a supported
version of FreeBSD (see http://www.FreeBSD.org/ports/) and that you
have a complete and up-to-date ports collection.  (INDEX builds are
not supported with partial or out-of-date ports collections.
If that is the case, then
report the failure to ports@FreeBSD.org together with relevant
details of your ports configuration (including FreeBSD version,
your architecture, your environment, and your /etc/make.conf
settings, especially compiler flags and OPTIONS_SET/UNSET settings).

Note: the latest pre-generated version of INDEX may be fetched
automatically with "make fetchindex".
********************************************************************

*** Error code 1

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

Stop.
make: stopped in /usr/ports
```

I have googled for problems with graphics/qtawesome since this started but I have only found a couple of old posts with vaguely similar problems which seems to have gone away after a fresh system update but that didn't help in my case. I must've broken something else and any help is appreciated.

Regards
Morgan


----------



## talsamon (Jul 21, 2015)

Please post the line 52 from /usr/ports/Mk/Uses/qmake.mk and some lines before and ~ 10 or 12 lines after.


----------



## Morgan Wesström (Jul 21, 2015)

Lines 48-63. Complete file at https://bpaste.net/show/70b79f5355dc
It failed with the exact same message also before downloading a fresh ports copy so I would like to think there wasn't a problem with my previous local copy.

```
.if ! ${qmake_ARGS:M_env}
USE_QT${_QT_VERSION:R:R}+=  qmake_build
.endif

.if ${_QT_VERSION:M5*}
# We deliberately do not pass -I${LOCALBASE}/include and -L${LOCALBASE}/lib
# in the FreeBSD mkspecs because in Qt5 they are always added before the
# paths in ${WRKSRC}. In other words, if one is upgrading an existing
# installation the old headers and libraries will always be picked up.
# Those directories to be passed though, they just need to be passed last.
# See QTBUG-40825 and ports/194088 for more information.
CONFIGURE_ENV+= CPATH=${LOCALBASE}/include \
  LIBRARY_PATH=${LOCALBASE}/lib
MAKE_ENV+=  CPATH=${LOCALBASE}/include \
  LIBRARY_PATH=${LOCALBASE}/lib
.endif  # ${_QT_VERSION:M5*}
```


----------



## talsamon (Jul 21, 2015)

I have FreeBSD-10.1 it looks exact the same  (except the tabs are missing, but I think this caused by paste).
You can look (e.g. with `cat`) if in the file are unprintable special characters in this part of the file, or it is a parse-error. But if it is the last one, I don't know what causes this.
The only idea I have is remove the commented lines. (But I don't really believe this helps).


----------



## talsamon (Jul 21, 2015)

Another question: what do you have in /etc/make.conf? (some lines causes curious errors).


----------



## Morgan Wesström (Jul 21, 2015)

`# cat /etc/make.conf`

```
CPUTYPE?=atom
WITHOUT_X11=yes
WITHOUT_JAVA=yes
WITHOUT_QT=yes
WITHOUT_QT4=yes
WITHOUT_CUPS=yes
OPTIONS_UNSET=X11 JAVA QT QT4 CUPS
WITH_PKGNG=yes
```


----------



## Morgan Wesström (Jul 22, 2015)

talsamon said:


> I have FreeBSD-10.1 it looks exact the same  (accept the tabs are missing, but I think this caused by paste).
> You can look (e.g. with `cat`) if in the file are unprintable special characters in this part of the file, or it is a parse-error. But if it is the last one, I don't know what causes this.
> The only idea I have is remove the commented lines. (But I don't really believe this helps).


/usr/ports are freshly downloaded with subversion. I make no changes to those files. I interpret the error as if the script hits a snag when it tries to parse the files in graphics/qtawesome since it always aborts there. Is there anyway I can debug the process? Apparently it works on other systems since I can download a premade index. I've run into Atom-specific parsing errors on my Linux machines before and I suspect that this might be something similar. If this turns out to be correct it may potentially cause problems in other parts of my system so that's why I'd like to track it down.


----------



## talsamon (Jul 22, 2015)

Try remove or comment out all appearances of QT in /etc/make.conf , maybe this causes something. Comment out CPUTYPE.

(By the way WITH_PKGNG is default, no need to write it in).


----------



## Morgan Wesström (Jul 22, 2015)

Thank you for pointing me in a direction my mind had completely ruled out. A make.conf containing only the CPUTYPE line builds the index without any errors. It's rather late here now and rebuilding the index takes a while on a slow Atom. I'll continue tomorrow adding line by line trying to figure out which one causes the problem. It did start around the same time as the ports framework first began to bug me about the obsolete KNOB syntax in my make.conf. As you can see I still use both syntaxes because there are some ports that still need the old syntax. I'll file a bug tomorrow when I have more details.


----------



## protocelt (Jul 22, 2015)

Hi,

You'll want to remove the WITHOUT options in your make.conf file. You can still use the WITH and WITHOUT options with make(1) directly on the command line. For more information on the newer OPTIONS framework you can take a look at /usr/ports/Mk/bsd.options.mk. For example, you would now have the following in your make.conf file instead of the output shown above.

```
CPUTYPE?=atom
OPTIONS_UNSET=X11 JAVA QT QT4 CUPS
```
If you still get an error when running `make index` after doing this then it's a bug and a bug report should really be filed against it.

Edit: Oops! For whatever reason I didn't see the last post before this one.


----------



## Morgan Wesström (Jul 22, 2015)

Tests are finally done. A make.conf containing only OPTIONS_UNSET=QT4 breaks `make index` in the way described earlier.
QT4 was a valid knob in the old system but I have to track down somehow if it's also valid in the new system. I have generally had a difficult time finding coherent information about the knobs and their validity.


----------



## talsamon (Jul 22, 2015)

Seems not easy with the "mixed" syntax, between old and new. Found in the net some problems, especially with X11 and QT in combination.


----------



## protocelt (Jul 22, 2015)

If I understand correctly, ideally, all the port's Makefiles should have been refactored to include OPTIONS_DEFINE=.[1] to enable the user to set both global options as well as option overrides for individual ports in /etc/make.conf. Being there is 25,000 ports in the ports tree and considering not all the ports have a maintainer, it wouldn't surprise me if there are a few port's Makefiles that have not been refactored  to fully use the OPTIONS framework yet still normally build correctly. Now that I think about it, this looks like a good area to start helping out.

[1] https://www.freebsd.org/doc/en/books/porters-handbook/makefile-options.html


----------

