About Projects Blog Tags Email GitHub Twitter Press Feed

13 Sep 2012
Yak-shaving to install Julia

Julia is a nifty, young language that’s the hot new thing in data analysis. As their propaganda explains: “The Julia programming language fills this role: it is a flexible dynamic language, appropriate for scientific and numerical computing, with performance comparable to traditional statically-typed languages.”

I had the sheer pleasure of getting to attend a Julia tutorial today from one of its core developers, Stefan Karpinski. God, have you looked at their benchmarks? It’s seriously enticing. Problem was, Julia just didn’t seem to want to install on my computer (Mac OS 10.7.4)!

I went through a few issues along the way to getting Julia installed, so I figure I ought to write this post for the sake of anyone else who might have similar issues they end up googling around on in the future. I hope that what works for me ends up helping you, too!

I cloned the source from Julia’s github repository. Discovered fairly quickly that I had to get a few preliminaries out of the way - time to upgrade XCode and its command line tools, and oh whoops I didn’t have gfortran installed at all.

I grabbed the HPC version of gcc 4.7 , which includes gfortran, and installed it with no issues.

At this point, I had remnant junk getting in the way from trying to run make before realizing I didn’t have gfortran installed yet, which was giving me errors despite having run make cleanall.

The errors:

getarch_2nd.c:37:48: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
        printf("#define GEMM_MULTITHREAD_THRESHOLD\t%ld\n", GEMM_MULTITHREAD_THRESHOLD);
                                                    ~~^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                    %d
1 warning generated.
Undefined symbols for architecture x86_64:
  "__gfortran_set_std", referenced from:
      _MAIN__ in sblat1.o
  "_main", referenced from:
      __start in crt1.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Undefined symbols for architecture x86_64:
  "__gfortran_set_std", referenced from:
      _MAIN__ in dblat1.o
  "_main", referenced from:
      __start in crt1.o
ld: symbol(make[4]: s) not*** [sblat1] Error 1 found 
for architecture x86_64
make[4]: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
make[4]: *** [dblat1] Error 1
Undefined symbols for architecture x86_64:
  "__gfortran_set_std", referenced from:
      _MAIN__ in cblat1.o
  "_main", referenced from:
      __start in crt1.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Undefined symbols for architecture x86_64:
  "__gfortran_set_std", referenced from:
      _MAIN__ in zblat1.o
  "_main", referenced from:
    make[4]:   *** [cblat1] Error 1__start
 in crt1.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[4]: *** [zblat1] Error 1
make[3]: *** [tests] Error 2
make[2]: *** [openblas-v0.2.3/libopenblas.dylib] Error 2
make[1]: *** [julia-release] E

Ooft. Why am I putting up with this? Oh, right! Stefan had a great line earlier: “We’re dragging Matlab users halfway to Haskell.”

So, anyways. Stefan suggested just blasting away openblas and rebuilding that alone from scratch, which went well. Basically, just rm -rf /code/julia/deps/openblas-v0.2.3 (or wherever you cloned it to, &c) and then reinstall that dependency alone from its tarball in /deps. Great, that helped move things forward!

My problems weren’t over yet, though:

dyld: Symbol not found: __cg_jpeg_resync_to_restart 
Referenced from: 
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO 
 Expected in: /usr/local/lib/libJPEG.dylib 

Julia just wasn’t finding what it was looking for in that library, gah. Some googling around led me to this post from 2010.

Oh, it’s a macports-related bug! I’d nearly forgotten that I ever used macports, I’ve gotten so used to homebrew at this point. Right. Apple wants something found only in the Apple version of libJPEG, but was looking for it in the ports version. That’s fixable.

And so, after fixing up the links as follows, I was finally able to get Julia installed:

sudo ln -sf /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib /usr/local/lib/libjpeg.dylib

and

sudo ln -sf /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib /usr/local/lib/libtiff.dylib

Cool beans. Hope this helps!

About Projects Blog Tags Email GitHub Twitter Press Feed