I have installed the latest libpng via homebrew on my M1 Pro MacBook. When I compile my C++ program using g++ and the flag -lpng, it says:
ld: library not found for -lpng
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mp1] Error 1
I used this command pkg-config --cflags --libs libpng , and it tells me this:
-I/opt/homebrew/Cellar/libpng/1.6.39/include/libpng16 -L/opt/homebrew/Cellar/libpng/1.6.39/lib -lpng16
I check these two paths and libraries and libpng.a and libpng16.16.dylib available.
I don't know why I cannot use that flag and any explanation is appriciated in advance.
Related
I'm trying to build the "hugin" package (https://launchpad.net/hugin) with emscripten.
The cmake command runs fine in native Linux, but the equivalent emscripten command returns errors.
With g++ the following command finishes successfully (and following that I can build the executables with "make all")
cmake ../
With emscripten, the following command:
cmake -DCMAKE_TOOLCHAIN_FILE=~/emscripten/emsdk-portable/emscripten/1.37.28/cmake/Modules/Platform/Emscripten.cmake ../
gives an error:
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS)
What am I missing?
Thanks,
Avner
I followed all the instructions for setting up gmp with cygwin,
./configure make make install and make check.
The libgmp.a is in the path C:/C++/gmp-6.1.2/.libs
I'm using this command to compile with g++
g++ -L/C:/C++/gmp-6.1.2/.libs -I/C:/C++/gmp-6.1.2 C:/foo/foo.cpp -lgmp
I get an error message that says : could not find -lgmp
What am i missing?
Why not install the gmp from the cygwin distribution?
I am trying to install latest Redis on my Macbook Pro running 10.8.5 After downloading the tar ball, I am invited to make the project ....
Upon typing make:
LINK redis-server
Undefined symbols for architecture x86_64:
I realize Redis is awesome product, but man where is the DMG? I mean, do you realize how easy it is to install mongodb?
For those interested in the gory details on my mac:
unknownb8f6b11c7271:redis-2.8.19 Mac1$ make
cd src && make all
LINK redis-server
Undefined symbols for architecture x86_64:
"___atomic_add_fetch", referenced from:
_zmalloc in zmalloc.o
_zcalloc in zmalloc.o
_zrealloc in zmalloc.o
_zmalloc_used_memory in zmalloc.o
_zmalloc_get_fragmentation_ratio in zmalloc.o
"___atomic_sub_fetch", referenced from:
_zrealloc in zmalloc.o
_zfree in zmalloc.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[1]: *** [redis-server] Error 1
make: *** [all] Error 2
The easy way to install Redis on OS X is using Homebrew. Just install it and run:
brew install redis
This command install already compiled binaries to your system.
Do a
make distclean
first. make distclean should fix this by removing the built hiredis.
The next make should build all again.
[make distclean; CC=gcc make ] I use this command . it works for redis 5.0.6
Using Homebrew it is quite easy to install-
brew update
brew install redis
To check
redis-cli ping
if you are getting PONG
Then you are good to go(y)
I had the same problem while compile C++ project with redis api
BUT I'm using g++ to compile while you using cmake.
if one used g++ compile C++ with redis on Mac(M1), one can add
-lhreids
for project compiling.
It would work.
I am trying to compile my c++ project (working with g++ with boost) with clang. I have successfully compile boost-libraries (1.53) with clang tool-chain. I am using CMake to compile my project, compilation is failing with following error.
In file included from /home/dilawar/Works/hpc21/bliff/BlifParserAndPartitioner/src/expression_graph.h:21:
/usr/local/include/boost/graph/graph_traits.hpp:14:10: fatal error: 'iterator' file not found
#include <iterator>
^
1 error generated.
I am passing -stdlib=libc++ to compiler. I am not sure which package I should install (ubuntu) to install libc++. I have clang and llvm installed on my machine.
Do I have to download and compile libc++ or it is installed automatically when one install clang?
When you pass -stdlib=libc++ the clang driver looks for header files in a different
directory w.r.t. when you don't pass the flag. You have to install libc++ separately. The libc++ webpage (http://libcxx.llvm.org/) has some details on how to install libc++ using CMake.
This webpage might also be useful:
http://marshall.calepin.co/llvmclang-and-standard-libraries-on-mac-os-x.html
Dipping my toe into command prompts.. totally lost.
I've installed Homebrew, and attempted to install libjpeg and optipng via brew install libjpeg optipngand have run into errors. I'm not sure how exactly to describe them.. so here's the code! I'm in Terminal on a Mac running OSX 10.6.7
Thank you SO much for the help.
1961:~ Daniel$ brew install libjpeg optipng
==> Downloading http://www.ijg.org/files/jpegsrc.v8c.tar.gz
File already downloaded and cached to /Users/Daniel/Library/Caches/Homebrew
==> ./configure --prefix=/usr/local/Cellar/jpeg/8c --disable-dependency-tracking
checking build system type... i386-apple-darwin10.7.3
checking host system type... i386-apple-darwin10.7.3
checking target system type... i386-apple-darwin10.7.3
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking for style of include used by make... none
checking for gcc... /usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/private/tmp/homebrew-jpeg-8c-42or/jpeg-8c':
configure: error: C compiler cannot create executables
See `config.log' for more details
==> Exit Status: 77
http://github.com/mxcl/homebrew/blob/master/Library/Formula/jpeg.rb#L11
==> Environment
HOMEBREW_VERSION: 0.8
HEAD: (none)
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: 8-core 64-bit dunno
OS X: 10.6.7
Kernel Architecture: x86_64
Ruby: 1.8.7-174
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode:
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2335
MacPorts or Fink? false
X11 installed? true
==> Build Flags
CC: /usr/bin/cc
CXX: /usr/bin/c++
LD: /usr/bin/cc
CFLAGS: -O3 -w -pipe -arch i386 -arch x86_64
CXXFLAGS: -O3 -w -pipe -arch i386 -arch x86_64
LDFLAGS: -arch i386 -arch x86_64
MAKEFLAGS: -j8
Error: Failed executing: ./configure --prefix=/usr/local/Cellar/jpeg/8c --disable-dependency-tracking
Please report this bug: https://github.com/mxcl/homebrew/wiki/new-issue
These existing issues may help you:
https://github.com/mxcl/homebrew/issues/#issue/4442
It looks like an autotools configure failed.
Consider re-running the install with '-vd' to keep 'config.log' around:
brew install -vd jpeg
Gist 'config.log' and any error output when reporting an issue.
Remember to include your config information: brew --config
Also try:
`brew doctor` to check your setup for common problems.
`brew missing` to check installed packages for missing deps.
1961:~ Daniel$ brew doctor
We couldn't detect gcc 4.2.x. Some formulae require this compiler.
We couldn't detect gcc 4.0.x. Some formulae require this compiler.
/usr/bin is in your PATH before Homebrew's bin. This means that system-
provided programs will be used before Homebrew-provided ones. This is an
issue if you install, for instance, Python.
Consider editing your .bashrc to put:
/usr/local/bin
ahead of /usr/bin in your $PATH.
Some brews install binaries to sbin instead of bin, but Homebrew's
sbin was not found in your path.
Consider editing your .bashrc to add:
/usr/local/sbin
to $PATH.
"Git" was not found in your path.
Homebrew uses Git for several internal functions, and some formulae
use Git checkouts instead of stable tarballs.
You may want to do:
brew install git
You have an "autoconf" in your path blocking the system version at:
Custom autoconf in general and autoconf 2.66 in particular has issues
and will cause some Homebrew formulae to fail.
1961:~ Daniel$ brew install git
==> Downloading http://kernel.org/pub/software/scm/git/git-1.7.5.tar.bz2
######################################################################## 100.0%
==> make prefix=/usr/local/Cellar/git/1.7.5 install
==> Exit Status: 1
http://github.com/mxcl/homebrew/blob/master/Library/Formula/git.rb#L31
==> Environment
HOMEBREW_VERSION: 0.8
HEAD: (none)
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: 8-core 64-bit dunno
OS X: 10.6.7
Kernel Architecture: x86_64
Ruby: 1.8.7-174
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode:
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2335
MacPorts or Fink? false
X11 installed? true
==> Build Flags
CC: /usr/bin/cc
CXX: /usr/bin/c++
LD: /usr/bin/cc
CFLAGS: -O3 -w -pipe
CXXFLAGS: -O3 -w -pipe
MAKEFLAGS: -j8
Error: Failed executing: make prefix=/usr/local/Cellar/git/1.7.5 install
Please report this bug: https://github.com/mxcl/homebrew/wiki/new-issue
Also try:
`brew doctor` to check your setup for common problems.
`brew missing` to check installed packages for missing deps.
1961:~ Daniel$ brew missing
1961:~ Daniel$ brew doctor
We couldn't detect gcc 4.2.x. Some formulae require this compiler.
We couldn't detect gcc 4.0.x. Some formulae require this compiler.
/usr/bin is in your PATH before Homebrew's bin. This means that system-
provided programs will be used before Homebrew-provided ones. This is an
issue if you install, for instance, Python.
Consider editing your .bashrc to put:
/usr/local/bin
ahead of /usr/bin in your $PATH.
Some brews install binaries to sbin instead of bin, but Homebrew's
sbin was not found in your path.
Consider editing your .bashrc to add:
/usr/local/sbin
to $PATH.
"Git" was not found in your path.
Homebrew uses Git for several internal functions, and some formulae
use Git checkouts instead of stable tarballs.
You may want to do:
brew install git
You have an "autoconf" in your path blocking the system version at:
Custom autoconf in general and autoconf 2.66 in particular has issues
and will cause some Homebrew formulae to fail.
Try downloading and installing the Xcode development suite: http://developer.apple.com/xcode/
That will provide gcc (complier) to build the software