[GRASS-dev] Difficulty compiling GRASS on Mac

Hey all, I’m trying to compile GRASS on Mac 10.13.4 so I can compile and link to the GRASS libraries. I don’t need most of the GIS features, just enough to create and run my own C++ modules. I’m having some troubles with grass-7.4.0 and grass-7.4.1RC1. The first problem I’m having is an error linking libgrass_gis.7.4.1RC1.dylib. I get this error:

Undefined symbols for architecture x86_64:

“_libiconv”, referenced from:

_print_escaped_for_xml in parser_interface.o

“_libiconv_close”, referenced from:

_print_escaped_for_xml in parser_interface.o

“_libiconv_open”, referenced from:

_print_escaped_for_xml in parser_interface.o

ld: symbol(s) not found for architecture x86_64

I can rerun the command and manually add the correct linking path for iconv, and it works. I’m not sure why it wouldn’t find iconv otherwise, but it is what it is. This is the initial configure command that I’m using:

./configure --with-opengl=aqua --with-prefix=/usr/local --enable-shared

I’ve found that I can change the configure command and fix that problem:

./configure --with-opengl=aqua --with-libs=/usr/local/lib --with-prefix=/usr/local --enable-shared

However, then it progresses and returns this error while compiling many modules:

dyld: Library not loaded: /usr/local/grass-7.4.1RC1/lib/libgrass_gis.7.4.1RC1.dylib

Referenced from: /usr/local/grass/grass-7.4.1RC1/dist.x86_64-apple-darwin17.5.0/bin/g.parser

Reason: image not found

make: *** [d.correlate.tmp.html] Error 1

The dylib looks like it’s been successfully compiled at dist.x86_64-apple-darwin17.5.0/lib/libgrass_gis.7.4.1RC1.dylib and just the linking path for the libraries is wrong. I can’t seem to shake it with any of the online GRASS compiling instructions I’ve found. What might cause this? Are there any current instructions for getting the shared libraries compiled and installed?

Also, I’m able to install via homebrew, but then I have this problem when compiling my modules against GRASS:

sources/CameraOptic.cpp:33:23: error: use of undeclared identifier ‘PACKAGE’

G_verbose_message(_(“(%5d) Camera optical adjustment…”),

^

/usr/local/opt/grass7/grass-base/include/grass/glocale.h:10:26: note: expanded from macro ‘_’

#define _(str) G_gettext(PACKAGE,(str))

I’ve never seen it before and can only guess that it would be fixed by a fresh install of GRASS from source. Identical code compiles fine under Ubuntu. Does anyone know what might be causing this? Or what might I do to fix it?

Thanks,
Seth