Help compiling from source on Mavericks

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
centesimiae
Posts: 18
Joined: 2014-03-14T10:10:54-07:00
Authentication code: 6789

Help compiling from source on Mavericks

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help compiling from source on Mavericks

Post by fmw42 »

What version of IM are you trying to install?
centesimiae
Posts: 18
Joined: 2014-03-14T10:10:54-07:00
Authentication code: 6789

Re: Help compiling from source on Mavericks

Post 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.
centesimiae
Posts: 18
Joined: 2014-03-14T10:10:54-07:00
Authentication code: 6789

Re: Help compiling from source on Mavericks

Post 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.
centesimiae
Posts: 18
Joined: 2014-03-14T10:10:54-07:00
Authentication code: 6789

Re: Help compiling from source on Mavericks

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help compiling from source on Mavericks

Post 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.
centesimiae
Posts: 18
Joined: 2014-03-14T10:10:54-07:00
Authentication code: 6789

Re: Help compiling from source on Mavericks

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help compiling from source on Mavericks

Post 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.
centesimiae
Posts: 18
Joined: 2014-03-14T10:10:54-07:00
Authentication code: 6789

Re: Help compiling from source on Mavericks

Post 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!
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: Help compiling from source on Mavericks

Post 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.)
Last edited by 246246 on 2015-08-04T06:29:43-07:00, edited 1 time in total.
centesimiae
Posts: 18
Joined: 2014-03-14T10:10:54-07:00
Authentication code: 6789

Re: Help compiling from source on Mavericks

Post 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"
centesimiae
Posts: 18
Joined: 2014-03-14T10:10:54-07:00
Authentication code: 6789

Re: Help compiling from source on Mavericks

Post 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
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: Help compiling from source on Mavericks

Post 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
centesimiae
Posts: 18
Joined: 2014-03-14T10:10:54-07:00
Authentication code: 6789

Re: Help compiling from source on Mavericks

Post 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.
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: Help compiling from source on Mavericks

Post 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, ']'.
Last edited by 246246 on 2015-08-04T06:50:31-07:00, edited 2 times in total.
Post Reply