Posts Tagged ‘macports’

Transparent gradients in included pdfs using pdflatex lost by Preview.app

Thursday, August 22nd, 2013

I’m running into this issue again. pdflatex on mac os x installed using macports via texlive somehow garbles pdfs with transparent gradients so that they don’t view correctly with Preview.app. The original PDF looks correct with my Preview.app: linear gradient fails with pdflatex on mac with preview

Try compiling a small test document:

\documentclass{article}
\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics[width=\linewidth]{white2green.jpg}
\includegraphics[width=\linewidth]{{{white2green1.7}}}
\includegraphics[width=\linewidth]{{{white2green1.3}}}
\end{figure}
\end{document}

For me the middle image doesn’t show up correctly. Of course the jpg does, but it’s pure raster. The last image is a pdf, but it’s a hacky solution. If you save your pdf with linear gradients in Illustrator as Compatibility: Acrobat 4 (PDF 1.3) then Illustrator will raster your transparency. It does a halfway decent job and it seems that the pdf is forward compatible: you can still edit it in Illustrator as vector graphics.

Determine Eigen version with grep

Friday, August 16th, 2013

Here’s a small bash one-liner to determine the version of Eigen you have install with macports:


grep "#define EIGEN_[^_]*_VERSION" /usr/local/include/eigen3/Eigen/src/Core/util/Macros.h

Issuing this you should see something like:


#define EIGEN_WORLD_VERSION 3
#define EIGEN_MAJOR_VERSION 1
#define EIGEN_MINOR_VERSION 2

which would mean you’re using version 3.1.2.

Macports Boost still incompatible with modern gcc compilers

Wednesday, May 8th, 2013

I recently ran into a well known issue with the macports installation of the boost library. It seems that when you issue:


sudo port install boost

you’re getting binaries of a version of boost compiled using the default compiler g++-apple-4.2. This is version of the library is unfortunately not compatible with any of the modern versions of gcc. For example this small program compiles and links correctly using g++-mp-4.7 but crashes at runtime.


#include <boost/program_options.hpp>
int main(int argc, char* argv[])
{
    boost::program_options::positional_options_description positional;
    return 0;
}

Running the code produces:


.main(33755) malloc: *** error for object 0x10f73b880: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

To fix this I forced macports to reinstall boost using my compiler of choice (g++-mp-4.7). On my computer this took 20+ minutes


sudo port -ns upgrade --force boost configure.compiler=macports-gcc-4.7

This resolves the issue above, but only for g++-mp-4.7, if I now compile my small test program using g++-apple-4.2 it fails in the same way (at least its mutually consistent).

Install ETH Fonts for LaTeX on Mac OS X

Thursday, February 7th, 2013

This turned out to be quite difficult.

I installed TexLive using macports.

If you download the ETH letter LaTeX templates and try to compile you will get an error like:


! I can't find file `letr8t'.
<*> ...:=ljfour; mag:=1; nonstopmode; input letr8t
                                                  
Please type another input file name
! Emergency stop.
<*> ...:=ljfour; mag:=1; nonstopmode; input letr8t
                                                  
Transcript written on mfput.log.
grep: letr8t.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input letr8t' failed to make letr8t.tfm.
kpathsea: Appending font creation commands to missfont.log.
! Font \xiiiv=letr8t at 8.5pt not loadable: Metric (TFM) file not found.
 
                   \relax 
l.112 \newfont{\xiiiv}{letr8t at 8.5pt}

This is complaining that you don’t have the ETH fonts installed. These are a pain to install.

Unzip into your macports texmf folder:


sudo unzip ETHLfnts.zip -d /opt/local/share/texmf/

Create a hash for the new files:


sudo texhash

If you try to compile brief2.tex now you will get an error:


kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 letb8r
mktexpk: don't know how to create bitmap font for letb8r.
mktexpk: perhaps letb8r is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.
(see the transcript file for additional information)
!pdfTeX error: pdflatex (file letb8r): Font letb8r at 600 not found
 ==> Fatal error occurred, no output PDF file produced!

Open and append:


p +let.map

Now compiling should give you the error:


