how about a 'snowleopardfixes' library port?

Ken Cunningham ken.cunningham.webuse at
Mon Aug 22 21:50:41 PDT 2016

Snow Leopard has two missing but fairly commonly used functions, getline and strnlen.  These two functions are responsible for a number of snow leopard build failures.

It seemed that reinventing the wheel over and over for a getline replacement was getting rather tedious, port after port. I built a static library with a getline replacement in it, called it 'libsnowleopardfixes.a', put it in /opt/local/lib, and added it to the linked libraries on lnav. 

Then, it required only a single line of code to be added to the file where it fails (in this case,; because lnav is c++ code, it required this version:

"extern "C" ssize_t getline(char **lineptr, size_t *n, FILE *stream);"

and to have the library added to the ldflags, and the port built and ran without trouble. 

Perhaps there is somewhere more elegant I could have put the definition, but it seemed to be required only in this one file.

This seems to be a contender for a fairly easy way to solve a lot of troubles with these missing snowleopard functions...


More information about the macports-dev mailing list