[Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

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

[Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

mabalenk
Dear all,

I would like to compile GNU Octave from source code on a macOS BigSur 11.2.2. I obtained the source code from a GitHub repository: [hidden email]:gnu-octave/octave.git. To compile and install Octave I follow the steps from Octave Wiki page: https://wiki.octave.org/Building. After bootstrapping and changing into the newly created “build” directory. I configure the build with the following command:

../configure --prefix=/opt/octave-6.2.0 --includedir=/opt/local/include/ --disable-readline --without-qt --without-x

Unfortunately, the compilation fails with the following error:

  CXXLD    liboctave/liboctave.la
Undefined symbols for architecture x86_64:
  "_cgejsv_", referenced from:
      __ZN6octave4math3svdI18FloatComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIfEiPfS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_ in libnumeric.a(libnumeric_la-svd.o)
  "_iconv", referenced from:
      _iconv_carefully_1 in libgnu.a(striconveh.o)
      _mem_cd_iconveh_internal in libgnu.a(striconveh.o)
     (maybe you meant: _str_iconveh, _iconveh_close , _octave_iconv_close_wrapper , _octave_iconv_open_wrapper , _mem_iconveh , _mem_cd_iconveh , _str_iconveha , _iconveh_open , _str_cd_iconveh , _mem_iconveha )
  "_iconv_close", referenced from:
      _octave_iconv_close_wrapper in libwrappers.a(libwrappers_la-iconv-wrappers.o)
      _iconveh_open in libgnu.a(striconveh.o)
      _iconveh_close in libgnu.a(striconveh.o)
     (maybe you meant: _octave_iconv_close_wrapper)
  "_iconv_open", referenced from:
      _octave_iconv_open_wrapper in libwrappers.a(libwrappers_la-iconv-wrappers.o)
      _iconveh_open in libgnu.a(striconveh.o)
     (maybe you meant: _octave_iconv_open_wrapper)
  "_zgejsv_", referenced from:
      __ZN6octave4math3svdI13ComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIdEiPdS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_ in libnumeric.a(libnumeric_la-svd.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:14419: liboctave/liboctave.la] Error 1
make[2]: Leaving directory '/Users/mabalenk/repo/git/octave/build'
make[1]: *** [Makefile:27830: all-recursive] Error 1
make[1]: Leaving directory '/Users/mabalenk/repo/git/octave/build'
make: *** [Makefile:11298: all] Error 2

To compile Octave I use the GNU toolchain from MacPorts: g++ (MacPorts gcc10 10.2.0_5) 10.2.0. I would welcome any guidance or advice on how to resolve this issue and proceed further. Thank you and have a good day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io


Reply | Threaded
Open this post in threaded view
|

Re: [Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

apjanke-floss


On 3/9/21 3:53 AM, Maxim Abalenkov wrote:

> Dear all,
>
> I would like to compile GNU Octave from source code on a macOS BigSur
> 11.2.2. I obtained the source code from a GitHub repository:
> [hidden email] <mailto:[hidden email]>:gnu-octave/octave.git. To compile
> and install Octave I follow the steps from Octave Wiki page:
> https://wiki.octave.org/Building <https://wiki.octave.org/Building>.
> After bootstrapping and changing into the newly created “build”
> directory. I configure the build with the following command:
>
> ../configure --prefix=/opt/octave-6.2.0 --includedir=/opt/local/include/
> --disable-readline --without-qt --without-x
>
> Unfortunately, the compilation fails with the following error:
>
>    CXXLD    liboctave/liboctave.la <http://liboctave.la>
> Undefined symbols for architecture x86_64:
>    "_cgejsv_", referenced from:
>        
> __ZN6octave4math3svdI18FloatComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIfEiPfS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_
> in libnumeric.a(libnumeric_la-svd.o)
>    "_iconv", referenced from:
>        _iconv_carefully_1 in libgnu.a(striconveh.o)
>        _mem_cd_iconveh_internal in libgnu.a(striconveh.o)
>       (maybe you meant: _str_iconveh, _iconveh_close ,
> _octave_iconv_close_wrapper , _octave_iconv_open_wrapper , _mem_iconveh
> , _mem_cd_iconveh , _str_iconveha , _iconveh_open , _str_cd_iconveh ,
> _mem_iconveha )
>    "_iconv_close", referenced from:
>        _octave_iconv_close_wrapper in
> libwrappers.a(libwrappers_la-iconv-wrappers.o)
>        _iconveh_open in libgnu.a(striconveh.o)
>        _iconveh_close in libgnu.a(striconveh.o)
>       (maybe you meant: _octave_iconv_close_wrapper)
>    "_iconv_open", referenced from:
>        _octave_iconv_open_wrapper in
> libwrappers.a(libwrappers_la-iconv-wrappers.o)
>        _iconveh_open in libgnu.a(striconveh.o)
>       (maybe you meant: _octave_iconv_open_wrapper)
>    "_zgejsv_", referenced from:
>        
> __ZN6octave4math3svdI13ComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIdEiPdS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_
> in libnumeric.a(libnumeric_la-svd.o)
> ld: symbol(s) not found for architecture x86_64
> collect2: error: ld returned 1 exit status
> make[2]: *** [Makefile:14419: liboctave/liboctave.la
> <http://liboctave.la>] Error 1
> make[2]: Leaving directory '/Users/mabalenk/repo/git/octave/build'
> make[1]: *** [Makefile:27830: all-recursive] Error 1
> make[1]: Leaving directory '/Users/mabalenk/repo/git/octave/build'
> make: *** [Makefile:11298: all] Error 2
>
> To compile Octave I use the GNU toolchain from MacPorts: g++ (MacPorts
> gcc10 10.2.0_5) 10.2.0. I would welcome any guidance or advice on how to
> resolve this issue and proceed further. Thank you and have a good day ahead!
>
> —
> Best wishes,
> Maxim
>
> Maxim Abalenkov \\ [hidden email]
> <mailto:[hidden email]>
> +44 7 486 486 505 \\ http://mabalenk.gitlab.io <http://mabalenk.gitlab.io>

Hi Maxim,

cgejsv and zgejsv are LAPACK functions, which should be included in your
BLAS. Are you sure you have a good OpenBLAS build and it's on the path?
Or are you trying to compile against Apple Accelerate as your
BLAS/LAPACK implementation?

Looks like you're also missing a -liconv or similar to link GNU libiconv?

Compiling Octave on a Mac can be tricky. I think your best bet is to use
a package manager definition for it instead of trying to build from
source yourself, unless you have custom build requirements.

Are you a regular MacPorts user, or did you just install it to get the
build environment for Octave?

If you're a MacPorts user, I'd contact their octave port maintainer and
see if they can bump their port to 6.2.0 so you can just install that
instead of having to build yourself. (It's currently on 6.1.0; I assume
that's why you're doing your own build here.)

If you're just using MacPorts to build Octave and are in a hurry,
consider switching to Homebrew: the Octave.app project has a Homebrew
formula for Octave 6.2.0 that has been successful against recent macOS
releases. [1] And the core Homebrew Octave formula [4] is on 6.2.0, if
you don't mind some GUI hiccups.

Or just download the pre-built Octave.app. [2] There's a beta for 6.2.0
out. [3] Octave.app is primarily used for its GUI, but you can run the
command-line octave from it just fine, too.

Cheers,
Andrew

[1a]
https://github.com/octave-app/homebrew-octave-app/blob/master/Formula/octave%406.2.0.rb 

[1b]
https://github.com/octave-app/homebrew-octave-app/blob/master/Formula/octave-octave-app%406.2.0.rb
[2] https://octave-app.org/
[3] https://github.com/octave-app/octave-app/releases/tag/v6.2.0-beta1
[4] https://formulae.brew.sh/formula/octave


Reply | Threaded
Open this post in threaded view
|

Re: [Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

mabalenk
Hello Andrew,

Thank you very much for your help! I do need to compile Octave from source code, because in the future I will need to refactor some of the Octave source code, especially the “mxArray” variable, that conflicts with the MATLAB definition of “mxArray". You may see my yesterday’s email regarding that issue. I found this post on StackOverflow and I’m currently trying to configure and compile Octave adding the “—with-libiconv-prefix=/opt/local/“ option. Unfortunately, that failed and the /opt/local/include and /opt/local/lib directories are not picked up or picked up too late. Now I have added the /opt/local into CFLAGS=-I/opt/local/include, LDFLAGS=-L/opt/local/lib and LIBS=-liconv. I have also dubbed these flags in CXXFLAGS and FCFLAGS.

I didn’t deal with the BLAS/LAPACK errors yet. I was hoping the configure script will pick up Apple’s Accelerate framework. But it seems this is not the case. If you have any advice on how to ensure Octave uses Accelerate I would be grateful. In the worst case I will install the OpenBLAS.

I’m a regular user of MacPorts and I was fine with the version 6.1.0 until recently, when I figured out I have a conflict with MATLAB’s “mxArray” definition. That’s why I may need to refactor Octave’s codebase, renaming “mxArray” into “mtrxArray” for example. It is an intrusive change. But so far I don’t see an elegant solution.

Thank you and have a good day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

On 9 Mar 2021, at 11:32, Andrew Janke <[hidden email]> wrote:



On 3/9/21 3:53 AM, Maxim Abalenkov wrote:
Dear all,
I would like to compile GNU Octave from source code on a macOS BigSur 11.2.2. I obtained the source code from a GitHub repository: [hidden email] <[hidden email]>:gnu-octave/octave.git. To compile and install Octave I follow the steps from Octave Wiki page: https://wiki.octave.org/Building <https://wiki.octave.org/Building>. After bootstrapping and changing into the newly created “build” directory. I configure the build with the following command:
../configure --prefix=/opt/octave-6.2.0 --includedir=/opt/local/include/ --disable-readline --without-qt --without-x
Unfortunately, the compilation fails with the following error:
  CXXLD    liboctave/liboctave.la <http://liboctave.la>
Undefined symbols for architecture x86_64:
  "_cgejsv_", referenced from:
      __ZN6octave4math3svdI18FloatComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIfEiPfS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_ in libnumeric.a(libnumeric_la-svd.o)
  "_iconv", referenced from:
      _iconv_carefully_1 in libgnu.a(striconveh.o)
      _mem_cd_iconveh_internal in libgnu.a(striconveh.o)
     (maybe you meant: _str_iconveh, _iconveh_close , _octave_iconv_close_wrapper , _octave_iconv_open_wrapper , _mem_iconveh , _mem_cd_iconveh , _str_iconveha , _iconveh_open , _str_cd_iconveh , _mem_iconveha )
  "_iconv_close", referenced from:
      _octave_iconv_close_wrapper in libwrappers.a(libwrappers_la-iconv-wrappers.o)
      _iconveh_open in libgnu.a(striconveh.o)
      _iconveh_close in libgnu.a(striconveh.o)
     (maybe you meant: _octave_iconv_close_wrapper)
  "_iconv_open", referenced from:
      _octave_iconv_open_wrapper in libwrappers.a(libwrappers_la-iconv-wrappers.o)
      _iconveh_open in libgnu.a(striconveh.o)
     (maybe you meant: _octave_iconv_open_wrapper)
  "_zgejsv_", referenced from:
      __ZN6octave4math3svdI13ComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIdEiPdS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_ in libnumeric.a(libnumeric_la-svd.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:14419: liboctave/liboctave.la <http://liboctave.la>] Error 1
make[2]: Leaving directory '/Users/mabalenk/repo/git/octave/build'
make[1]: *** [Makefile:27830: all-recursive] Error 1
make[1]: Leaving directory '/Users/mabalenk/repo/git/octave/build'
make: *** [Makefile:11298: all] Error 2
To compile Octave I use the GNU toolchain from MacPorts: g++ (MacPorts gcc10 10.2.0_5) 10.2.0. I would welcome any guidance or advice on how to resolve this issue and proceed further. Thank you and have a good day ahead!

Best wishes,
Maxim
Maxim Abalenkov \\ [hidden email] <[hidden email]>
+44 7 486 486 505 \\ http://mabalenk.gitlab.io <http://mabalenk.gitlab.io>

Hi Maxim,

cgejsv and zgejsv are LAPACK functions, which should be included in your BLAS. Are you sure you have a good OpenBLAS build and it's on the path? Or are you trying to compile against Apple Accelerate as your BLAS/LAPACK implementation?

Looks like you're also missing a -liconv or similar to link GNU libiconv?

Compiling Octave on a Mac can be tricky. I think your best bet is to use a package manager definition for it instead of trying to build from source yourself, unless you have custom build requirements.

Are you a regular MacPorts user, or did you just install it to get the build environment for Octave?

If you're a MacPorts user, I'd contact their octave port maintainer and see if they can bump their port to 6.2.0 so you can just install that instead of having to build yourself. (It's currently on 6.1.0; I assume that's why you're doing your own build here.)

If you're just using MacPorts to build Octave and are in a hurry, consider switching to Homebrew: the Octave.app project has a Homebrew formula for Octave 6.2.0 that has been successful against recent macOS releases. [1] And the core Homebrew Octave formula [4] is on 6.2.0, if you don't mind some GUI hiccups.

Or just download the pre-built Octave.app. [2] There's a beta for 6.2.0 out. [3] Octave.app is primarily used for its GUI, but you can run the command-line octave from it just fine, too.

Cheers,
Andrew

[1a] https://github.com/octave-app/homebrew-octave-app/blob/master/Formula/octave%406.2.0.rb
[1b] https://github.com/octave-app/homebrew-octave-app/blob/master/Formula/octave-octave-app%406.2.0.rb
[2] https://octave-app.org/
[3] https://github.com/octave-app/octave-app/releases/tag/v6.2.0-beta1
[4] https://formulae.brew.sh/formula/octave



Reply | Threaded
Open this post in threaded view
|

Re: [Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

apjanke-floss


On 3/9/21 5:44 AM, Maxim Abalenkov wrote:
> Hello Andrew,
>
> Thank you very much for your help! I do need to compile Octave from
> source code, because in the future I will need to refactor some of the
> Octave source code, especially the “mxArray” variable, that conflicts
> with the MATLAB definition of “mxArray". You may see my yesterday’s
> email regarding that issue.

Oh yeah, I saw that! Not to be a downer, but you're screwed, dude. This
is an _ambitious_ project.

> I found this post on StackOverflow and I’m
> currently trying to configure and compile Octave adding the
> “—with-libiconv-prefix=/opt/local/“ option. Unfortunately, that failed
> and the /opt/local/include and /opt/local/lib directories are not picked
> up or picked up too late. Now I have added the /opt/local into
> CFLAGS=-I/opt/local/include, LDFLAGS=-L/opt/local/lib and LIBS=-liconv.
> I have also dubbed these flags in CXXFLAGS and FCFLAGS.

Maybe this is a pkgconfig issue? Do all your packages have pkgconfig
definitions?

> I didn’t deal with the BLAS/LAPACK errors yet. I was hoping the
> configure script will pick up Apple’s Accelerate framework. But it seems
> this is not the case. If you have any advice on how to ensure Octave
> uses Accelerate I would be grateful. In the worst case I will install
> the OpenBLAS.

In my past experience, the Octave configure script _will_ pick up
Apple's Accelerate framework just fine. Octave.app shipped against Apple
Accelerate for ~years before we explicitly switched it to use OpenBLAS,
if I recall correctly. I'm wondering if maybe you are picking it up and
there are some functions it doesn't implement, at least in this
macOS/SDK version?

> I’m a regular user of MacPorts and I was fine with the version 6.1.0
> until recently, when I figured out I have a conflict with MATLAB’s
> “mxArray” definition. That’s why I may need to refactor Octave’s
> codebase, renaming “mxArray” into “mtrxArray” for example. It is an
> intrusive change. But so far I don’t see an elegant solution.

Sorry dude, I think you are seriously SOL here. "mxArray" is an
undocumented, not-for-external-use, internal data structure from
Matlab's perspective, and I think from Octave's perspective too. (There
may even be patent and copyright issues here.) You are deep in There Be
Dragons Here territory here. God only knows what'll happen if you try
mixing Matlab and Octave's definitions of it in a single executable.

> Thank you and have a good day ahead!

You too! I wish you well in your endeavor, however pessimistic about it
I may seem.

Cheers,
Andrew


Reply | Threaded
Open this post in threaded view
|

Re: [Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

mabalenk
In reply to this post by mabalenk
Dear all,

Thank you very much for your help and your replies. Please find below the contents of my configure and build bash script:

#!/opt/local/bin/bash

export V=1

CC=gcc
CXX=g++
FC=gfortran
CFLAGS=-I/opt/intel/oneapi/mkl/2021.1.1/include
CXXFLAGS=-I/opt/intel/oneapi/mkl/2021.1.1/include
FFLAGS=-I/opt/intel/oneapi/mkl/2021.1.1/include
LDFLAGS="/opt/local/lib/libiconv.a /opt/intel/oneapi/mkl/2021.1.1/lib/libmkl_blas95_lp64.a"

../configure --prefix=/opt/octave-6.2.0 --disable-readline --without-qt --without-x

make -j 4

As you may see I’m trying to point Octave to Intel’s MKL BLAS and GNU iconv library located in /opt/local/lib. However, I’m still facing the same error and compilation crashes at the same moment:

libtool: link: g++ -dynamiclib  -o liboctave/.libs/liboctave.8.dylib  liboctave/.libs/liboctave_la-liboctave-build-info.o liboctave/.libs/liboctave_la-version.o   -Wl,-force_load,liboctave/array/.libs/libarray.a -Wl,-force_load,liboctave/external/blas-xtra/.libs/libxerbla.a -Wl,-force_load,liboctave/external/ranlib/.libs/libranlib.a -Wl,-force_load,liboctave/external/.libs/libexternal.a -Wl,-force_load,liboctave/numeric/.libs/libnumeric.a -Wl,-force_load,liboctave/operators/.libs/liboperators.a -Wl,-force_load,liboctave/system/.libs/libsystem.a -Wl,-force_load,liboctave/util/.libs/libutil.a -Wl,-force_load,liboctave/wrappers/.libs/libwrappers.a -Wl,-force_load,libgnu/.libs/libgnu.a  -L/opt/local/lib -lcurl -larpack -lfftw3_threads -lfftw3 -lfftw3f_threads -lfftw3f -llapack -lblas -lncurses -lpcre -ldl -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin20/10.2.0 -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin20/10.2.0/../../.. -lgfortran -lquadmath -liconv -lm  -pthread -fopenmp -g -O2 -Wl,-framework -Wl,CoreFoundation   -pthread -fopenmp -install_name  /opt/octave-6.2.0/lib/octave/7.0.0/liboctave.8.dylib -compatibility_version 9 -current_version 9.0 -Wl,-single_module
Undefined symbols for architecture x86_64:
  "_cgejsv_", referenced from:
      __ZN6octave4math3svdI18FloatComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIfEiPfS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_ in libnumeric.a(libnumeric_la-svd.o)
  "_iconv", referenced from:
      _iconv_carefully_1 in libgnu.a(striconveh.o)
      _mem_cd_iconveh_internal in libgnu.a(striconveh.o)
     (maybe you meant: _str_iconveh, _iconveh_close , _octave_iconv_close_wrapper , _octave_iconv_open_wrapper , _mem_iconveh , _mem_cd_iconveh , _str_iconveha , _iconveh_open , _str_cd_iconveh , _mem_iconveha )
  "_iconv_close", referenced from:
      _octave_iconv_close_wrapper in libwrappers.a(libwrappers_la-iconv-wrappers.o)
      _iconveh_open in libgnu.a(striconveh.o)
      _iconveh_close in libgnu.a(striconveh.o)
     (maybe you meant: _octave_iconv_close_wrapper)
  "_iconv_open", referenced from:
      _octave_iconv_open_wrapper in libwrappers.a(libwrappers_la-iconv-wrappers.o)
      _iconveh_open in libgnu.a(striconveh.o)
     (maybe you meant: _octave_iconv_open_wrapper)
  "_zgejsv_", referenced from:
      __ZN6octave4math3svdI13ComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIdEiPdS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_ in libnumeric.a(libnumeric_la-svd.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:14419: liboctave/liboctave.la] Error 1
make[2]: Leaving directory '/Users/mabalenk/repo/git/octave/build'
make[1]: *** [Makefile:27830: all-recursive] Error 1
make[1]: Leaving directory '/Users/mabalenk/repo/git/octave/build'
make: *** [Makefile:11298: all] Error 2

I will investigate further, but please share your thoughts and ideas. Thank you and have a good day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

On 9 Mar 2021, at 15:45, Marius Schamschula <[hidden email]> wrote:

Maxim,

The default MacPorts build uses +accelerate. It is the default variant. However, it is mutually exclusive with the +openblas variant. The atlas variant has long since been retired (as modern macOS kernels and atlas don’t work together). 

You should file a trac ticket or contact Marcus Calhoun-Lopez directly if you find build issue.

On Mar 9, 2021, at 4:44 AM, Maxim Abalenkov <[hidden email]> wrote:

Hello Andrew,

Thank you very much for your help! I do need to compile Octave from source code, because in the future I will need to refactor some of the Octave source code, especially the “mxArray” variable, that conflicts with the MATLAB definition of “mxArray". You may see my yesterday’s email regarding that issue. I found this post on StackOverflow and I’m currently trying to configure and compile Octave adding the “—with-libiconv-prefix=/opt/local/“ option. Unfortunately, that failed and the /opt/local/include and /opt/local/lib directories are not picked up or picked up too late. Now I have added the /opt/local into CFLAGS=-I/opt/local/include, LDFLAGS=-L/opt/local/lib and LIBS=-liconv. I have also dubbed these flags in CXXFLAGS and FCFLAGS.

I didn’t deal with the BLAS/LAPACK errors yet. I was hoping the configure script will pick up Apple’s Accelerate framework. But it seems this is not the case. If you have any advice on how to ensure Octave uses Accelerate I would be grateful. In the worst case I will install the OpenBLAS.

I’m a regular user of MacPorts and I was fine with the version 6.1.0 until recently, when I figured out I have a conflict with MATLAB’s “mxArray” definition. That’s why I may need to refactor Octave’s codebase, renaming “mxArray” into “mtrxArray” for example. It is an intrusive change. But so far I don’t see an elegant solution.

Thank you and have a good day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

On 9 Mar 2021, at 11:32, Andrew Janke <[hidden email]> wrote:



On 3/9/21 3:53 AM, Maxim Abalenkov wrote:
Dear all,
I would like to compile GNU Octave from source code on a macOS BigSur 11.2.2. I obtained the source code from a GitHub repository: [hidden email] <[hidden email]>:gnu-octave/octave.git. To compile and install Octave I follow the steps from Octave Wiki page: https://wiki.octave.org/Building <https://wiki.octave.org/Building>. After bootstrapping and changing into the newly created “build” directory. I configure the build with the following command:
../configure --prefix=/opt/octave-6.2.0 --includedir=/opt/local/include/ --disable-readline --without-qt --without-x
Unfortunately, the compilation fails with the following error:
  CXXLD    liboctave/liboctave.la <http://liboctave.la>
Undefined symbols for architecture x86_64:
  "_cgejsv_", referenced from:
      __ZN6octave4math3svdI18FloatComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIfEiPfS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_ in libnumeric.a(libnumeric_la-svd.o)
  "_iconv", referenced from:
      _iconv_carefully_1 in libgnu.a(striconveh.o)
      _mem_cd_iconveh_internal in libgnu.a(striconveh.o)
     (maybe you meant: _str_iconveh, _iconveh_close , _octave_iconv_close_wrapper , _octave_iconv_open_wrapper , _mem_iconveh , _mem_cd_iconveh , _str_iconveha , _iconveh_open , _str_cd_iconveh , _mem_iconveha )
  "_iconv_close", referenced from:
      _octave_iconv_close_wrapper in libwrappers.a(libwrappers_la-iconv-wrappers.o)
      _iconveh_open in libgnu.a(striconveh.o)
      _iconveh_close in libgnu.a(striconveh.o)
     (maybe you meant: _octave_iconv_close_wrapper)
  "_iconv_open", referenced from:
      _octave_iconv_open_wrapper in libwrappers.a(libwrappers_la-iconv-wrappers.o)
      _iconveh_open in libgnu.a(striconveh.o)
     (maybe you meant: _octave_iconv_open_wrapper)
  "_zgejsv_", referenced from:
      __ZN6octave4math3svdI13ComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIdEiPdS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_ in libnumeric.a(libnumeric_la-svd.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:14419: liboctave/liboctave.la <http://liboctave.la>] Error 1
make[2]: Leaving directory '/Users/mabalenk/repo/git/octave/build'
make[1]: *** [Makefile:27830: all-recursive] Error 1
make[1]: Leaving directory '/Users/mabalenk/repo/git/octave/build'
make: *** [Makefile:11298: all] Error 2
To compile Octave I use the GNU toolchain from MacPorts: g++ (MacPorts gcc10 10.2.0_5) 10.2.0. I would welcome any guidance or advice on how to resolve this issue and proceed further. Thank you and have a good day ahead!

Best wishes,
Maxim
Maxim Abalenkov \\ [hidden email] <[hidden email]>
+44 7 486 486 505 \\ http://mabalenk.gitlab.io <http://mabalenk.gitlab.io>

Hi Maxim,

cgejsv and zgejsv are LAPACK functions, which should be included in your BLAS. Are you sure you have a good OpenBLAS build and it's on the path? Or are you trying to compile against Apple Accelerate as your BLAS/LAPACK implementation?

Looks like you're also missing a -liconv or similar to link GNU libiconv?

Compiling Octave on a Mac can be tricky. I think your best bet is to use a package manager definition for it instead of trying to build from source yourself, unless you have custom build requirements.

Are you a regular MacPorts user, or did you just install it to get the build environment for Octave?

If you're a MacPorts user, I'd contact their octave port maintainer and see if they can bump their port to 6.2.0 so you can just install that instead of having to build yourself. (It's currently on 6.1.0; I assume that's why you're doing your own build here.)

If you're just using MacPorts to build Octave and are in a hurry, consider switching to Homebrew: the Octave.app project has a Homebrew formula for Octave 6.2.0 that has been successful against recent macOS releases. [1] And the core Homebrew Octave formula [4] is on 6.2.0, if you don't mind some GUI hiccups.

Or just download the pre-built Octave.app. [2] There's a beta for 6.2.0 out. [3] Octave.app is primarily used for its GUI, but you can run the command-line octave from it just fine, too.

Cheers,
Andrew

[1a] https://github.com/octave-app/homebrew-octave-app/blob/master/Formula/octave%406.2.0.rb
[1b] https://github.com/octave-app/homebrew-octave-app/blob/master/Formula/octave-octave-app%406.2.0.rb
[2] https://octave-app.org/
[3] https://github.com/octave-app/octave-app/releases/tag/v6.2.0-beta1
[4] https://formulae.brew.sh/formula/octave






Reply | Threaded
Open this post in threaded view
|

Re: [Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

apjanke-floss


On 3/9/21 9:36 AM, Maxim Abalenkov wrote:
> Dear all,
>
> Thank you very much for your help and your replies. Please find below
> the contents of my configure and build bash script:
>
> As you may see I’m trying to point Octave to Intel’s MKL BLAS and GNU
> iconv library located in /opt/local/lib.

You are the only person I'm aware of who has *actually* tried to build
Octave against Intel MKL on Mac; up until now this has just been a
theoretical discussion as far as I'm aware.

Good luck!

Cheers,
Andrew


Reply | Threaded
Open this post in threaded view
|

Re: [Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

mabalenk
Dear all,

Thank you for all you help and your suggestions. Now I see, why linking Octave against Intel’s MKL @ macOS was a theoretical debate. I’m failing here right at the configuration stage. Please find my `config.log` file attached. I would be happy to help here and try further if you can provide me with some guidance. I think MKL at the backend would make Octave only stronger.

Regarding of my original issue of compiling Octave from source @ macOS I think for now I will follow an easier route and try to link it against the “standard” OpenBLAS. I need to progress in my project and make my life a little bit easier. I will get back to you once I try the "OpenBLAS compilation”. Thank you for your help and have a good day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

On 9 Mar 2021, at 17:21, Andrew Janke <[hidden email]> wrote:



On 3/9/21 9:36 AM, Maxim Abalenkov wrote:
Dear all,

Thank you very much for your help and your replies. Please find below
the contents of my configure and build bash script:

As you may see I’m trying to point Octave to Intel’s MKL BLAS and GNU
iconv library located in /opt/local/lib.

You are the only person I'm aware of who has *actually* tried to build
Octave against Intel MKL on Mac; up until now this has just been a
theoretical discussion as far as I'm aware.

Good luck!

Cheers,
Andrew



Reply | Threaded
Open this post in threaded view
|

Re: [Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

mabalenk
Dear all,

Please find the `config.log` file attached (Octave with Intel MKL @ the backend). My configure and build script is as follows:

#!/opt/local/bin/bash

export V=1

CC=gcc
CXX=g++
FC=gfortran
CFLAGS="-I/opt/local/include -m64 -I${MKLROOT}/include"
CXXFLAGS="-I/opt/local/include -m64 -I${MKLROOT}/include"
FFLAGS="-I/opt/local/include -m64 -I${MKLROOT}/include"
LDFLAGS="-L${MKLROOT}/lib -Wl,-rpath,${MKLROOT}/lib -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl -L/opt/local/lib -liconv -L/opt/local/lib -lfl"

../configure --prefix=/opt/octave-6.2.0 --disable-readline --without-qt --without-x

make -j 4

Best wishes,
Maxim



Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

On 11 Mar 2021, at 12:32, Maxim Abalenkov <[hidden email]> wrote:

Dear all,

Thank you for all you help and your suggestions. Now I see, why linking Octave against Intel’s MKL @ macOS was a theoretical debate. I’m failing here right at the configuration stage. Please find my `config.log` file attached. I would be happy to help here and try further if you can provide me with some guidance. I think MKL at the backend would make Octave only stronger.

Regarding of my original issue of compiling Octave from source @ macOS I think for now I will follow an easier route and try to link it against the “standard” OpenBLAS. I need to progress in my project and make my life a little bit easier. I will get back to you once I try the "OpenBLAS compilation”. Thank you for your help and have a good day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

On 9 Mar 2021, at 17:21, Andrew Janke <[hidden email]> wrote:



On 3/9/21 9:36 AM, Maxim Abalenkov wrote:
Dear all,

Thank you very much for your help and your replies. Please find below
the contents of my configure and build bash script:

As you may see I’m trying to point Octave to Intel’s MKL BLAS and GNU
iconv library located in /opt/local/lib.

You are the only person I'm aware of who has *actually* tried to build
Octave against Intel MKL on Mac; up until now this has just been a
theoretical discussion as far as I'm aware.

Good luck!

Cheers,
Andrew





config.log (217K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

mabalenk
Dear all,

How are you? All my attempts to compile Octave on a macOS with OpenBLAS fail. I still obtain the same error:

libtool: link: g++ -dynamiclib  -o liboctave/.libs/liboctave.8.dylib  liboctave/.libs/liboctave_la-liboctave-build-info.o liboctave/.libs/liboctave_la-version.o   -Wl,-force_load,liboctave/array/.libs/libarray.a -Wl,-force_load,liboctave/external/blas-xtra/.libs/libxerbla.a -Wl,-force_load,liboctave/external/ranlib/.libs/libranlib.a -Wl,-force_load,liboctave/external/.libs/libexternal.a -Wl,-force_load,liboctave/numeric/.libs/libnumeric.a -Wl,-force_load,liboctave/operators/.libs/liboperators.a -Wl,-force_load,liboctave/system/.libs/libsystem.a -Wl,-force_load,liboctave/util/.libs/libutil.a -Wl,-force_load,liboctave/wrappers/.libs/libwrappers.a -Wl,-force_load,libgnu/.libs/libgnu.a  -L/opt/local/lib -lcurl -larpack -lfftw3_threads -lfftw3 -lfftw3f_threads -lfftw3f -llapack -lblas -lncurses -lpcre -ldl -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin20/10.2.0 -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin20/10.2.0/../../.. -lgfortran -lquadmath -liconv -lm  -pthread -fopenmp -g -O2 -Wl,-framework -Wl,CoreFoundation   -pthread -fopenmp -install_name  /opt/octave-6.2.0/lib/octave/7.0.0/liboctave.8.dylib -compatibility_version 9 -current_version 9.0 -Wl,-single_module
Undefined symbols for architecture x86_64:
  "_cgejsv_", referenced from:
      __ZN6octave4math3svdI18FloatComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIfEiPfS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_ in libnumeric.a(libnumeric_la-svd.o)
  "_iconv", referenced from:
      _iconv_carefully_1 in libgnu.a(striconveh.o)
      _mem_cd_iconveh_internal in libgnu.a(striconveh.o)
     (maybe you meant: _str_iconveh, _iconveh_close , _octave_iconv_close_wrapper , _octave_iconv_open_wrapper , _mem_iconveh , _mem_cd_iconveh , _str_iconveha , _iconveh_open , _str_cd_iconveh , _mem_iconveha )
  "_iconv_close", referenced from:
      _octave_iconv_close_wrapper in libwrappers.a(libwrappers_la-iconv-wrappers.o)
      _iconveh_open in libgnu.a(striconveh.o)
      _iconveh_close in libgnu.a(striconveh.o)
     (maybe you meant: _octave_iconv_close_wrapper)
  "_iconv_open", referenced from:
      _octave_iconv_open_wrapper in libwrappers.a(libwrappers_la-iconv-wrappers.o)
      _iconveh_open in libgnu.a(striconveh.o)
     (maybe you meant: _octave_iconv_open_wrapper)
  "_zgejsv_", referenced from:
      __ZN6octave4math3svdI13ComplexMatrixE5gejsvERcS4_S4_S4_S4_S4_iiPSt7complexIdEiPdS7_S7_iRSt6vectorIS6_SaIS6_EERiRS9_IiSaIiEESD_ in libnumeric.a(libnumeric_la-svd.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

My configure and make script is as follows:

#!/opt/local/bin/bash

OPENBLAS_PATH=/opt/openblas

export V=1

CC=gcc
CXX=g++
FC=gfortran
CFLAGS="-I/opt/local/include -I${OPENBLAS_PATH}/include"
CXXFLAGS="-I/opt/local/include -I${OPENBLAS_PATH}/include"
FFLAGS="-I/opt/local/include -I${OPENBLAS_PATH}/include"
LDFLAGS="-L${OPENBLAS_PATH}/lib -lopenblas -L/opt/local/lib -liconv"

../configure --prefix=/opt/octave-6.2.0 --disable-readline --without-qt --without-x --with-libiconv-prefix=/opt/local

make -j 4

## @eof octave-install.sh

I also attach the `config.log` file for completeness. It seems to me neither OpenBLAS, not iconv get picked up by the configure script. Maybe I have to modify the makefile directly?

Best wishes,
Maxim



Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

On 11 Mar 2021, at 12:36, Maxim Abalenkov <[hidden email]> wrote:

Dear all,

Please find the `config.log` file attached (Octave with Intel MKL @ the backend). My configure and build script is as follows:

#!/opt/local/bin/bash

export V=1

CC=gcc
CXX=g++
FC=gfortran
CFLAGS="-I/opt/local/include -m64 -I${MKLROOT}/include"
CXXFLAGS="-I/opt/local/include -m64 -I${MKLROOT}/include"
FFLAGS="-I/opt/local/include -m64 -I${MKLROOT}/include"
LDFLAGS="-L${MKLROOT}/lib -Wl,-rpath,${MKLROOT}/lib -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl -L/opt/local/lib -liconv -L/opt/local/lib -lfl"

../configure --prefix=/opt/octave-6.2.0 --disable-readline --without-qt --without-x

make -j 4

Best wishes,
Maxim

<config.log>

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

On 11 Mar 2021, at 12:32, Maxim Abalenkov <[hidden email]> wrote:

Dear all,

Thank you for all you help and your suggestions. Now I see, why linking Octave against Intel’s MKL @ macOS was a theoretical debate. I’m failing here right at the configuration stage. Please find my `config.log` file attached. I would be happy to help here and try further if you can provide me with some guidance. I think MKL at the backend would make Octave only stronger.

Regarding of my original issue of compiling Octave from source @ macOS I think for now I will follow an easier route and try to link it against the “standard” OpenBLAS. I need to progress in my project and make my life a little bit easier. I will get back to you once I try the "OpenBLAS compilation”. Thank you for your help and have a good day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

On 9 Mar 2021, at 17:21, Andrew Janke <[hidden email]> wrote:



On 3/9/21 9:36 AM, Maxim Abalenkov wrote:
Dear all,

Thank you very much for your help and your replies. Please find below
the contents of my configure and build bash script:

As you may see I’m trying to point Octave to Intel’s MKL BLAS and GNU
iconv library located in /opt/local/lib.

You are the only person I'm aware of who has *actually* tried to build
Octave against Intel MKL on Mac; up until now this has just been a
theoretical discussion as far as I'm aware.

Good luck!

Cheers,
Andrew






config.log (2M) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Octave compilation on macOS 11.2.2 with MacPorts 2.6.4 and GCC 10.2.0]

apjanke-floss


On 3/11/21 12:57 PM, Maxim Abalenkov wrote:
> Dear all,
>
> How are you? All my attempts to compile Octave on a macOS with OpenBLAS
> fail. I still obtain the same error:

The MacPorts Octave port has been updated to Octave 6.2.0 as of a couple
days ago. Can you just install it from the port now instead of doing
your own build?

$ sudo port install octave +openblas

Cheers,
Andrew