gsftopk: fatal: map file `let.map' not found.
mktexpk: don't know how to create bitmap font for letb8r.
mktexpk: perhaps letb8r is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.
(see the transcript file for additional information)
!pdfTeX error: pdflatex (file letb8r): Font letb8r at 600 not found
 ==> Fatal error occurred, no output PDF file produced!

Create the file /opt/local/etc/texmf/ethfonts.cfg and add the line:


Map let.map

Update maps listing:


sudo updmap-sys

Now if you should get an error like:


ERROR:  The following map file(s) couldn't be found:
	let.map (in /opt/local/var/db/texmf/web2c/updmap.cfg)

If you try to compile brief2.tex you’ll get an error like:


gsftopk: fatal: map file `let.map' not found.
mktexpk: don't know how to create bitmap font for letb8r.
mktexpk: perhaps letb8r is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.
(see the transcript file for additional information)
!pdfTeX error: pdflatex (file letb8r): Font letb8r at 600 not found
 ==> Fatal error occurred, no output PDF file produced!

So, copy let.map to your local texlive directory:


mkdir -p ~/.texlive2012/texmf-var/fonts/map/dvips/updmap/
cp /opt/local/share/texmf/maps/let.map ~/.texlive2012/texmf-var/fonts/map/dvips/updmap/

Update maps listing:


sudo updmap-sys

Now you should be able to successfully build:


pdflatex brief2

Mencoder from macports with x264 support

Thursday, September 8th, 2011

I installed mencoder, via mplayer, using macports. I recently start using the mplayer-devel port because it seemed to have better playback. But the issue had arisen before with the normal mplayer port. The problem occurs when I try to encode videos to a x264 .mp4 file. I see one of the following:


-x264encopts is not an MEncoder option

Couldn't find video filter 'x264'.

The solution seems to be reinstalling mplayer-devel with the +mencoder_extras variant. I upgraded my existing mplayer-devel install using


sudo port upgrade --enforce-variants mplayer-devel +mencoder_extras

Now when I issue:


mencoder -ovc help

I see:


MEncoder UNKNOWN-4.2.1 (C) 2000-2011 MPlayer Team

Available codecs:
   copy     - frame copy, without re-encoding. Doesn't work with filters.
   frameno  - special audio-only file for 3-pass encoding, see DOCS.
   raw      - uncompressed video. Use fourcc option to set format explicitly.
   nuv      - nuppel video
   lavc     - libavcodec codecs - best quality!
   libdv    - DV encoding with libdv v0.9.5
   xvid     - XviD encoding
   x264     - H.264 encoding

Mplayer choppy on Cinema Display

Sunday, September 4th, 2011

I was using mplayer as installed with macports, version 1.0rc4, but it was playing moderately small .avi files choppy on my Cinema Display. Further it was messing up the audio sync. To fix this I first got rid of this mplayer version with:


sudo port deactivate mplayer

Then I installed the development version, which so far is working much better:


sudo port install mplayer-devel

hg pull error

Saturday, May 7th, 2011

I upgraded my mercurial using macports to version 1.8.3 and all of a sudden I got erros when trying to pull my current projects:


abort: error: _ssl.c:490: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

I tried adding the following to the project’s .hg/hgrc file:


[web]
cacerts =

This did not work.

Solution: Add the above to ~/.hgrc not your project’s hgrc.

This works, but now I get a bunch of nasty warnings every time I pull:


warning: subversive.cims.nyu.edu certificate with fingerprint g2:3g:e5:8g:18:f9:g1:6g:gd:d7:3g:08:g0:bb:gb:dg:3a:g8:fg:gd not verified (check hostfingerprints or web.cacerts config setting)

Yet another macports/qt/mac nightmare…

Friday, May 6th, 2011

Today I wasted countless hours recompiling all sorts of junk on my computer. The culprits once again are macports, Qt and Apple’s 32-bit/64-bit androgyny.

