1

I have tried building poco (poco-1.4.6p4) in several ways, all seem to build fine. However, when linking against it, all the different ways I have tried to build poco give error below. No matter what I choose, it appears that poco is being built with the clang++.

What is strange is that before I upgraded from Mountain Lion to Mavericks, none of this happened.

./configure --Darwin64 --shared

and

./configure --Darwin64-gcc --shared --no-tests

and

./configure --Darwin64-clang-libc++ --shared --no-tests

All the above seem to build fine.

But when I link against any of them, they all give the error below when linking against it.

Making all in compiler
/bin/sh ../libtool  --tag=CXX   --mode=link g++  -g -O2 -Wall -lfix8 -lPocoFoundation -lPocoNet -lPocoUtil  -L../runtime     -lz  -o f8c f8c.o f8cutils.o f8precomp.o  
libtool: link: g++ -g -O2 -Wall -o .libs/f8c f8c.o f8cutils.o f8precomp.o -Wl,-bind_at_load  /Users/ivanfigueredo/Downloads/fix8/runtime/.libs/libfix8.dylib -lpthread -lPocoFoundation -lPocoNet -lPocoUtil -L../runtime -lz
Undefined symbols for architecture x86_64:
  "Poco::RegularExpression::RegularExpression(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, bool)", referenced from:
      FIX8::RegExp::RegExp(char const*, int) in f8c.o
  "Poco::RegularExpression::match(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, std::vector<Poco::RegularExpression::Match, std::allocator<Poco::RegularExpression::Match> >&, int) const", referenced from:
      _main in f8c.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [f8c] Error 1
make: *** [all-recursive] Error 1
Ivan
  • 7,448
  • 14
  • 69
  • 134
  • g++ is notorious for the order of -l entries mattering. Functions generally have to be used before they are defined. Another possibility is that some functions were removed from poco and what you are trying to build has never been successfully built with those libraries. You haven't given up on the Mac I see. :) – ojblass May 16 '14 at 03:52
  • Another thing is that name mangers differ between versions of c++ compilers. Name mangers allow you to overload functions with different arguments but have the same name. It's important to use the same compiler when using a library that you used to build the library itsrlf. – ojblass May 16 '14 at 03:55
  • Manglers not manger on the mobile app. – ojblass May 16 '14 at 03:57
  • I thought it might have to do with this, but I am unsure https://trac.macports.org/ticket/41588 That seems to crash at runtime though not a compile-time error. – Ivan May 16 '14 at 04:06
  • You are very close... did you make clean between your configure calls? – ojblass May 16 '14 at 04:10
  • That page outlines why you cannot mix binaries and libraries with different compilers. – ojblass May 16 '14 at 04:11
  • Yes, nothing helps :( But that is a __runtime__ error. I get a compile time error???!!!?? – Ivan May 16 '14 at 04:11
  • The article makes some suggestion to unify which compiler to use. – ojblass May 16 '14 at 04:14
  • In the morning I will ponder. Does this have to be on Mac? – ojblass May 16 '14 at 04:15
  • Try this find g++ and name it g++.old – ojblass May 16 '14 at 04:17
  • Then copy clang++ to g++ – ojblass May 16 '14 at 04:18
  • Try your compile and put it back – ojblass May 16 '14 at 04:18
  • LOL! I was about to do the same thing :) – Ivan May 16 '14 at 04:21

1 Answers1

1

Configure generally will pay attention to CC and CXX environment variables to allow you to change compilers the software will build with. Try and adjust these settings.

ojblass
  • 21,146
  • 22
  • 83
  • 132
  • You beat me to it. This works. I can't believe that Apple broke compatibility with gcc ::eek:: – Ivan May 16 '14 at 04:50