Opened 4 months ago

Last modified 4 months ago

#70041 new defect

octave-fits build failure: error: passing 'const NDArray' as 'this' argument discards qualifiers

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.9.3
Keywords: Cc: Schamschula (Marius Schamschula)
Port: octave-fits

Description

mkoctfile --verbose -Wall -L/opt/local/lib -lcfitsio read_fits_image.cc
/opt/local/bin/g++-mp-13 -c -I/opt/local/include  -I/opt/local/include/octave-9.1.0/octave/.. -I/opt/local/include/octave-9.1.0/octave -I/opt/local/include  -pthread -pipe -Os -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc  -Wall   read_fits_image.cc -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_octave_octave-fits/octave-fits/work/.tmp/oct-eBdrXz.o
/opt/local/bin/g++-mp-13 -I/opt/local/include/octave-9.1.0/octave/.. -I/opt/local/include/octave-9.1.0/octave -I/opt/local/include  -pthread -pipe -Os -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc  -Wall -o read_fits_image.oct  /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_octave_octave-fits/octave-fits/work/.tmp/oct-eBdrXz.o   -L/opt/local/lib -lcfitsio -bundle -undefined dynamic_lookup -bind_at_load -bundle_loader /opt/local/bin/octave-9.1.0 -L/opt/local/lib/octave/9.x.x -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc  -Wl,-headerpad_max_install_names -L/opt/local/lib -lMacportsLegacySupport -Wl,-rpath,/opt/local/lib/libgcc -arch ppc -loctinterp -loctave
ld: warning: in /opt/local/bin/octave-9.1.0, file was built for unsupported file format which is not the architecture being linked (ppc)
mkoctfile --verbose -Wall -L/opt/local/lib -lcfitsio save_fits_image.cc
/opt/local/bin/g++-mp-13 -c -I/opt/local/include  -I/opt/local/include/octave-9.1.0/octave/.. -I/opt/local/include/octave-9.1.0/octave -I/opt/local/include  -pthread -pipe -Os -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc  -Wall   save_fits_image.cc -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_octave_octave-fits/octave-fits/work/.tmp/oct-t0EpK7.o
save_fits_image.cc: In function 'octave_value_list Fsave_fits_image(const octave_value_list&, int)':
save_fits_image.cc:132:58: error: passing 'const NDArray' as 'this' argument discards qualifiers [-fpermissive]
  132 |   double * datap = const_cast<double*>( image.fortran_vec() );
      |                                         ~~~~~~~~~~~~~~~~~^~
In file included from /opt/local/include/octave-9.1.0/octave/../octave/Array-util.h:31,
                 from /opt/local/include/octave-9.1.0/octave/../octave/MSparse.h:31,
                 from /opt/local/include/octave-9.1.0/octave/../octave/MatrixType.h:33,
                 from /opt/local/include/octave-9.1.0/octave/../octave/mx-base.h:33,
                 from /opt/local/include/octave-9.1.0/octave/../octave/Matrix.h:34,
                 from /opt/local/include/octave-9.1.0/octave/../octave/oct.h:33,
                 from save_fits_image.cc:19:
/opt/local/include/octave-9.1.0/octave/../octave/Array.h:666:20: note:   in call to 'T* Array<T, Alloc>::fortran_vec() [with T = double; Alloc = std::allocator<double>]'
  666 |   OCTARRAY_API T * fortran_vec ();
      |                    ^~~~~~~~~~~
make: *** [save_fits_image.oct] Error 1

pkg: error running 'make' for the fits package
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_octave_octave-fits/octave-fits/work/fits" && /usr/bin/arch -arch $OCTAVE_ARCH /opt/local/bin/octave-cli -q -f -H --eval 'try; pkg build -verbose -nodeps /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_octave_octave-fits/octave-fits/work/tmp-build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_octave_octave-fits/octave-fits/work/fits-1.0.7.tar.gz; catch; disp(lasterror.message); exit(1); end_try_catch;' 
Exit code: 1
  1. S. Warning about a wrong arch is bogus, because it is a script, not a binary:
    36-244% file /opt/local/bin/octave-9.1.0
    /opt/local/bin/octave-9.1.0: Bourne-Again shell script, ASCII text executable
    

Change History (2)

comment:1 in reply to:  description ; Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to barracuda156:

  1. S. Warning about a wrong arch is bogus, because it is a script, not a binary:

If it's a script, then it's bogus to try to include it in a compiled executable.

comment:2 in reply to:  1 Changed 4 months ago by barracuda156

Replying to ryandesign:

Replying to barracuda156:

  1. S. Warning about a wrong arch is bogus, because it is a script, not a binary:

If it's a script, then it's bogus to try to include it in a compiled executable.

I am not really familiar with octave internals, I just meant that this warning is irrelevant to the issue reported here.

By the way, with Clang the build just fails on the same spot: https://github.com/macports/macports-ports/pull/24040#issuecomment-2121705468

Note: See TracTickets for help on using tickets.