I recently upgraded from mac os x 10.5 (where 32-bits is default) to mac os x 10.6 (where 64-bits is default). Macports naturally pretends to work just fine after I make the switch. Low and behold it’s little house on the sand is about to wash away. Today I wanted to upgrade to the latest version of pdflatex. I tried to do so using macports. No go. Eventually I found the “migration” guide for “migrating” you macports after you upgrade from mac os x 10.5 to mac os x 10.6. Their idea of “migration” is uninstalling and reinstalling everything! All of my 300 some ports needed to be recompiled. Their instructions by the way did not work as it didn’t account for external dependencies still hanging around in i386, 32-bit mode.

I’ve finally reinstalled pdflatex. But now my Qt installation doesn’t work.

I tried:


sudo port install qt4-mac

and about a year later everything seemed to have worked fine. Kudos to macports for having the bright idea to restrain from distributing precompiled binaries. I’m learning patience!

But everything did not work fine. I re-qmake-ed my current project into an xcode project which went fine, but when I tried to build my project in xcode I got the following mysterious error:


pbxcp: warning: couldn't strip: /absolute/path/to/my/app: No such file or directory

Searching around the only ideas I found were to delete the build directory, clean and rebuild which did not work.

Solution:


sudo port deactivate qt4-mac

Install Qt SDK directly from Qt site (hours faster than macports by the way).

Compiling, installing and using AntTweakBar on Mac OS X

Monday, August 30th, 2010

Seeing Bruno Levy‘s demos at SIGGRAPH 2010 convinced me that I want to start using the painlessly easy prototyping GUI library, AntTweakBar. The premise of AntTweakBar is great. Prototyping should be easy and a researcher shouldn’t spend any time on UI that just flips flags and changes input parameter values. With AntTweakBar UI is added with a single line of code for any variable you want to expose. Moreover AntTweakBar figures out which type of UI element should show up: switches for bools, RGB/HSV value manipulators for colors, spinners for numbers. And it’s all Glut and OpenGL (and DirectX I guess), which for most is exactly what they’re already using.

Compiling and installing AntTweakBar as a dynamically linked library on a mac is a bit tricky though. Here’s what I did:

Dowload the source from the AntTweakBar site.

Go to the source directory:


cd AntTweakBar/src

I had to make some changes to the Makefile.osx. Edit the lines to look like this


CXXCFG          = -O3 -arch i386 -arch x86_64
LFLAGS          = -arch i386 -arch x86_64
OUT_DIR         = /usr/local/lib

BASE            = /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks


I want to compile AntTweakBar universally (32-bit and 64-bit) for a 10.6 machine so I need those -arch options. You can leave those out if you just want the default setting.

Copy Makefile.osx over the exisiting Makefile:


cp Makefile.osx Makefile

Then build with


sudo make

This will put the dylib in the right place so you don't have to mess with DYLD_LIBRARY_PATH each time you link to AntTweakBar

Since I've installed libAntTweakBar.dylib all the way at the /usr/local/ level, I'll also put the header file there:


sudo cp ../include/AntTweakBar.h /usr/local/include

Now, hop over to the examples directory:


cd ../examples

Now you should be able to universally compile a simple example with the following:


gcc -O3 -arch i386 -arch x86_64 -Wall -fno-strict-aliasing -D_MACOSX TwSimpleGLUT.c -lAntTweakBar -lpthread -lm -framework OpenGL -framework GLUT -o TwSimpleGLUT

And run it with:


./TwSimpleGLUT

And you should get something like this:
anttweakbar simple example screen capture

Update:
Mac ports does have a port for AntTweakBar, but it's always such a nightmare dealing with the 32-bit/64-bit problem with mac ports so I have done the above. With macports you can just issue:


sudo port install anttweakbar

And you should be able to compile and run the example in the same manner.

Installing mplayer on Snow Leopard “with MacPorts”

Wednesday, June 16th, 2010

I didn’t quite get macports to install mplayer on my Snow Leopard machine. But it almost did and with a little help I got it installed, and it wasn’t too hard.
First issue:


sudo port install mplayer

This will grab all of the dependencies and then finally fail to install mplayer itself.

After that, follow these instructions. The svn command didn’t work for me so I just grabbed the Subversion snapshot from the mplayer site.