memoir class glossary: \changeglossnumformat not working

I've modified memoir's glossary format in order for things to look the way I want. I'm pretty happy, except for one thing: I'd like for the page numbers to be clickable links. When the reader clicks, he/she should be taken to the corresponding page. But I cannot get this to work.

Here's what I have:

main.tex

\documentclass{memoir}
\usepackage{style}
\begin{document}
\printglossary
\chapter{A Chapter}
some text \glossary(g1){g1}{a glossary entry}
\end{document}


style.sty

\usepackage{hyperref}
\usepackage{calc}

\newlength{\mylength}

\makeglossary

\renewcommand*{\glossaryname}{List of Notation}
\renewcommand{\glossaryspace}[1]{}
\changeglossnum{\thepage}
\renewcommand*{\glossarymark}{\markboth{\glossaryname}{\glossaryname}}
\renewcommand{\glossitem}[4]{%
\setlength{\mylength}{1.9cm-\widthof{#1}}%
\sbox\@tempboxa{#1 \space #2 #3 \makebox[2em]{\hyperpage{#4}}}%
\par\hangindent 2em
\ifdim\wd\@tempboxa<1.0\linewidth
#1 \hspace{\mylength} #2 #3 \cftdotfill{\@dotsep} \makebox[1em][r]{\hyperpage{#4}}\relax
\else
#1 \cftdotfill{\@dotsep} \makebox[1em][r]{\hyperpage{#4}}\\
#2 #3
\fi}


According to the memoir documentation,

\changeglossnumformat{|hyperpage}%% for hyperlinks


should do the trick, but in my case it doesn't do anything. So instead, I added they \hyperpage around #4, which creates a clickable link for each page number in the glossary, but it doesn't lead to the right page, in fact it leads nowhere (null).

I'm using

makeindex -s basic.gst -o main.gls main.glo


to compile the glossary. I'm on a Mac using TexShop with TeXLive-2010 installed.

BTW, I'm not interested in using any other classes like glossary or nomencl. I've come so far already. I'd just like to get the links to work.

-
Welcome to TeX.SX! TeX Live 2010 is quite outdated. –  egreg Dec 3 '13 at 23:56