MacPorts installation fails on MacOS Sierra

Added by Juuso Tamminen about 8 years ago

Macports installation fails on MacOS Sierra due opencv dependency which is broken. I managed to install opencv with modification to portfile (-DBUILD_opencv_videoio=OFF) and opencv 3.1.0 build succeeded. Auto Multiple Choice still won't build.

I get following errors:

:info:build /usr/bin/clang -arch x86_64 -o AMC-detect AMC-detect.cc  -O2 -I/opt/local/include -I. -DNEEDS_GETLINE -L/opt/local/lib   -lstdc++ -lm -I/opt/local/include/opencv -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs 
:info:build AMC-detect.cc:148:6: error: use of undeclared identifier 'CV_LOAD_IMAGE_ANYCOLOR'
:info:build                           CV_LOAD_IMAGE_ANYCOLOR
:info:build                           ^
:info:build AMC-detect.cc:174:36: error: use of undeclared identifier 'CV_LOAD_IMAGE_GRAYSCALE'
:info:build     if((*src=cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE))==NULL) {
:info:build                                    ^
:info:build AMC-detect.cc:453:5: error: use of undeclared identifier 'cvConvertImage'; did you mean 'cvConvertScale'?
:info:build     cvConvertImage(src,*dst);
:info:build     ^~~~~~~~~~~~~~
:info:build     cvConvertScale
:info:build /opt/local/include/opencv2/core/core_c.h:1018:14: note: 'cvConvertScale' declared here
:info:build CVAPI(void)  cvConvertScale( const CvArr* src, CvArr* dst,
:info:build              ^
:info:build AMC-detect.cc:725:31: error: use of undeclared identifier 'CV_IMWRITE_PNG_COMPRESSION'
:info:build   static int save_options[3]={CV_IMWRITE_PNG_COMPRESSION,7,0};
:info:build                               ^
:info:build AMC-detect.cc:912:7: error: use of undeclared identifier 'cvSaveImage'
:info:build           if(cvSaveImage(zoom_file,illustr
:info:build              ^
:info:build AMC-detect.cc:979:24: error: use of undeclared identifier 'CV_IMWRITE_JPEG_QUALITY'
:info:build   int save_options[3]={CV_IMWRITE_JPEG_QUALITY,75,0};
:info:build                        ^
:info:build AMC-detect.cc:1042:35: error: use of undeclared identifier 'CV_LOAD_IMAGE_COLOR'
:info:build           illustr=cvLoadImage(scan_file, CV_LOAD_IMAGE_COLOR);
:info:build                                          ^
:info:build AMC-detect.cc:1208:8: error: use of undeclared identifier 'cvSaveImage'
:info:build     if(cvSaveImage(out_image_file,illustr
:info:build        ^
:info:build 8 errors generated.
:info:build make: *** [AMC-detect] Error 1
:info:build make: Leaving directory

Any ideas?


Replies (8)

RE: MacPorts installation fails on MacOS Sierra - Added by Alexis Bienvenüe about 8 years ago

Did you try with the very last revision (hg:d6719412b9a3)? There were some little changes with AMC-detect.cc

RE: MacPorts installation fails on MacOS Sierra - Added by Juuso Tamminen about 8 years ago

I'm trying to build it through MacPorts, so how do I get the latest development version from there?

Cloned the repository and tried to build it and it also fails...

gcc -o AMC-detect AMC-detect.cc  -O2   -lstdc++ -lm -I/usr/local/Cellar/opencv/2.4.13.1/include/opencv -I/usr/local/Cellar/opencv/2.4.13.1/include -L/usr/local/Cellar/opencv/2.4.13.1/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab
gcc -o AMC-buildpdf AMC-buildpdf.cc  -O2   -lstdc++ -lm -D_REENTRANT -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include -I/opt/local/include/pango-1.0 -I/opt/local/include/poppler/glib -I/opt/local/include/poppler -I/opt/local/include/cairo -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include -L/opt/local/lib -lpangocairo-1.0 -lpango-1.0 -lpoppler-glib -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lcairo -I/usr/local/Cellar/opencv/2.4.13.1/include/opencv -I/usr/local/Cellar/opencv/2.4.13.1/include -L/usr/local/Cellar/opencv/2.4.13.1/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab
rsvg-convert -w 32 -h 32 icons/auto-multiple-choice.svg -o icons/auto-multiple-choice.png
pngtopnm icons/auto-multiple-choice.png | ppmtoxpm > icons/auto-multiple-choice.xpm
ppmtoxpm: (Computing colormap...
ppmtoxpm: ...Done.  41 colors found.)
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C doc
case auto-multiple-choice.en.xml in \
       *.ja.xml) dblatex -P latex.encoding=utf8 -b xetex -t tex -p custom.xsl --texstyle=amcdocstyle --xslt-opts="--nonet" --xslt-opts="--catalogs"  auto-multiple-choice.en.xml -o auto-multiple-choice.en.tex ;; \
       *.xml) dblatex -t tex -p custom.xsl --texstyle=amcdocstyle --xslt-opts="--nonet" --xslt-opts="--catalogs"  auto-multiple-choice.en.xml -o auto-multiple-choice.en.tex ;; \
     esac
/bin/sh: dblatex: command not found
make[1]: *** [auto-multiple-choice.en.tex] Error 127
make: *** [doc] Error 2
rm icons/auto-multiple-choice.png

RE: MacPorts installation fails on MacOS Sierra - Added by Juuso Tamminen about 8 years ago

... and after installing dblatex using MacPorts it still won't build...

pdftk uncompress error: No such file or directory at ../reproducible-pdf.pl line 38.
make[1]: *** [auto-multiple-choice.fr.pdf] Error 2
rm img_pdf/warning.pdf img_pdf/note.pdf auto-multiple-choice.fr.tex img_pdf/important.pdf
make: *** [doc] Error 2

RE: MacPorts installation fails on MacOS Sierra - Added by Alexis Bienvenüe about 8 years ago

You can skip reproducible-pdf.pl without too much damage, adding a line

exit 0;

as the first non-commented line from reproducible_pdf.pl (in AMC source directory).

RE: MacPorts installation fails on MacOS Sierra - Added by Alexis Bienvenüe about 8 years ago

Or use

AMCCONF=macports make

for building.

RE: MacPorts installation fails on MacOS Sierra - Added by Juuso Tamminen about 8 years ago

Nope, still not building...

$AMCCONF=macports make
Recording substitution variables from ./Makefile.versions ./Makefile.conf ./Makefile-macports.conf
perl -p vars-subs.pl auto-multiple-choice.in > auto-multiple-choice
perl -p vars-subs.pl auto-multiple-choice.desktop.in > auto-multiple-choice.desktop
perl -p vars-subs.pl AMC-gui-apropos.glade.in > AMC-gui-apropos.glade
perl -p vars-subs.pl AMC-gui.pl.in > AMC-gui.pl
perl -p vars-subs.pl AMC-latex-link.pl.in > AMC-latex-link.pl
perl -p vars-subs.pl AMC-perl/AMC/Basic.pm.in > AMC-perl/AMC/Basic.pm
perl -p vars-subs.pl doc/doc-xhtml-site.fr.xsl.in > doc/doc-xhtml-site.fr.xsl
perl -p vars-subs.pl doc/doc-xhtml-site.ja.xsl.in > doc/doc-xhtml-site.ja.xsl
perl -p vars-subs.pl doc/doc-xhtml-site.en.xsl.in > doc/doc-xhtml-site.en.xsl
perl -p vars-subs.pl doc/amcdocstyle.sty.in > doc/amcdocstyle.sty
perl -p vars-subs.pl doc/doc-xhtml.xsl.in > doc/doc-xhtml.xsl
perl -p vars-subs.pl doc/auto-multiple-choice.en.in.xml > doc/auto-multiple-choice.en.xml
perl -p vars-subs.pl doc/auto-multiple-choice.fr.in.xml > doc/auto-multiple-choice.fr.xml
perl -p vars-subs.pl doc/auto-multiple-choice.ja.in.xml > doc/auto-multiple-choice.ja.xml
perl -p vars-subs.pl doc/sty/automultiplechoice.dtx.in > doc/sty/automultiplechoice.dtx
gcc -o AMC-detect AMC-detect.cc  -O2 -I/opt/local/include -I. -DNEEDS_GETLINE -L/opt/local/lib   -lstdc++ -lm -I/opt/local/include/opencv -lopencv_core -lopencv_highgui -lopencv_imgproc
Undefined symbols for architecture x86_64:
  "_cvConvertImage", referenced from:
      calage(_IplImage*, _IplImage*, double, double, double, double, double, int, double*, double*, _IplImage**, int) in AMC-detect-b658d3.o
  "_cvLoadImage", referenced from:
      load_image(_IplImage**, char*, int, double, int) in AMC-detect-b658d3.o
      _main in AMC-detect-b658d3.o
  "_cvSaveImage", referenced from:
      mesure_case(_IplImage*, _IplImage*, int, int, int, int, int, double, int, double, double, double, double, linear_transform*, point*, _IplImage*, char*, int) in AMC-detect-b658d3.o
      _main in AMC-detect-b658d3.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [AMC-detect] Error 1

RE: MacPorts installation fails on MacOS Sierra - Added by Alexis Bienvenüe about 8 years ago

OK, with OpenCV3, you need something else…
You can try

AMCCONF=macports GCC_OPENCV_LIBS=" -lopencv_core -lopencv_imgproc -lopencv_imgcodecs " make

But I'm not the right one to help you with OSX… maybe you can find some hints in the related French threads: OSX Sierra, [MacOS] erreur à la compilation de mac-devel , Installation de la version de développement d'AMC sous OS X Mountain Lion.

RE: MacPorts installation fails on MacOS Sierra - Added by Joël Brogniart about 8 years ago

Hi,

Installation of last version of AMC on macOS 10.12.1 works now. The opencv port was updated on MacPorts and there is no need to try another type of installation, MacPorts does the job. The installation still need an adapted version of GCC5 and pdftk that provoke a long, a very long installation. But once installed all works.

Installation pages on the wiki where updated.

English version : Building_AMC_for_MAC_OSX.
French version : Installation_de_la_version_de_développement_d'AMC_sous_OS_X,

(1-8/8)