Undefined symbol error during the compiling with ImageMagick library on Mac. - imagemagick

When I try to compile my simple code which is meant to resize a image file using ImageMagick library, I'm getting the following error.
$ gcc `pkg-config --libs --cflags ImageMagick` imagemagick_example.c
Undefined symbols for architecture x86_64:
"_DestroyMagickWand", referenced from:
_main in ccx4lMf2.o
"_MagickGetImageHeight", referenced from:
_main in ccx4lMf2.o
"_MagickGetImageWidth", referenced from:
_main in ccx4lMf2.o
"_MagickReadImage", referenced from:
_main in ccx4lMf2.o
"_MagickResizeImage", referenced from:
_main in ccx4lMf2.o
"_MagickSetImageCompressionQuality", referenced from:
_main in ccx4lMf2.o
"_MagickWandGenesis", referenced from:
_main in ccx4lMf2.o
"_MagickWandTerminus", referenced from:
_main in ccx4lMf2.o
"_MagickWriteImage", referenced from:
_main in ccx4lMf2.o
"_NewMagickWand", referenced from:
_main in ccx4lMf2.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
I searched for a way to fix this for an hour and couldn't find any works.
I'm using macOS 10.13.1 and home-brew installed ImageMagick 7.0.7-14.

Use MagickWand for the C API.
gcc `pkg-config --libs --cflags MagickWand` imagemagick_example.c
Or skip pkg-config and use the helper utility that shipped with ImageMagick.
MagickWand-config --libs --cflags

Related

Xcode compilation error: audio stream

I'm facing a problem, my project don't want to compile because of
some framework mismatch.
Undefined symbols for architecture arm64:
"_audio_stream_open", referenced from:
_ears_load_stream in TQEventListener(load.o)
"_audio_stream_get_duration", referenced from:
_ears_load_stream in TQEventListener(load.o)
"_audio_stream_get_sample_rate", referenced from:
_ears_load_stream in TQEventListener(load.o)
"_audio_stream_close", referenced from:
_ears_load_stream in TQEventListener(load.o)
"_audio_stream_get_channels", referenced from:
_ears_load_stream in TQEventListener(load.o)
"_audio_stream_eos", referenced from:
_ears_load_stream in TQEventListener(load.o)
"_audio_stream_read", referenced from:
_ears_load_stream in TQEventListener(load.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I think its about TQEventListener which need a framework, but I'm not sure...

MPI - symbols not found for architecture x86_64

I was trying to install mpi on my Mac (running Yosemite) and I ran the following:
brew update
brew install open-mpi
Everything seemed to go okay, but when I tried to compile my file mpi.cpp, I received:
Undefined symbols for architecture x86_64:
"_MPI_Allgatherv", referenced from:
_main in mpi.o
"_MPI_Comm_rank", referenced from:
_main in mpi.o
"_MPI_Comm_size", referenced from:
_main in mpi.o
"_MPI_Finalize", referenced from:
_main in mpi.o
"_MPI_Init", referenced from:
_main in mpi.o
"_MPI_Reduce", referenced from:
_main in mpi.o
"_MPI_Scatterv", referenced from:
_main in mpi.o
"_MPI_Type_commit", referenced from:
_main in mpi.o
"_MPI_Type_contiguous", referenced from:
_main in mpi.o
"_ompi_mpi_comm_world", referenced from:
_main in mpi.o
"_ompi_mpi_double", referenced from:
_main in mpi.o
"_ompi_mpi_int", referenced from:
_main in mpi.o
"_ompi_mpi_op_min", referenced from:
_main in mpi.o
"_ompi_mpi_op_sum", referenced from:
_main in mpi.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mpi] Error 1
I'm not really sure what to make of this. Is there an additional step?

Linker command failed with exit code 1 on my Swift app

Can't figure this out. Tried making a completely new project and it still doesn't work. This app uses GoogleMaps. Error below:
Undefined symbols for architecture i386:
"_CBAdvertisementDataManufacturerDataKey", referenced from:
-[GMSx_PEBeaconScanner centralManager:didDiscoverPeripheral:advertisementData:RSSI:] in
GoogleMaps(PEBeaconScanner.o) "_CBAdvertisementDataServiceDataKey",
referenced from:
-[GMSx_PEBeaconScanner centralManager:didDiscoverPeripheral:advertisementData:RSSI:] in
GoogleMaps(PEBeaconScanner.o)
"_CBCentralManagerScanOptionAllowDuplicatesKey", referenced from:
-[GMSx_PEBeaconScanner scanIfAppropriate] in GoogleMaps(PEBeaconScanner.o) "_OBJC_CLASS_$_CBCentralManager",
referenced from:
objc-class-ref in GoogleMaps(PEBeaconScanner.o) "_OBJC_CLASS_$_CBUUID", referenced from:
objc-class-ref in GoogleMaps(PEBeacon.o)
objc-class-ref in GoogleMaps(PEBeaconScanner.o) "_vImageBoxConvolve_Planar8", referenced from:
(anonymous namespace)::CreateBlurredImage(CGImage*, float, float) in GoogleMaps(GLWaterGroup.o) ld: symbol(s) not found for
architecture i386 clang: error: linker command failed with exit code 1
(use -v to see invocation)
Try importing CoreBluetooth.framework and Accelerate.framework. Also use "-ObjC" instead of "-all_load" in under "Other Linker Flags".
You can refer colink's reply in GoogleMapsSDK : Undefined symbols for architecture x86_64

