fawick / go-mapnik

Go bindings for mapnik (http://www.mapnik.org or http://github.com/mapnik/mapnik)
BSD 3-Clause "New" or "Revised" License
60 stars 18 forks source link

OSX Build failure #1

Closed jamra closed 10 years ago

jamra commented 10 years ago

On OSX, I ran

'brew install mapnik'.

I assumed that this is the equivalent to

'apt-get install libmapnik-dev'

It failed straight away with clang

jacobs-imac:mapnik j$ ./configure.bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5171  100  5171    0     0   7824      0 --:--:-- --:--:-- --:--:--  7834
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2347  100  2347    0     0  11580      0 --:--:-- --:--:-- --:--:-- 11561
# github.com/fawick/go-mapnik/mapnik
Undefined symbols for architecture x86_64:
  "boost::system::system_category()", referenced from:
      boost::mutex::mutex() in mapnik_c_api.cpp.o
      boost::mutex::unlock() in mapnik_c_api.cpp.o
      boost::unique_lock<boost::mutex>::lock() in mapnik_c_api.cpp.o
      boost::mutex::lock() in mapnik_c_api.cpp.o
      __GLOBAL__I_a in mapnik_c_api.cpp.o
  "boost::system::generic_category()", referenced from:
      __GLOBAL__I_a in mapnik_c_api.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
springmeyer commented 10 years ago

perhaps try adding --ldflags --dep-libs to this line https://github.com/fawick/go-mapnik/blob/master/mapnik/configure.bash#L9

jamra commented 10 years ago

Thank you. That seemed to do the trick for building with Clang.

I am getting This issue:

jacobs-imac:mapnik j$ ./configure.bash
# github.com/fawick/go-mapnik/mapnik
In file included from ./mapnik_c_api.cpp:5:
In file included from /usr/local/include/mapnik/agg_renderer.hpp:28:
In file included from /usr/local/include/mapnik/feature_style_processor.hpp:27:
In file included from /usr/local/include/mapnik/datasource.hpp:28:
In file included from /usr/local/include/mapnik/params.hpp:28:
/usr/local/include/mapnik/value_types.hpp:27:10: fatal error: 'unicode/unistr.h' file not found
jamra commented 10 years ago

I am going to close this issue since my current problem is in a relation to not having the icu header unicode/unistr.h

I will open another issue.

springmeyer commented 10 years ago

That error indicates that the icu headers are not being found, which should be available via mapnik-config --cflags

jamra commented 10 years ago

This is a little weird

jacobs-imac:mapnik j$ mapnik-config --cflags | grep icu
-I/usr/local/include -I/usr/local/include/mapnik/agg -I/usr/local/Cellar/libtiff/4.0.3/include -I/usr/local/Cellar/libpng/1.5.17/include -I/usr/local/Cellar/proj/4.8.0/include -I/usr/local/Cellar/jpeg/8d/include -I/usr/local/Cellar/freetype/2.5.2/include/freetype2 -I/usr/local/Cellar/icu4c/52.1/include -I/usr/local/Cellar/boost/1.55.0/include -I/opt/local/include/libxml2 -I/usr/include -DHAVE_JPEG -DMAPNIK_USE_PROJ4 -DHAVE_PNG -DHAVE_TIFF -DBIGINT -DDARWIN -DMAPNIK_THREADSAFE -DNDEBUG -DHAVE_LIBXML2 -ansi -Wall -ftemplate-depth-300 -O3 -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts

It shows icu4c is there, but unicode/unistr.h file is not there.

I installed icu from source and it built successfully. I'm wondering what to do with this file. I ambitiously tried to copy it to the local directory, which caused a whole flood of errors.

fawick commented 10 years ago

I am not familiar with the MacOS toolchain and build system, so this is a wild guess: Do you need to explicitely install icu4c like described in the following link? http://darraghenright.tumblr.com/post/22027208929/installing-intl-package-on-osx-lion

jamra commented 10 years ago

I managed to fix the problem. I did need to install icu4c from homebrew, however, I also needed to add

/usr/local/Cellar/icu4c/52.1/include

to my path. This fixed that problem.
It didn't make much sense that I had to explicitly add this to my path since it was visible from using the command

mapnik-config --cflags

Unfortunately, I am now getting the error

[j:mapnik]$ ./configure.bash 
# github.com/fawick/go-mapnik/mapnik
clang: error: argument unused during compilation: '-fno-eliminate-unused-debug-types'

mapnik-config --all-flags does not have that argument. I don't know where to remove it from.

springmeyer commented 10 years ago

It didn't make much sense that I had to explicitly add this to my path since it was visible from using the command

Right, that is odd. I'm here as a mapnik developer (and know nothing about go): I presume something is wrong with the go build script such that the --cflags are not being respected.

Btw, how did you install Mapnik? When brew install mapnik

mapnik-config --all-flags does not have that argument. I don't know where to remove it from.

Also, odd. Maybe @fawick knows....

jamra commented 10 years ago

If it makes any difference, go build fails with the same message. It may just be a clang issue since clang is forced on you on OSX even if you use gcc. If I can find out where this argument is in the hierarchy, I can remove it and it should work on OSX.

jamra commented 10 years ago

Okay, I identified the problem. Clang is just not supported in cgo. I will have to try to install gcc explicitly, but I remember having a gcc/clang issue in the past where in the latest build of OSX (Mavericks) gcc automatically links to clang.

I can try getting a homebrew gcc version, but I think I'm just going to give up on this attempt and try to use something like docker to run this project. There is nothing wrong with the author's implementation in terms of golang, so I am closing this ticket.