0

I am trying to build nanomsg on mingw, cross compiling from ubuntu using mxe. The target host is x86_64. I built it fine but it won't link. I am getting issues like

undefined reference to 'imp__nn_freemsg'

I think it's a static lib issue. I built again using

 ./configure --enable-static --disable-shared ...

Same issue. Are there any linker flags I need to put in the gcc build line after I link in libnanomsg.a?

Matthew Darnell
  • 1,315
  • 2
  • 12
  • 24
  • Yes! There are many defines that will be set if you build with VS, using cmake. Some are located in src/nn.h, others are scattered around. By the way, the 'imp__**' issue is always a failure to link it statically. -D_WIN32 -DNN_EXPORTS -DNN_HAVE_MINGW -DNN_HAVE_WINDOWS -DNN_USE_LITERAL_IFADDR=1 -DSTATICLIB will fix it. – Matthew Darnell Jun 30 '15 at 01:19

1 Answers1

1

There are many defines that will be set if you build with VS, using cmake. Some are located in src/nn.h, others are scattered around. By the way, the 'imp__**' issue is always a failure to link it statically.

Passing these flags will link it:

-D_WIN32 -DNN_EXPORTS -DNN_HAVE_MINGW -DNN_HAVE_WINDOWS -DNN_USE_LITERAL_IFADDR=1 -DSTATICLIB

tshepang
  • 12,111
  • 21
  • 91
  • 136
Matthew Darnell
  • 1,315
  • 2
  • 12
  • 24