Cordova iOS 64 bit compatibility

I want to have my current cordova pp compatible for 64 bit iOS. I downloaded cordova 3.7 into my project but I am unable to build. I am getting the following error.
Undefined symbols for architecture arm64:
"_OBJC_METACLASS_$_CDVViewController", referenced from:
_OBJC_METACLASS_$_RootViewController in RootViewController.o
"_OBJC_METACLASS_$_CDVPlugin", referenced from:
_OBJC_METACLASS_$_DataBasePlugin in DataBasePlugin.o
_OBJC_METACLASS_$_LoginStatusPlugin in LoginStatusPlugin.o
"_OBJC_IVAR_$_CDVViewController._commandQueue", referenced from:
-[RootViewController didReceiveMemoryWarning] in RootViewController.o
"_OBJC_CLASS_$_CDVViewController", referenced from:
_OBJC_CLASS_$_RootViewController in RootViewController.o
"_OBJC_CLASS_$_CDVPlugin", referenced from:
_OBJC_CLASS_$_DataBasePlugin in DataBasePlugin.o
_OBJC_CLASS_$_LoginStatusPlugin in LoginStatusPlugin.o
"_OBJC_CLASS_$_CDVPluginResult", referenced from:
objc-class-ref in DataBasePlugin.o
objc-class-ref in LoginStatusPlugin.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have also tried the steps from below link
https://shazronatadobe.wordpress.com/2014/03/12/xcode-5-1-and-cordova-ios/
I followed the below link to add the lib file to my project
http://outof.me/embedding-cordovalib-in-your-iosphonegap-app-project/
Please help

Opencv 2.3.0 Flann linking error (Xcode)

I have an older system (OSX 10.6.8 with xcode 4.0) and I'm trying to get OpenCV 2.3.0 to work on it. The problem that I can't resolve is that whenever I try to use the flann library, my xcode gives me a Mach-O linker error. So far I've tried recompiling the all the libraries and building the dylib from a different source, but it hasn't helped. When I check the library in terminal, i get
Freddi-2:OpenCV-2.3.0 fredchen$ file /usr/local/lib/libopencv_flann.dylib
/usr/local/lib/libopencv_flann.dylib: Mach-O 64-bit dynamically linked shared library x86_64
My specific error code is:
Undefined symbols for architecture x86_64:
"cv::flann::KDTreeIndexParams::KDTreeIndexParams(int)", referenced from:
_main in main.o
"cv::flann::SearchParams::SearchParams(int, float, bool)", referenced from:
_main in main.o
"cv::FlannBasedMatcher::FlannBasedMatcher(cv::Ptr<cv::flann::IndexParams> const&, cv::Ptr<cv::flann::SearchParams> const&)", referenced from:
_main in main.o
"cv::BFMatcher::BFMatcher(int, bool)", referenced from:
_main in main.o
"cv::flann::IndexParams::~IndexParams()", referenced from:
cv::flann::SearchParams::~SearchParams() in main.o
"cv::flann::IndexParams::~IndexParams()", referenced from:
cv::Ptr<cv::flann::IndexParams>::delete_obj() in main.o
"vtable for cv::BFMatcher", referenced from:
cv::BFMatcher::~BFMatcher() in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The dynamic libraries I have linked with the project are:
libopencv_video.2.3.0.dylib
libopencv_objdetect.2.3.0.dylib
libopencv_ml.2.3.0.dylib
libopencv_legacy.2.3.0.dylib
libopencv_gpu.2.3.0.dylib
libopencv_contrib.2.3.0.dylib
libopencv_ts.2.3.0.dylib
libopencv_imgproc.2.3.0.dylib
libopencv_highgui.2.3.0.dylib
libopencv_flann.2.3.0.dylib
libopencv_features2d.2.3.0.dylib
libopencv_core.2.3.0.dylib
libopencv_calib3d.2.3.0.dylib
I'd appreciate any help. Thanks!
I remember having similar errors when I was using 2.3.0 on Mac. You should try to stick with the latest version, either 2.4.4 or the latests from github.

Resources