f951: internal compiler error: Illegal instruction: 4 when installing packages

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

f951: internal compiler error: Illegal instruction: 4 when installing packages

Octave - General mailing list
Hi to the community,
I am having problems running the following command: >> pkg install -forge io
statistics control struct optim“ which should install the statistics package
as far as I know.

My device is a MacBook Pro running Catalina macOS 10.15.7 and I have GNU
Octave, version 6.2.0 installed via Homebrew.

My goal is to get Octave running to be able to use Dynare. First, I updated
Homebrew. Then, I installed Octave using Homebrew via the Terminal which did
not result in any errors. Then, I run Octave via the command „octave —gui“
and it opens just fine. In order to use Dynare I need to install the
statistics package executing the following command ">> pkg install -forge io
statistics control struct optim“.
When executing this or any other command to install packages the resulting
error is the following:

/>> pkg install -forge io statistics control struct optim

warning: LFLAGS is deprecated and will be removed in a future version of
Octave, use LDFLAGS instead
f951: internal compiler error: Illegal instruction: 4
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew-core/issues> for instructions.
make: *** [slicotlibrary.a] Error 1
tar -xzf slicot.tar.gz
/usr/local/Cellar/octave/6.2.0_2/bin/mkoctfile-6.2.0 -Wall
-Wno-deprecated-declarations  __control_helper_functions__.cc
mkdir sltmp
mv slicot/src/*.f ./sltmp
mv slicot/src_aux/*.f ./sltmp
cp TG04BX.fortran ./sltmp/TG04BX.f
cp TB01ZD.fortran ./sltmp/TB01ZD.f
cd sltmp; /usr/local/Cellar/octave/6.2.0_2/bin/mkoctfile-6.2.0 -c *.f

error: pkg: error running 'make' for the control package.
error: called from
    configure_make at line 110 column 9
    install at line 196 column 7
    pkg at line 568 column 9/

I googled many hours already and I am struggling to find any solution. As
far as I have found out the problem lies in the compiler error of f951 which
is related to gfortran or gcc to the best of my knowledge. Can anyone help
me out?

I am very willing to provide any further details if needed!

Hoping the best,
Manuel




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: f951: internal compiler error: Illegal instruction: 4 when installing packages

apjanke-floss


On 4/13/21 6:16 PM, mzerobin via Help-octave wrote:

> Hi to the community,
> I am having problems running the following command: >> pkg install -forge io
> statistics control struct optim“ which should install the statistics package
> as far as I know.
>
> My device is a MacBook Pro running Catalina macOS 10.15.7 and I have GNU
> Octave, version 6.2.0 installed via Homebrew.
>
> />> pkg install -forge io statistics control struct optim
>
> warning: LFLAGS is deprecated and will be removed in a future version of
> Octave, use LDFLAGS instead
> f951: internal compiler error: Illegal instruction: 4
> libbacktrace could not find executable to open
[...snip...]
>
> I googled many hours already and I am struggling to find any solution. As
> far as I have found out the problem lies in the compiler error of f951 which
> is related to gfortran or gcc to the best of my knowledge. Can anyone help
> me out?
>
> I am very willing to provide any further details if needed!

So, when this "Illegal instruction: 4" happens, it usually means that
you are running a binary that was built for a later generation of CPU
that includes an instruction set that your particular CPU model does not
support. This happens sometimes with Homebrew "bottles" or other binary
distributions when the build flags aren't set quite right – the folks
building these binary redistributables essentially need to
"cross-compile" them for older generations of CPU than they are actually
building on. Usually it works; sometimes a bad build sneaks through.

This looks like it is f95 itself that is throwing that Illegal
instruction error.

What is the exact model of MacBook Pro you're running? (So we can figure
out exactly what CPU model you have.)

Instead of the vanilla Homebrew Octave, would you be willing to try out
my Octave.app build? https://octave-app.org/  We build all our own
binaries, and have controlled for "Illegal instruction: 4" in the past.
If nothing else, it'd give you another data point.

If you have a couple hours to spare, you could also try rebuilding your
Homebrewed GCC from source, to ensure that it is compiled for your exact
CPU model. (GCC is what provides the F95 Fortran compiler in most
cases.) `brew reinstall --build-from-source gcc` should do it.

Cheers,
Andrew Janke


Reply | Threaded
Open this post in threaded view
|

Re: f951: internal compiler error: Illegal instruction: 4 when installing packages

Octave - General mailing list
Thank you very much for your input Andrew!

The CPU I am using is an Intel Core 2 Duo with 2.66 GHz in a MacBook Pro 5,3
running macOS 10.15.7.

I have just tried to build gcc from source. However, it results in an error
looking the following:

/==> make BOOT_LDFLAGS=-Wl,-headerpad_max_install_names
Last 15 lines from /Users/Manuel/Library/Logs/Homebrew/gcc/02.make:
/bin/sh ../../gcc/../move-if-change tmp-opinit.h insn-opinit.h
/bin/sh ../../gcc/../move-if-change tmp-opinit.c insn-opinit.c
echo timestamp > s-opinit
build/genattrtab ../../gcc/common.md ../../gcc/config/i386/i386.md
insn-conditions.md \
                -Atmp-attrtab.c -Dtmp-dfatab.c -Ltmp-latencytab.c
build/genautomata ../../gcc/common.md ../../gcc/config/i386/i386.md \
          insn-conditions.md > tmp-automata.c
make[3]: *** [s-attrtab] Illegal instruction: 4
make[3]: *** Waiting for unfinished jobs....
/bin/sh ../../gcc/../move-if-change tmp-automata.c insn-automata.c
echo timestamp > s-automata
rm gcc.pod
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

READ THIS: https://docs.brew.sh/Troubleshooting

These open issues may also help:
i686-elf-gcc, x86_64-elf-gcc: update/add license
https://github.com/Homebrew/homebrew-core/pull/74919
gcc 10.3.0 https://github.com/Homebrew/homebrew-core/pull/74843/

Again, the illegal instruction error is found.

I am not confident regarding the possibility of trying the Octave.app due to
the fact that my goal is to use Dynare in combination with Octave. On the
website  https://www.dynare.org/download/ <https://www.dynare.org/download/>  
it states explicitly that I have to use Homebrew. Do you have some more
information whether it is possible to use Dynare with Octave when using the
Octave.app build? If so, I am willing to try.



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: f951: internal compiler error: Illegal instruction: 4 when installing packages

apjanke-floss


On 4/14/21 4:38 AM, mzerobin via Help-octave wrote:
> Thank you very much for your input Andrew!
>
> The CPU I am using is an Intel Core 2 Duo with 2.66 GHz in a MacBook Pro 5,3
> running macOS 10.15.7.

Yep, that's probably what's happening: your MBP is an old 2009 model
running a Penryn CPU. Lacks SSE4.1 and some AVX instructions. When we've
seen this before, it was an AVX instruction in a binary.

> I have just tried to build gcc from source. However, it results in an error
> looking the following:
>
> /==> make BOOT_LDFLAGS=-Wl,-headerpad_max_install_names
> Last 15 lines from /Users/Manuel/Library/Logs/Homebrew/gcc/02.make:
> /bin/sh ../../gcc/../move-if-change tmp-opinit.h insn-opinit.h
> /bin/sh ../../gcc/../move-if-change tmp-opinit.c insn-opinit.c
> echo timestamp > s-opinit
> build/genattrtab ../../gcc/common.md ../../gcc/config/i386/i386.md
> insn-conditions.md \
> -Atmp-attrtab.c -Dtmp-dfatab.c -Ltmp-latencytab.c
> build/genautomata ../../gcc/common.md ../../gcc/config/i386/i386.md \
>  insn-conditions.md > tmp-automata.c
> make[3]: *** [s-attrtab] Illegal instruction: 4
> make[3]: *** Waiting for unfinished jobs....
> /bin/sh ../../gcc/../move-if-change tmp-automata.c insn-automata.c

Hmmm. Maybe one of GCC's dependencies also has an unsupported
instruction in its binary?

Can you try `brew reinstall --build-from-source gmp isl libmpc mpfr` and
then try rebuilding gcc from source again?

> I am not confident regarding the possibility of trying the Octave.app due to
> the fact that my goal is to use Dynare in combination with Octave. On the
> website  https://www.dynare.org/download/ <https://www.dynare.org/download/>  
> it states explicitly that I have to use Homebrew. Do you have some more
> information whether it is possible to use Dynare with Octave when using the
> Octave.app build? If so, I am willing to try.

Ahhh, I see. Yes, it seems you need a dynare that's built specifically
against your Octave installation. The Homebrewed dynare will not work
with Octave.app then.

Hmm. Let me think a bit about how Octave.app could support dynare.

The way we support other binary packages that are needed for things like
Octave Forge packages is to just include them all in the Octave.app
build itself, so they're ready and waiting for you. Maybe we'll do that
with dynare too. Looks license-compatible.

Cheers,
Andrew



Reply | Threaded
Open this post in threaded view
|

Re: f951: internal compiler error: Illegal instruction: 4 when installing packages

Octave - General mailing list
Again, thank you for your help.

First, since building from source using the command 'brew reinstall
--build-from-source gcc' did not work I looked for other ways and found a
video to build gcc-10 from source
https://www.youtube.com/watch?v=GUa9w5rn3a8
<https://www.youtube.com/watch?v=GUa9w5rn3a8>  . I followed it and it took
many many hours to build. During the process several warnings occurred.
However, I did not take notes which ones. Still, when installing the
statistics package it resulted in the same error.

Then, after reading your answer I tried what you said. Specifically, I run
'brew reinstall --build-from-source gmp isl libmpc mpfr' which resulted in
/% brew reinstall --build-from-source gmp isl libmpc mpfr
==> Downloading https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
Already downloaded:
/Users/Manuel/Library/Caches/Homebrew/downloads/ade51fddb351cd85e1645e43543cff053bc2f667ec8a7eb1c7554ac301a30d4b--gmp-6.2.1.tar.xz
==> Reinstalling gmp
==> ./configure --prefix=/usr/local/Cellar/gmp/6.2.1
--libdir=/usr/local/Cellar/
==> make
==> make check
Last 15 lines from /Users/Manuel/Library/Logs/Homebrew/gmp/03.make:
# SKIP:  0
# XFAIL: 0
# FAIL:  6
# XPASS: 0
# ERROR: 0
============================================================================
See tests/mpz/test-suite.log
Please report to [hidden email], see
https://gmplib.org/manual/Reporting-Bugs.html
============================================================================
make[5]: *** [test-suite.log] Error 1
make[4]: *** [check-TESTS] Error 2
make[3]: *** [check-am] Error 2
make[2]: *** [check-recursive] Error 1
make[1]: *** [check-recursive] Error 1
make: *** [check] Error 2

READ THIS: https://docs.brew.sh/Troubleshooting/

Obviously something is not working here as well. However, for completeness I
tried 'brew reinstall --build-from-source gcc' which resulted in

/% brew reinstall --build-from-source gcc
==> Downloading
https://raw.githubusercontent.com/Homebrew/formula-patches/6a83f36d/gcc/bigsur_2.patch
Already downloaded:
/Users/Manuel/Library/Caches/Homebrew/downloads/c0b9dca392d2e8496747001f634c04a4bc2f5c63672b963f3c4f217e70aaa258--bigsur_2.patch
==> Downloading https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.xz
Already downloaded:
/Users/Manuel/Library/Caches/Homebrew/downloads/c8d4ca732a98ae691d04472b15de6d9e06a09016499af6ff16c4f55081bfc6b9--gcc-10.2.0.tar.xz
==> Reinstalling gcc
==> Patching
==> Applying bigsur_2.patch
patching file gcc/config/host-darwin.c
patching file gcc/config/darwin-c.c
patching file gcc/config/darwin-driver.c
patching file gcc/testsuite/gcc.dg/darwin-minversion-link.c
patching file gcc/config/darwin-driver.c
patching file gcc/config/darwin-driver.c
patching file libsanitizer/configure.tgt
patching file gcc/configure
Hunk #1 succeeded at 15485 (offset -5 lines).
patching file libatomic/configure
patching file libbacktrace/configure
patching file libcc1/Makefile.am
patching file libcc1/Makefile.in
patching file libcc1/configure
patching file libcc1/configure.ac
patching file libffi/configure
patching file libgfortran/configure
patching file libgomp/Makefile.in
patching file libgomp/configure
patching file libhsail-rt/configure
patching file libitm/configure
patching file libitm/configure.tgt
patching file libobjc/configure
patching file libphobos/configure
patching file libquadmath/configure
patching file libsanitizer/configure
patching file libsanitizer/configure.tgt
patching file libssp/configure
patching file libstdc++-v3/configure
patching file libtool.m4
patching file libvtv/configure
patching file zlib/configure
==> ../configure --prefix=/usr/local/Cellar/gcc/10.2.0_4
--libdir=/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10 --disable-nls
--enable-checking=rel
==> make BOOT_LDFLAGS=-Wl,-headerpad_max_install_names
Last 15 lines from /Users/Manuel/Library/Logs/Homebrew/gcc/02.make:
/bin/sh ../../gcc/../move-if-change tmp-opinit.h insn-opinit.h
/bin/sh ../../gcc/../move-if-change tmp-opinit.c insn-opinit.c
echo timestamp > s-opinit
build/genattrtab ../../gcc/common.md ../../gcc/config/i386/i386.md
insn-conditions.md \
                -Atmp-attrtab.c -Dtmp-dfatab.c -Ltmp-latencytab.c
build/genautomata ../../gcc/common.md ../../gcc/config/i386/i386.md \
          insn-conditions.md > tmp-automata.c
make[3]: *** [s-attrtab] Illegal instruction: 4
make[3]: *** Waiting for unfinished jobs....
/bin/sh ../../gcc/../move-if-change tmp-automata.c insn-automata.c
echo timestamp > s-automata
rm gcc.pod
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

READ THIS: https://docs.brew.sh/Troubleshooting

These open issues may also help:
gcc 10.3.0 https://github.com/Homebrew/homebrew-core/pull/74843/

Finally, trying to install the statistics package in Octave resulted in the
same error as before.

I am very thankful for any additional tips I could try to get it working. Do
you know if there is a way to maybe build gcc explicitly for the processor I
am using?

Furthermore, I searched for 'f951' in /usr/local where I actually found 3
exec.
One in //usr/local/gfortran/libexec/gcc/x86_64-apple-darwin15/6.1.0/f951/
A second one in
//usr/local/gcc-10/libexec/gcc/x86_64-apple-darwin19.6.0/11.0.1/f951/
And a third one in
//usr/local/Cellar/gcc/10.2.0_4/libexec/gcc/x86_64-apple-darwin19/10.2.0/f951/

Although I am far from being an expert in this matter I believe that maybe
this could cause the error? I.e. that I have the same exec in three
different directories?  

Thank you
Manuel



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: f951: internal compiler error: Illegal instruction: 4 when installing packages

apjanke-floss


On 4/15/21 9:19 AM, mzerobin via Help-octave wrote:
> Again, thank you for your help.

You're welcome! Happy to help.

> First, since building from source using the command 'brew reinstall
> --build-from-source gcc' did not work I looked for other ways and found a
> video to build gcc-10 from source
> https://www.youtube.com/watch?v=GUa9w5rn3a8
> <https://www.youtube.com/watch?v=GUa9w5rn3a8>  . I followed it and it took
> many many hours to build. During the process several warnings occurred.
> However, I did not take notes which ones. Still, when installing the
> statistics package it resulted in the same error.
>
> Finally, trying to install the statistics package in Octave resulted in the
> same error as before.
>
> I am very thankful for any additional tips I could try to get it
working. Do
> you know if there is a way to maybe build gcc explicitly for the
processor I
> am using?

I'm about out of ideas here; sorry. AFAIK, what you're doing "should
have" worked. There's nothing special you need to do to build a program
specifically for your CPU; that's just what should happen by default
when you build from source.

Maybe try MacPorts instead? They have better support for older macOS
versions and machines than Homebrew does.

You could also try building this stuff with `HOMEBREW_MAKE_JOBS=1`.
It'll go a lot slower, but you'll get easier-to-read diagnostic output
in the build logs.

> Furthermore, I searched for 'f951' in /usr/local where I actually found 3
> exec.
> One in //usr/local/gfortran/libexec/gcc/x86_64-apple-darwin15/6.1.0/f951/
> A second one in
> //usr/local/gcc-10/libexec/gcc/x86_64-apple-darwin19.6.0/11.0.1/f951/
> And a third one in
> //usr/local/Cellar/gcc/10.2.0_4/libexec/gcc/x86_64-apple-darwin19/10.2.0/f951/
>
> Although I am far from being an expert in this matter I believe that maybe
> this could cause the error? I.e. that I have the same exec in three
> different directories?

Now that is a bit odd. Where did that /usr/local/gfortran installation
come from?

The other two things look like two separate GCC installations (the f951
program is part of GCC, like the rest of GNU Fortran); one from Homebrew
and one that you did using one of the other processes.

Which one of these you're picking up will depend on your $PATH settings
when you do the build.


I've made an Octave.app issue about adding support for this scenario to
Octave.app: https://github.com/octave-app/octave-app/issues/225. If you
have some spare time, maybe you could drop by there and write some
comments about your use case? It won't happen any time soon, but it
might be useful for you or other users in the future.

Cheers,
Andrew


Reply | Threaded
Open this post in threaded view
|

Re: f951: internal compiler error: Illegal instruction: 4 when installing packages

Octave - General mailing list
Hi Andrew,
thank you for your input. Unfortunately, it is still not working. I am going
to keep on trying for some time. If I will be able to solve the problem I am
going to post it here.

Regarding the three f951 files. I removed the gfortran and the gcc versions
and installed it fresh via Homebrew. Now only one is available. However, it
does not make any difference with regards to my problem.

I just had a look at the Octave.app issue and will explain the use case
there.

All the best,
Manuel






--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html