Opened 11 years ago

Closed 11 years ago

#40993 closed defect (invalid)

ImageMagick stopped working in OS X 10.9 Mavericks

Reported by: MaurizioLoreti Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.2.0
Keywords: mavericks Cc: macports@…, szhorvat (Szabolcs Horvát)
Port: ImageMagick

Description

This same bug has been reported in the ImageMagick forum.

Hello - Yesterday I switched to OS X 10.9; following the 'migration' instructions, I have deinstalled and reinstalled MacPorts; and then installed IM. The version is:

ImageMagick @6.8.7-3_0+x11 (active) platform='darwin 13' archs='x86_64'

Since then, any program using the Magick++ library stopped working; I have tracked down all to a minimal example, i.e.:

MLO@bigmac 16 $ cat minimal.cxx 
#include <iostream>
#include <Magick++.h>

using namespace std;
using namespace Magick;

int main() {
  try {
    Image newImage("logo.jpg");
    newImage.zoom("50x");
    newImage.write("newlogo.jpg");
  } catch (Error &e) {
    cerr << e.what() << '\n';
  } catch (...) {
    cerr << "Unknown exception catched\n";
  }
}
MLO@bigmac 17 $ g++ `Magick++-config --cppflags --cxxflags --ldflags --libs` -o minimal minimal.cxx
Undefined symbols for architecture x86_64:
  "Magick::Image::write(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      _main in ccMyhbLg.o
  "Magick::Image::Image(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      _main in ccMyhbLg.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

The output of the 'config' command is:

MLO@bigmac 18 $ Magick++-config --cppflags --cxxflags --ldflags --libs
-DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/local/include/ImageMagick-6 
-DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/local/include/ImageMagick-6 
-L/opt/local/lib -lMagick++-6.Q16 -lMagickWand-6.Q16 -lMagickCore-6.Q16 
-L/opt/local/lib -lMagick++-6.Q16 -lMagickWand-6.Q16 -lMagickCore-6.Q16 

I don't understand what's happening; it seems that there is a wrong content in the libraries, and that the linker barfs on that. If that is relevant, my compiler is:

MLO@bigmac 30 $ g++ --version
g++ (MacPorts gcc48 4.8.1_3) 4.8.1

Please, does somebody has an idea of what to do?

Change History (27)

comment:1 Changed 11 years ago by MaurizioLoreti

Cc: Maurizio.Loreti@… added

Cc Me!

comment:2 Changed 11 years ago by mf2k (Frank Schima)

Cc: ryandesign@… Maurizio.Loreti@… removed
Keywords: Mavericks ImageMagick link removed
Owner: changed from macports-tickets@… to ryandesign@…
Port: ImageMagick added

in the future, please fill in the Port field.

comment:3 Changed 11 years ago by mf2k (Frank Schima)

Keywords: mavericks added

comment:4 Changed 11 years ago by MaurizioLoreti

Cc: Maurizio.Loreti@… added

Cc Me!

comment:5 Changed 11 years ago by macports@…

Cc: macports@… added

Cc Me!

comment:6 Changed 11 years ago by szhorvat (Szabolcs Horvát)

Cc: szhorvat@… added

Cc Me!

comment:7 Changed 11 years ago by cooperz

It's most likely related to the runtime C++ runtime that it's linked against (they've changed the default one). I've encountered a similar problem for a different project under 10.9. Not sure what ImageMagick is using for a build system, but if it's using cmake, try adding this somewhere:

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")

(otherwise, modify and try as appropriate). good luck.

I was not actually trying to get ImageMagick running myself... I was simply browsing the error list for mavericks .. so I thought to help :)

comment:8 in reply to:  7 Changed 11 years ago by MaurizioLoreti

Replying to cooperz@…:

It's most likely related to the runtime C++ runtime that it's linked against (they've changed the default one). I've encountered a similar problem for a different project under 10.9. Not sure what ImageMagick is using for a build system, but if it's using cmake, try adding this somewhere:

The error in fact occurs when i'm trying to link something against the IM libraries, and not building them; and the libraries are built with the usual GNU configure/make/install sequence. I have tried to sudo port edit ImageMagick, changing the configure parameters, and obtained nothing. I really need some help from the maintainer, though. Thank any way for willing to help...

Last edited 11 years ago by MaurizioLoreti (previous) (diff)

comment:9 Changed 11 years ago by MaurizioLoreti

In fact, I discovered something more; the error is related with the building of the IM libraries. This is what I have done:

1) Downloaded from the ImageMagick site the source code for ImageMagick-6.8.7-3, and unpacked the distribution on ~/Desktop; 2) given the commands ./configure and make; 3) compiled and linked my minimal example using the libraries built in the step 2), with the following command:

