/usr/bin/ld: cannot find -lMagick++6-Q16 - c++

I have installed ImageMagick library (from source) on ubuntu system (12.04):
$: identify -version
Version: ImageMagick 6.8.3-6 2013-03-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: ps
But if I tried to compilate my program:
$: make
g++ -o grayscale grayscale.cpp -I/usr/local/include/ImageMagick-6.8 -I/usr/local/lib `Magick++-config --cppflags --cxxflags --ldflags --libs`
/usr/bin/ld: cannot find -lMagick++6-Q16
/usr/bin/ld: cannot find -lMagick++6-Q16
collect2: ld returned 1 exit status
make: *** [grayscale] Error 1
I've tried looking for some solutions but couldn't fix this. Can you anybody help me? I don't properly understanding what does this error means.

Related

"Make" fails with Clang error - how do I get the error from Clang?

Main question is: How do I get the clang error out of make?
I have been trying to follow these instructions to install GLEW. On second look I've seen that GLEW might not really be necessary on Mac OS X, but I'd still like to find out how to get the error from the problem I was having. (I am not very experienced with make and could not make any similar online solutions work).
Theoretically I should download GLEW, unzip, and run 'make' in the file. This is the output of make:
$ make
cc -dynamiclib -install_name /usr/local/lib/libGLEW.2.1.0.dylib -current_version 2.1.0 -compatibility_version 2.1 -o lib/libGLEW2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGLframework/OpenGL.tbd:4:18: error: unknown enumerated scalar
platform: zippered
^~~~~~~~
file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Framework//OpenGL.framework/OpenGL.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libGLEW.2.1.0.dylib] Error 1
Make -n shows that this is just the first command and it pretty much immediately fails. I have tried make V=1, make VERBOSE=1, and make SHELL='sh -x', but they don't give me additional detail about the clang error. I've also tried running the cc command with -v:
$ cc -v -dynamiclib -install_name /usr/local/lib/libGLEW.2.1.0.dylib -current_version 2.1.0 -compatibility_version 2.1 -o lib/libGLEW2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -dylib -dylib_compatibility_version 2.1 -dylib_current_version 2.1.0 -arch x86_64 -dyib_install_name /usr/local/lib/libGLEW.2.1.0.dylib -macosx_version_min 10.14.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o lib/libGLEW.2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL -L/usr/local/lib -lSystem / Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchains/usr/lib/clang/9.1.0/lib/darwin/libclang_rt.osx.a
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGLframework/OpenGL.tbd:4:18: error: unknown enumerated scalar
platform: zippered
^~~~~~~~
file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Framework//OpenGL.framework/OpenGL.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libGLEW.2.1.0.dylib] Error 1
I don't think I am actually managing to get the real error out of clang. So how do I do that?
It is
Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -dylib -dylib_compatibility_version 2.1 -dylib_current_version 2.1.0 -arch x86_64 -dyib_install_name /usr/local/lib/libGLEW.2.1.0.dylib -macosx_version_min 10.14.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o lib/libGLEW.2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL -L/usr/local/lib -lSystem / Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchains/usr/lib/clang/9.1.0/lib/darwin/libclang_rt.osx.a
command that fails, which is ld, not clang. You can run this command separately to get the same error message.
And
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGLframework/OpenGL.tbd:4:18: error: unknown enumerated scalar
platform: zippered
^~~~~~~~
file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Framework//OpenGL.framework/OpenGL.tbd'
is linker's error message. Unfortunately, I'm not familiar with compilation process on Mac, so can't advice how to fix it.

usr/bin/ld: cannot find -lexpat

I am trying compile a software with Scons I get an error saying,
usr/bin/ld: cannot find -lexpat
Can you please tell me how can I fix it? Thank you very much. Here's the full error message:
scons: Reading SConscript files ...
We're on a 64-bit machine
use 32-bit libs & executables even on 64 bit system
OSNAME = Linux-x86_64-32
No installation being done
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src/examples/.Linux-x86_64-32/dana -m32 src/examples/.Linux-x86_64-32/dana.o -Lsrc/libsrc/.Linux-x86_64-32 -Lsrc/libsrc -Lsrc/libsrc++/.Linux-x86_64-32 -Lsrc/libsrc++ -levioxx -levio -lpthread -lexpat -lz -ldl -lm
/usr/bin/ld: cannot find -lexpat
collect2: error: ld returned 1 exit status
scons: *** [src/examples/.Linux-x86_64-32/dana] Error 1
scons: building terminated because of errors.
Below solution worked with me on Ubuntu 20.04:
sudo apt install libexpat-dev
I have had this same problem in Fedora 34. Doing
sudo yum install expat-devel
will solve the problem.

"ld" broken (downlevel?) on Linux

I've attempted to build g++ v5.1.0 on my Centos 6 system. The build seems to have worked, but when I try to compile and >link< a program, the linker fails thus:
[seesdev#sees15-lin ~]$ g++ -o testcpp testcpp.cpp
/usr/bin/ld: unrecognized option '-plugin'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
Do I have to get a newer version of "ld"? How?

linking things in c++ using object file

PROBLEM SOLVED:::
I am using LEDA library in c++.
command used to make object file.
g++ -I$LEDAROOT/incl -c mult.cpp
this command runs fine
I am getting eroor while linking step.
HERE IS THE EROOR
varun#Kinley:~/Documents/LEDA/test/numbers$ g++ -L$LEDAROOT mult.o -lleda -lX11 -lm
/usr/bin/ld: cannot find -lX11
collect2: error: ld returned 1 exit status
I think I need to install some package,because when I googled this error the most of problems are solved by installing some package .
I didn't find lx11 error
some of the eroor messages that I googled.
error 1
/usr/bin/ld: cannot find -lfreetype collect2: ld returned 1 exit
status
error 2
/usr/bin/ld: cannot find -lz collect2: ld returned 1 exit status
Links where I find these posts
http://www.qtcentre.org/threads/21069-collect2-ld-returned-1-exit-status
http://www.cyberciti.biz/faq/centos-rhel-redhat-usrbinld-cannot-findlc-error/
Do I need to install some package or there is some other problem
Could be two things
1) The X11 library is installed in a non-standard path. Use the search command to see if libX11.a or libX11.so is available on your system. If yes add the directory path to the -L option.
2) You are missing the libX11 library.
In this case, login as admin and use yum (assuming linux) to install this library.
Eg:
"yum install libX11.i386" or "yum install libX11.x86_64", depending on your architecture (32 bit or 64 bit).

g++ -m32 can not find libstdc++ on debian amd64

I got the following error when compiling a simple hello world program on debian amd64 wheezy(testing) with g++ -m32:
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
I don't have any problems with gcc -m32. I also installed lib32stdc++ package, but it does not seem to work. Thanks.
Pretty sure you need to install g++-4.6-multilib (it would appear you already have gcc-4.6-multilib).
Try installing ia32-libs-dev package.