# binutils cannot find install-sh, install.sh or shtool



## dougs (Feb 7, 2021)

Noticed opencv-core was orphaned and replaced with opencv. Rebuilt all ports just in case. It crashes with the following:


```
...
===>>> graphics/opencv 1/3 >> eigen-3.3.8 >> openblas-0.3.12,1 >> gcc10-10.2.0 (242/288)

===>>> Currently installed version: gcc10-10.2.0
===>>> Port directory: /usr/ports/lang/gcc10

===>>> Starting check for build dependencies
===>>> Gathering dependency list for lang/gcc10 from ports
===>>> Forcing update for /usr/ports/devel/binutils
===>>> Launching child to reinstall binutils-2.33.1_4,1

===>>> graphics/opencv 1/3 >> eigen-3.3.8 >> openblas-0.3.12,1 >> gcc10-10.2.0 >> binutils-2.33.1_4,1 (243/288)

===>>> Currently installed version: binutils-2.33.1_4,1
===>>> Port directory: /usr/ports/devel/binutils@native

===>>> Starting check for build dependencies
===>>> Gathering dependency list for devel/binutils@native from ports
===>>> Dependency check complete for devel/binutils@native

===>>> graphics/opencv 1/3 >> eigen-3.3.8 >> openblas-0.3.12,1 >> gcc10-10.2.0 >> binutils-2.33.1_4,1 (243/288)

===>  Cleaning for binutils-2.33.1_4,1
===>   binutils-2.33.1_4,1 depends on file: /usr/local/lib/libgmp.so - found
===>   binutils-2.33.1_4,1 depends on file: /usr/local/lib/libmpfr.so - found
===>   binutils-2.33.1_4,1 depends on package: gmake>=4.3 - found
===>   binutils-2.33.1_4,1 depends on executable: msgfmt - found
===>   binutils-2.33.1_4,1 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)
===>  Configuring for binutils-2.33.1_4,1
sed: /usr/ports/devel/binutils/work-native/binutils-2.33.1/libctf/configure: No such file or directory
sed: /usr/ports/devel/binutils/work-native/binutils-2.33.1/etc/configure: No such file or directory
rm: /usr/ports/devel/binutils/work-native/binutils-2.33.1/zlib: Directory not empty
configure: loading site script /usr/ports/Templates/config.site
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
===>  Script "configure" failed unexpectedly.
Please report the problem to jflopezfernandez@gmail.com [maintainer] and
attach the "/usr/ports/devel/binutils/work-native/binutils-2.33.1/config.log"
including the output of the failure of your make command. Also, it might be
a good idea to provide an overview of all packages installed on your system
(e.g. a /usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1

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

Stop.
make: stopped in /usr/ports/devel/binutils

===>>> make build failed for devel/binutils@native
===>>> Aborting update

===>>> Update for binutils-2.33.1_4,1 failed
===>>> Aborting update

===>>> Update for gcc10-10.2.0 failed
===>>> Aborting update

===>>> Update for openblas-0.3.12,1 failed
===>>> Aborting update

===>>> Update for eigen-3.3.8 failed
===>>> Aborting update

===>>> Update for graphics/opencv failed
===>>> Aborting update

===>>> There are messages from installed ports to display,
       but first take a moment to review the error messages
       above.  Then press Enter when ready to proceed. rm: /usr/ports/devel/binutils/work-native/binutils-2.33.1: Directory not empty
rm: /usr/ports/devel/binutils/work-native: Directory not empty
```

I've rerun this once more to same effect. In addition, on another server containing the orphaned opencv-core port, I was able to rebuild all ports successfully. Not sure why this one failed.

I've reinstalled devel/binutils successfully but when rebuilding the entire ports, it fails.

Does anyone have any insights on this?

Running FreeBSD 12.2-p3 on amd64 machine.

~Doug


----------



## ShelLuser (Feb 7, 2021)

Well, these lines looks suspicious enough:


```
sed: /usr/ports/devel/binutils/work-native/binutils-2.33.1/libctf/configure: No such file or directory
sed: /usr/ports/devel/binutils/work-native/binutils-2.33.1/etc/configure: No such file or directory
rm: /usr/ports/devel/binutils/work-native/binutils-2.33.1/zlib: Directory not empty
```
So I ran `make extract` and looked into work-native and the configure script was there, ergo it doesn't seem to be an issue with the port itself. Then, after cleaning up, I ran `make build |& tee ~/binutils.log` and well...  I'm missing some stuff up there:


```
===>   binutils-2.33.1_4,1 depends on package: gmake>=4.3 - found
===>   binutils-2.33.1_4,1 depends on executable: msgfmt - found
===>   binutils-2.33.1_4,1 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)
===>  Configuring for binutils-2.33.1_4,1
configure: loading site script /usr/ports/Templates/config.site
checking build system type... x86_64-portbld-freebsd12.2
checking host system type... x86_64-portbld-freebsd12.2
checking target system type... x86_64-portbld-freebsd12.2
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... (cached) /usr/bin/sed
```
Making me wonder... what does `which sed` tell you? Is it possible that you switched the defaults somehow so that the build script can't use the right tools?  Another possible cause: ever mixed ports and packages?


----------



## dougs (Feb 7, 2021)

```
# which sed
/usr/bin/sed
#
```
I use ports exclusively. Is there a method to prove this?


----------



## ShelLuser (Feb 7, 2021)

Can't really 'prove' what you're using, in the end everything ends up as packages anyway. It's also a moot issue, the only reason I mentioned it is because it could theoretically be a possible cause for these issues. Anyway, here's what I'd try...

First make sure your port collection is fully up to date: `# portsnap fetch extract`.

Then also make sure that you clean your build directory (`# make clean` _before_ you try to build the port again. I think to recognize the output from portmaster in your output above (I could be mistaken of course), but if I'm right then you don't need to worry about this step because portmaster normally cleans the build directory itself before building.

If none of this works I'd try to ensure that your build dependencies are alright. If you are using Portmaster you could run (from /usr/ports/devel/binutils): `# portmaster --force-config `make build-depends-list | cut -d '/' -f4-``, optionally skipping the --force-config but it might help to spot something out of place.

Of course if you're not using Portmaster you could try something as `# make depends`, though I've rarely used that myself before.

If you still keep running into issues try: `make extract` and actually look around the work-native folder yourself to see if those configure scripts are really missing.


----------



## dougs (Feb 7, 2021)

Yes, I use portmaster.

I ran `# portsnap fetch extract` to ensure a clean ports collection. Next, I checked to see if the build dependencies are good: `# portmaster --force-config `make build-depends-list | cut -d '/' -f4-``. It ran through to the end cleanly without errors.

Next, I checked to see if there was any one of the three missing files in the work-native folder. Ran `# Make extract`. Partial output as follows:

```
...
drwxr-xr-x   3 root  wheel       86 Feb  7 11:52 gprof
drwxr-xr-x  11 root  wheel       74 Feb  7 11:52 include
-rwxr-xr-x   1 root  wheel    14675 Sep  9  2019 install-sh
drwxr-xr-x   2 root  wheel       44 Feb  7 11:52 intl
drwxr-xr-x   7 root  wheel      100 Feb  7 11:52 ld
...
```
Seems install.sh is present.

Next, I ran `# portmaster -d graphics/opencv math/eigen3 math/openblas lang/gcc10 math/mpc math/suitesparse math/metis math/superlu math/blas math/lapack math/py-numpy@py37 multimedia/ffmpeg audio/libvorbis audio/libogg audio/opus graphics/frei0r multimedia/dav1d multimedia/libtheora multimedia/libv4l devel/argp-standalone devel/libudev-devd devel/evdev-proto multimedia/v4l_compat multimedia/libva multimedia/libvdpau multimedia/libvpx multimedia/libx264 multimedia/x265 multimedia/xvid textproc/texi2html science/hdf5 science/szip textproc/highlight net/samba412 databases/tdb devel/gamin devel/jansson devel/libinotify devel/p5-Parse-Yapp devel/popt devel/talloc devel/tevent net/mDNSResponder net/openldap24-client sysutils/cmocka sysutils/libsunacl` that was left unfinished from the previous portmaster run. An hour later, I'm now on to math/suitesparse so it does look like the graphics/opencv has successfully compiled and is in place.

I'm not sure why it appears to work this time. Perhaps the graphics/binutils port was corrupted to begin with and was fixed with a portsnap update/extraction?

Thanks for your help.


----------



## ShelLuser (Feb 8, 2021)

dougs said:


> I'm not sure why it appears to work this time. Perhaps the graphics/binutils port was corrupted to begin with and was fixed with a portsnap update/extraction?


That is possible. I've also ran into weird build errors in the past (generally speaking, not necessarily with binutils) and usually a forced re-build of the build dependencies (as you've done above as well) fixed it. It is somewhat bizarre IMO because I too couldn't find anything obvious out of place.

My (far fetched) theory is that another port might have disrupted something, but... that's a wild guess.



dougs said:


> Thanks for your help.


You're welcome, also thanks for the feedback. It's always nice to know when something worked out.


----------