$ g++ -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/local/include/ImageMagick-6 -L/Users/loreti/Desktop/ImageMagick-6.8.7-3/Magick++/lib/.libs -L/Users/loreti/Desktop/ImageMagick-6.8.7-3/wand/.libs -L/Users/loreti/Desktop/ImageMagick-6.8.7-3/magick/.libs -lMagick++-6.Q16 -lMagickWand-6.Q16 -lMagickCore-6.Q16 -o minimal minimal.cxx

The compiler and the linker ran OK; of course the executable didn't run because dyld tried to load the wrong libraries, but the fact that the linking pass was OK tells me that in some way the IM libraries were built with a compiler different that my default one:

$ g++ --version
g++ (MacPorts gcc48 4.8.1_3) 4.8.1

Am I right guessing that? Now I really need 4.8 for its support of C++11; what can I do?

comment:10 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: Maurizio.Loreti@… removed
Resolution: invalid
Status: newclosed

Yes. ImageMagick and most ports are built with the system default compiler, which is clang on recent versions of Xcode. This uses the system default C++ library, which on Mavericks is libc++. You cannot mix this with software compiled using libstdc++, which is what gcc48 uses. The solution is to use clang for your own code also, not gcc48. clang supports C++11 just fine.

comment:11 in reply to:  10 Changed 11 years ago by MaurizioLoreti

Replying to ryandesign@…:

Yes. ImageMagick and most ports are built with the system default compiler, which is clang on recent versions of Xcode. This uses the system default C++ library, which on Mavericks is libc++. You cannot mix this with software compiled using libstdc++, which is what gcc48 uses. The solution is to use clang for your own code also, not gcc48. clang supports C++11 just fine.

Please, clarify use clang for your own code also, not gcc48. This is what I get:

$ clang `Magick++-config --cppflags --cxxflags --ldflags --libs` -o minimal minimal.cxx
Undefined symbols for architecture x86_64:
  "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
  "std::__1::ios_base::getloc() const", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
      _main in minimal-gZ3HhB.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in minimal-gZ3HhB.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
      _main in minimal-gZ3HhB.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in minimal-gZ3HhB.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
  "std::__1::cerr", referenced from:
      _main in minimal-gZ3HhB.o
  "std::__1::ctype<char>::id", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
  "std::__1::locale::~locale()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
  "std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
  "std::__1::ios_base::clear(unsigned int)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
  "std::terminate()", referenced from:
      ___clang_call_terminate in minimal-gZ3HhB.o
  "___cxa_begin_catch", referenced from:
      _main in minimal-gZ3HhB.o
      ___clang_call_terminate in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
  "___cxa_end_catch", referenced from:
      _main in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
  "___gxx_personality_v0", referenced from:
      _main in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-gZ3HhB.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-gZ3HhB.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in minimal-gZ3HhB.o
      Dwarf Exception Unwind Info (__eh_frame) in minimal-gZ3HhB.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

comment:12 Changed 11 years ago by MaurizioLoreti

Resolution: invalid
Status: closedreopened

comment:13 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Add -std=c++11 to the compiler invocation.

comment:14 in reply to:  13 Changed 11 years ago by MaurizioLoreti

Replying to ryandesign@…:

Add -std=c++11 to the compiler invocation.

$ clang -std=c++11 `Magick++-config --cppflags --cxxflags --ldflags --libs` -o minimal minimal.cxx
Undefined symbols for architecture x86_64:
  "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
  "std::__1::ios_base::getloc() const", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
      _main in minimal-lyBEd7.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in minimal-lyBEd7.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
      _main in minimal-lyBEd7.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in minimal-lyBEd7.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
  "std::__1::cerr", referenced from:
      _main in minimal-lyBEd7.o
  "std::__1::ctype<char>::id", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
  "std::__1::locale::~locale()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
  "std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
  "std::__1::ios_base::clear(unsigned int)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
  "std::terminate()", referenced from:
      ___clang_call_terminate in minimal-lyBEd7.o
  "___cxa_begin_catch", referenced from:
      _main in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      ___clang_call_terminate in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
  "___cxa_end_catch", referenced from:
      _main in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
  "___gxx_personality_v0", referenced from:
      _main in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-lyBEd7.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-lyBEd7.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in minimal-lyBEd7.o
      Dwarf Exception Unwind Info (__eh_frame) in minimal-lyBEd7.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

comment:15 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Hmm, I thought that was all that was needed. Sorry, I'm not a developer of compiled software and don't know how to help you with this.

comment:16 in reply to:  15 Changed 11 years ago by MaurizioLoreti

Replying to ryandesign@…:

