Page 1 of 2

Help compiling from source on Mavericks

Posted: 2015-08-03T16:09:22-07:00
by centesimiae
I want enabled ImageMagick on Mac OS X and have been following these instructions without problems until now.

In a nutshell here is what I am doing

1. Install ImageMagick with MacPorts
2. Install openmp enabled gcc (hpc.sourceforge.net)
3. compile ImageMagick from source and use dependencies from MacPorts
./configure --prefix=/opt/local CC=/usr/local/bin/gcc CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' --with-modules —-enable-openmp --with-threads

make
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
CC coders/coders_aai_la-aai.lo
CC magick/magick_libMagickCore_6_Q16_la-animate.lo
CC magick/magick_libMagickCore_6_Q16_la-channel.lo
CC magick/magick_libMagickCore_6_Q16_la-compare.lo
CC magick/magick_libMagickCore_6_Q16_la-composite.lo
CC magick/magick_libMagickCore_6_Q16_la-distribute-cache.lo
CC magick/magick_libMagickCore_6_Q16_la-display.lo
CC magick/magick_libMagickCore_6_Q16_la-feature.lo
CC magick/magick_libMagickCore_6_Q16_la-identify.lo
CC magick/magick_libMagickCore_6_Q16_la-image.lo
CC magick/magick_libMagickCore_6_Q16_la-image-view.lo
CC magick/magick_libMagickCore_6_Q16_la-log.lo
CC magick/magick_libMagickCore_6_Q16_la-magick.lo
CC magick/magick_libMagickCore_6_Q16_la-module.lo
CC magick/magick_libMagickCore_6_Q16_la-montage.lo
CC magick/magick_libMagickCore_6_Q16_la-property.lo
CC magick/magick_libMagickCore_6_Q16_la-resize.lo
CC magick/magick_libMagickCore_6_Q16_la-static.lo
CC magick/magick_libMagickCore_6_Q16_la-statistic.lo
CC magick/magick_libMagickCore_6_Q16_la-version.lo
CC magick/magick_libMagickCore_6_Q16_la-xwindow.lo
CCLD magick/libMagickCore-6.Q16.la
CCLD coders/aai.la
./libtool: eval: line 1099: syntax error near unexpected token `|'
./libtool: eval: line 1099: `/usr/local/bin/nm -B coders/.libs/coders_aai_la-aai.o | | /usr/bin/sed 's/.* //' | sort | uniq > coders/.libs/aai.exp'
make[1]: *** [coders/aai.la] Error 1
make: *** [all] Error 2