Hmm, I thought that was all that was needed. Sorry, I'm not a developer of compiled software and don't know how to help you with this.

Well, there is no point in the installation of the ImageMagick port if I cannot use it. A port is made to be usable. Also the libraries, that are integrant part of IM, not only command line tools like identify and convert.

comment:17 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Mavericks has only just been released recently and we are still coming to terms with what this all means. One of the changes in Mavericks is that it uses libc++ not libstdc++ and you cannot mix and match the two. This is an OS-level change made by Apple; there's nothing we can do in MacPorts or in individual ports like ImageMagick to change it.

It's my understanding that the command line tools like identify and convert are working correctly, just that you cannot link your own software to it if that software is not compiled with the same C++ library, and that for some reason trying to compile with clang is producing errors.

As far as I know, the ImageMagick port is working correctly. If you need help compiling your own software against MacPorts libraries, you can ask for help on the macports-users list. If you are experiencing a problem compiling a port, you can file a bug report against that port.

comment:18 in reply to:  17 Changed 11 years ago by MaurizioLoreti

Replying to ryandesign@…:

As far as I know, the ImageMagick port is working correctly. If you need help compiling your own software against MacPorts libraries, you can ask for help on the macports-users list. If you are experiencing a problem compiling a port, you can file a bug report against that port.

Thank for your help.

Workaround: as far as I can ./configure and make on the source code, I may "sudo make install" a parallel version on a private tree, and link against that private version. But still I think that there is a bug in the port. If the libraries cannot be used INVOKING CLANG, the Macports standard C/C++ compiler, how on earth is a poor user supposed to use them?

Last edited 11 years ago by MaurizioLoreti (previous) (diff)

comment:19 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

What change would you have me make to the portfile?

comment:20 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

The libraries can be used using clang; there are many ports in MacPorts that do so successfully.

comment:21 Changed 11 years ago by neverpanic (Clemens Lang)

Try with -std=c++11 -stdlib=libc++.

comment:22 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

I thought -stdlib=libc++ was the default on Mavericks.

comment:23 in reply to:  21 Changed 11 years ago by MaurizioLoreti

Replying to cal@…:

Try with -std=c++11 -stdlib=libc++.

$ clang -std=c++11 -stdlib=libc++ `Magick++-config --cppflags --cxxflags --ldflags --libs` -o minimal minimal.cxx
Undefined symbols for architecture x86_64:
  "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
  "std::__1::ios_base::getloc() const", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
      _main in minimal-1lYFlk.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in minimal-1lYFlk.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
      _main in minimal-1lYFlk.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in minimal-1lYFlk.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
  "std::__1::cerr", referenced from:
      _main in minimal-1lYFlk.o
  "std::__1::ctype<char>::id", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
  "std::__1::locale::~locale()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
  "std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
  "std::__1::ios_base::clear(unsigned int)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
  "std::terminate()", referenced from:
      ___clang_call_terminate in minimal-1lYFlk.o
  "___cxa_begin_catch", referenced from:
      _main in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      ___clang_call_terminate in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
  "___cxa_end_catch", referenced from:
      _main in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
  "___gxx_personality_v0", referenced from:
      _main in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in minimal-1lYFlk.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) in minimal-1lYFlk.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in minimal-1lYFlk.o
      Dwarf Exception Unwind Info (__eh_frame) in minimal-1lYFlk.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

comment:24 Changed 11 years ago by danielluke (Daniel J. Luke)

Um, this builds fine if you do c++ Magick++-config --cppflags --cxxflags --ldflags --libs -o minimal minimal.cxx or clang++ -std=c++11 -stdlib=libc++ Magick++-config --cppflags --cxxflags --ldflags --libs -o minimal minimal.cxx

Both clang++ and c++ are:

Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

comment:25 Changed 11 years ago by neverpanic (Clemens Lang)

Oh, right. clang vs. clang++. We should have caught that one. Weird that clang doesn't refuse to compile C++ code, though.

comment:26 in reply to:  25 Changed 11 years ago by MaurizioLoreti

Replying to cal@…:

Oh, right. clang vs. clang++. We should have caught that one. Weird that clang doesn't refuse to compile C++ code, though.

<whew> Well, that has solved my problem - clang++ -std=c++11 -stdlib=libc++ works, indeed; and the two command line options are not really needed, at least for a simple program like the minimal.cxx I have posted here. I think that the maintainer could close now this bug; a very, very grateful thank you to all the people that has helped me to solve my troubles. And a suggestion: alert somewhere the users of all Macports package that they want to use clang/clang++ for all of their programming, if they plan to link against a Macports library.

Thank you again, and... see you at the next bug :)

comment:27 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: invalid
Status: reopenedclosed
Note: See TracTickets for help on using tickets.