But I keep getting this error when compiling. I'm at a loss to figure out what's going on. Please help if you know what's wrong.

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T16:37:39-07:00
by fmw42
What version of IM are you trying to install?

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T17:14:34-07:00
by centesimiae
6.9.9-10. I just tried 6.8.9-10, which is what I did before, but now it isn't working either with the same error. I know I have a weird setup, but it worked before and now not.

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T17:16:32-07:00
by centesimiae
./libtool: eval: line 1099: `/usr/local/bin/nm -B coders/.libs/coders_aai_la-aai.o * | | /usr/bin/sed 's/.* //' | sort | uniq > coders/.libs/aai.exp'

The error is there are two spaces between the "||" in the or shell script.

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T17:44:03-07:00
by centesimiae
I just tried it on one of my production system that is still on 10.8 and the same set of steps works with 6.9.1-10 source. My dev machine in 10.9, and broken.

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T18:09:56-07:00
by fmw42
centesimiae wrote:6.9.9-10. I just tried 6.8.9-10, which is what I did before, but now it isn't working either with the same error. I know I have a weird setup, but it worked before and now not.
I assume you mean 6.9.1.10. There is no 6.9.9.10, yet.

I am still on OSX 10.6.8 snow leopard and I use the same process as described at viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202

Sorry, I think the IM developers will need to see what is going on here.

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T20:18:49-07:00
by centesimiae
Yes, virtually the same process, except one extra wrinkle. I use a openmp enabled gcc to do the compile from hpc.sourceforge.net. I need openmp, since it seems the opencl support on OS X is spotty at best.

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T20:24:58-07:00
by fmw42
centesimiae wrote:Yes, virtually the same process, except one extra wrinkle. I use a openmp enabled gcc to do the compile from hpc.sourceforge.net. I need openmp, since it seems the opencl support on OS X is spotty at best.

Yes, I understand. I have disabled openMP for my testing. But you can allow it. I think it gets installed by default. So you may not need the --enable-openmp. But I do not think it should hurt to explicitly call it. Do you see any error messages in the configure.log file?


The IM developers will need to check this out. I don't see anything obviously wrong.

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T20:32:01-07:00
by centesimiae
OpenMP does not get installed with MacPorts. Apple dropped support for openmp in XCode 5, I think, either way they dropped it at some point. Apple also dropped support for gcc. I would use OpenCL, but like I said, it doesn't work on all Macs. Either way, I need a special compiler for OpenMP support and this was the best way I was able to achieve what I needed. Now a niggling typo seems to have me gnawing away at my shin bones... Everything is still fine and dandy on 10.8. The same procedure still yields the same results on 10.8, yet not on 10.9. I did a diff on Makefile and libtool on the 10.8 vs. 10.9 system and they are indeed different so something has changed in configure. And I don't know if I'm up to the challenge... there be dragons!

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T20:44:54-07:00
by 246246
What dose it returns?

Code: Select all

$ fgrep 'sort | uniq' `which libtool`
Between nm and sed, there must be \$global_symbol_pipe, that is somehow missing during configure.

[EDIT]
As the make executing "./libtool", check ./libtool instead of `which libtool`
(Current directory is the top of the soruce.)

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T20:58:56-07:00
by centesimiae
fgrep 'sort | uniq' libtool
export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T21:11:48-07:00
by centesimiae
Yes, \$global_symbol_pipe is "" in libtool. Replacing it with with /bin/cat produces:

/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
CCLD coders/aai.la
Undefined symbols for architecture x86_64:
"_EH_frame1", referenced from:
-exported_symbol[s_list] command line option
"_LC0", referenced from:
-exported_symbol[s_list] command line option
"_LC11", referenced from:
-exported_symbol[s_list] command line option
"_LC12", referenced from:
-exported_symbol[s_list] command line option
"_LC13", referenced from:
-exported_symbol[s_list] command line option
"_LC14", referenced from:
-exported_symbol[s_list] command line option
"_LC15", referenced from:
-exported_symbol[s_list] command line option
"_LC16", referenced from:
-exported_symbol[s_list] command line option
"_LC18", referenced from:
-exported_symbol[s_list] command line option
"_LC19", referenced from:
-exported_symbol[s_list] command line option
"_LC2", referenced from:
-exported_symbol[s_list] command line option
"_LC3", referenced from:
-exported_symbol[s_list] command line option
"_LC4", referenced from:
-exported_symbol[s_list] command line option
"_LC5", referenced from:
-exported_symbol[s_list] command line option
"_LC6", referenced from:
-exported_symbol[s_list] command line option
"_LC7", referenced from:
-exported_symbol[s_list] command line option
"_LC8", referenced from:
-exported_symbol[s_list] command line option
"_LC9", referenced from:
-exported_symbol[s_list] command line option
"__AcquireImage", referenced from:
-exported_symbol[s_list] command line option
"__AcquireNextImage", referenced from:
-exported_symbol[s_list] command line option
"__AcquireQuantumMemory", referenced from:
-exported_symbol[s_list] command line option
"__CloseBlob", referenced from:
-exported_symbol[s_list] command line option
"__ConstantString", referenced from:
-exported_symbol[s_list] command line option
"__DestroyImageList", referenced from:
-exported_symbol[s_list] command line option
"__DestroyString", referenced from:
-exported_symbol[s_list] command line option
"__EOFBlob", referenced from:
-exported_symbol[s_list] command line option
"__FormatLocaleString", referenced from:
-exported_symbol[s_list] command line option
"__GetBlobSize", referenced from:
-exported_symbol[s_list] command line option
"__GetExceptionMessage", referenced from:
-exported_symbol[s_list] command line option
"__GetFirstImageInList", referenced from:
-exported_symbol[s_list] command line option
"__GetImageListLength", referenced from:
-exported_symbol[s_list] command line option
"__GetNextImageInList", referenced from:
-exported_symbol[s_list] command line option
"__GetVirtualPixels", referenced from:
-exported_symbol[s_list] command line option
"__InheritException", referenced from:
-exported_symbol[s_list] command line option
"__LoadImageTag", referenced from:
-exported_symbol[s_list] command line option
"__LoadImagesTag", referenced from:
-exported_symbol[s_list] command line option
"__LogMagickEvent", referenced from:
-exported_symbol[s_list] command line option
"__OpenBlob", referenced from:
-exported_symbol[s_list] command line option
"__QueueAuthenticPixels", referenced from:
-exported_symbol[s_list] command line option
"__ReadAAIImage", referenced from:
-exported_symbol[s_list] command line option
"__ReadBlob", referenced from:
-exported_symbol[s_list] command line option
"__ReadBlobLSBLong", referenced from:
-exported_symbol[s_list] command line option
"__RegisterAAIImage", referenced from:
-exported_symbol[s_list] command line option
"__RegisterMagickInfo", referenced from:
-exported_symbol[s_list] command line option
"__RelinquishMagickMemory", referenced from:
-exported_symbol[s_list] command line option
"__SaveImageTag", referenced from:
-exported_symbol[s_list] command line option
"__SaveImagesTag", referenced from:
-exported_symbol[s_list] command line option
"__SetImageExtent", referenced from:
-exported_symbol[s_list] command line option
"__SetImageProgress", referenced from:
-exported_symbol[s_list] command line option
"__SetMagickInfo", referenced from:
-exported_symbol[s_list] command line option
"__SyncAuthenticPixels", referenced from:
-exported_symbol[s_list] command line option
"__SyncNextImageInList", referenced from:
-exported_symbol[s_list] command line option
"__TellBlob", referenced from:
-exported_symbol[s_list] command line option
"__ThrowMagickException", referenced from:
-exported_symbol[s_list] command line option
"__TransformImageColorspace", referenced from:
-exported_symbol[s_list] command line option
"__UnregisterAAIImage", referenced from:
-exported_symbol[s_list] command line option
"__UnregisterMagickInfo", referenced from:
-exported_symbol[s_list] command line option
"__WriteAAIImage", referenced from:
-exported_symbol[s_list] command line option
"__WriteBlob", referenced from:
-exported_symbol[s_list] command line option
"__WriteBlobLSBLong", referenced from:
-exported_symbol[s_list] command line option
"____assert_rtn", referenced from:
-exported_symbol[s_list] command line option
"____error", referenced from:
-exported_symbol[s_list] command line option
"____func__.10514", referenced from:
-exported_symbol[s_list] command line option
"____func__.10543", referenced from:
-exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [coders/aai.la] Error 1
make: *** [all] Error 2

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T21:15:36-07:00
by 246246
(I'm not using MacOS, but this happened in many unix.)
I think just remove "| \$global_symbol_pipe" from libtool (that is ascii text shell) might work. Of course it's a temporary workaround.
(Or check the make output from 10.8 and do the same manually at that point.)
See http://permalink.gmane.org/gmane.comp.g ... .bugs/8441

And if necessary, check here what global_symbol_pipe is trying to do.
https://developer.apple.com/library/mac ... ol_13.html

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T21:16:14-07:00
by centesimiae
You've exactly described the problem. I replaced both Makefile and libtool in the source directory from a system that was on 10.8 and compiled with the above procedure fine and everything is working now.

Re: Help compiling from source on Mavericks

Posted: 2015-08-03T21:20:27-07:00
by 246246
centesimiae wrote:Yes, \$global_symbol_pipe is "" in libtool. Replacing it with with /bin/cat produces:

/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
CCLD coders/aai.la
Undefined symbols for architecture x86_64:
"_EH_frame1", referenced from:
-exported_symbol[s_list] command line option
Hmm, it is not so simple.
Adding --disable-silent-rules to configure, it shows the real command, that would be your help.
I think what you need to do is convert nm output to proper format.

[EDIT]
As I'm not using Mac, this is linux case, but it will be still of your help.

In my case \$global_symbol_pipe is defined as the following:

Code: Select all

global_symbol_pipe="sed -n -e 's/^.*[	 ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[	 ][	 ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
So,

Code: Select all

$ /usr/bin/nm -B  coders/.libs/coders_aai_la-aai.o | sed -n -e 's/^.*[	 ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[	 ][	 ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | sed '/ __gnu_lto/d'
T RegisterAAIImage RegisterAAIImage
T UnregisterAAIImage UnregisterAAIImage
is required output from $global_symbol_pipe, and final file should be:

Code: Select all

$ /usr/bin/nm -B coders/.libs/coders_aai_la-aai.o | sed -n -e 's/^.*[	 ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[	 ][	 ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | sed '/ __gnu_lto/d' | /bin/sed 's/.* //' | sort | uniq 
RegisterAAIImage
UnregisterAAIImage
Note: TAB is not properly shown in this forum.
[ ] is a sequence of '[', TAB, SPACE, ']'.