I ran g++ -g ./src/*.cpp -L/usr/lib/ -llua5.3
and got an error.
/usr/bin/ld: cannot find -llua5.3
collect2: error: ld returned 1 exit status
How can I make linker find lua library?
I've installed lua with this commands
wget -R -O http://www.lua.org/ftp/lua-5.3.0.tar.gz
tar zxf lua-5.3.0.tar.gz
cd lua-5.4.2
make linux
make install
I've installed apt install liblua5.3-dev instead of wget -R -O http://www.lua.org/ftp/lua-5.3.0.tar.gz to make it work
Related
I've "brew install xmake" on my mac, and having a .cpp file, I run xmake and it generates a xmake.lua in the directory. Then it reports:
error: cannot get program for cxx
I've installed clang (alias as g++). It works fine. I then:
$sudo ln -s /usr/bin/g++ /usr/local/bin/cxx
Well, running xmake again, but it still reports same error:
error: cannot get program for cxx
How to handle this? Thanks
----------------------I tried these, don't work:
$xmake f -p cross
$xmake
error: cannot get program for cxx
$export CC=clang LD=clang++ xmake
$xmake
error: cannot get program for cxx
----------------------See my diagnotics:
$xmake f -p cross -c
(In fact no output)
$xmake -r -v
configure
{
plat = cross
, arch = none
, ccache = true
, kind = static
, buildir = build
, host = macosx
, mode = release
, clean = true
}
checking for the g++ ... no
checking for the linker (ld: g++) ... no
checking for the gcc ... no
checking for the linker (ld: gcc) ... no
checking for the clang++ ... no
checking for the linker (ld: clang++) ... no
checking for the clang ... no
checking for the linker (ld: clang) ... no
error: cannot get program for ld
$which g++
/usr/bin/g++
$which clang
/usr/bin/clang
xmake will detect and use xcrun -sdk macosx clang on macOS. Do you have Xcode command line tools installed?
If not, you can switch to cross platform to compile it. for example
xmake f -p cross
xmake
It will use gcc/clang directly.
Or set --cc=clang or CC, LD envirnoment vars to modify compiler and linker.
xmake f -c --cc=clang --ld=clang++
xmake
Or
export CC=clang LD=clang++
xmake
It works now, please update to latest version.
I want to install an OpenCV version locally on OSX in a folder without overwriting the old installation that I need for an old executable.
I followed [these instructions][1], particularly the Building OpenCV from Source Using CMake, Using the Command Line section.
So basically I:
downloaded the source code with git and now it is in the subfolder openCV
Created a new directory cmake_bin_dir
Entered in cmake_bin_dir and created another subdirectory instDir
From the cmake_bin_dir I launched the command cmake -D CMAKE_BUILD_TYPE=DEBUG -D CMAKE_INSTALL_PREFIX=/my/home/Downloads/openCVProject/cmake_bin_dir/instDir/ ../openCV/
From the same directory I launched first make and then sudo make install. This created the *.dylib files in the cmake_bin_dir/instDir directory.
To test the installation I created my project directory (at the same level of cmake_bin_dir.
I tried to compile the file named test.cpp with the command:
g++ -std=c++11 -I../cmake_bin_dir/ -I../openCV/include -I../openCV/modules/core/include/ \
-I../openCV/modules/calib3d/include/ -I../openCV/modules/features2d/include \
-I../openCV/modules/flann/include -I../openCV/modules/dnn/include -I../openCV/modules/highgui/include/ \
-I../openCV/modules/imgcodecs/include -I../openCV/modules/videoio/include -I../openCV/modules/imgproc/include \
-I../openCV/modules/ml/include -I../openCV/modules/objdetect/include -I../openCV/modules/photo/include \
-I../openCV/modules/shape/include -I../openCV/modules/stitching/include -I../openCV/modules/superres/include \
-I../openCV/modules/video/include -I../openCV/modules/videostab/include test.cpp -o test.o
I added the include one by one because I got compilation error each time.
However now I getting a linkage error:
Undefined symbols for architecture x86_64:
"cv::String::deallocate()", referenced from:
cv::String::~String() in test-afd12e.o
cv::String::operator=(cv::String const&) in test-afd12e.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So my question is how can I compile my program and other projects using the local installation of the OpenCV library?
[1]: https://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html
Ok I found my error. If anybody will have the same problem try to execute this on terminal:
export DYLD_LIBRARY_PATH=../your/path/lib/:$DYLD_LIBRARY_PATH
In my case the I executed:
export DYLD_LIBRARY_PATH=../cmake_bin_dir/lib/:$DYLD_LIBRARY_PATH
I also created a Makefile with the following content:
CPP = g++ -std=c++11
# OpenCV trunk
CPPFLAGS = -L../cmake_bin_dir/lib/ \
-I../cmake_bin_dir/include \
-I../cmake_bin_dir/ -I../openCV/include -I../openCV/modules/core/include/ \
-I../openCV/modules/calib3d/include/ \
-I../openCV/modules/features2d/include \
-I../openCV/modules/flann/include -I../openCV/modules/dnn/include -I../openCV/modules/highgui/include/ \
-I../openCV/modules/imgcodecs/include -I../openCV/modules/videoio/include -I../openCV/modules/imgproc/include \
-I../openCV/modules/ml/include -I../openCV/modules/objdetect/include -I../openCV/modules/photo/include \
-I../openCV/modules/shape/include -I../openCV/modules/stitching/include -I../openCV/modules/superres/include \
-I../openCV/modules/video/include -I../openCV/modules/videostab/include \
`pkg-config --cflags --libs ../cmake_bin_dir/instDir/lib/pkgconfig/opencv.pc`
# Opencv 2.4.8
#CPPFLAGS = -L/home/krystof/libs/opencv-2.4.8/release/installed/libs \
-I/home/krystof/libs/opencv-2.4.8/release/installed/include
all: test
test: test.cpp
$(CPP) $(CPPFLAGS) $^ -o $#
Now executing make should build the program with the local openCV version.
I'm new to build and install opencv on my Ubuntu 14.04.
I follow pyimagesearch to do it.
After typing cmake command, I encounter some errors as follows.
I google some solutions and try to reinstall some packages, ex:gcc.
Still can not work... :(
for /usr/bin/ld: cannot find -lstdc++ problem, anyone has ideas?
thank you :)
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=/home/eric/program_files/OpenCV/opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
-- The CXX compiler identification is Clang 3.4.0
-- The C compiler identification is GNU 4.8.5
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/bin/clang++" is not able to compile a simple test
program.
It fails with the following output:
Change Dir:
/home/eric/program_files/OpenCV/opencv/build/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make "cmTryCompileExec3807027872/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3807027872.dir/build.make
CMakeFiles/cmTryCompileExec3807027872.dir/build
make[1]: Entering directory
`/home/eric/program_files/OpenCV/opencv/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/home/eric/program_files/OpenCV/opencv/build/CMakeFiles/CMakeTmp/CMakeFiles
1
Building CXX object
CMakeFiles/cmTryCompileExec3807027872.dir/testCXXCompiler.cxx.o
/usr/bin/clang++ -o
CMakeFiles/cmTryCompileExec3807027872.dir/testCXXCompiler.cxx.o -c
/home/eric/program_files/OpenCV/opencv/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTryCompileExec3807027872
/usr/bin/cmake -E cmake_link_script
CMakeFiles/cmTryCompileExec3807027872.dir/link.txt --verbose=1
/usr/bin/clang++
CMakeFiles/cmTryCompileExec3807027872.dir/testCXXCompiler.cxx.o -o
cmTryCompileExec3807027872 -rdynamic
/usr/bin/ld: cannot find -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make[1]: *** [cmTryCompileExec3807027872] Error 1
make[1]: Leaving directory
`/home/eric/program_files/OpenCV/opencv/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec3807027872/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:88 (project)
-- Configuring incomplete, errors occurred!
try:
sudo apt-get install g++
or
ln -s /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so
After installing opencv3 on my OSX,I run this command
g++ -ggdb `pkg-config --cflags --libs opencv` facedetect.cpp -o /tmp/test && /tmp/test
I got this error
ld: library not found for -lippicv
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If you're compiling with Mac OSX, I ran into the same problem and found a solution here, under "Install OpenCV 3 on Mac OSX with brew", "Troubleshooting":
# Find ippicv
find /usr/local -name "libippicv.a"
# For me it is /usr/local/Cellar/opencv3/3.1.0_3/share/OpenCV/3rdparty/lib/libippicv.a
# Make a symlink to /usr/local/lib
ln -s /some/path/OpenCV/3rdparty/lib/libippicv.a /usr/local/lib/
# I used
ln -s /usr/local/Cellar/opencv3/3.1.0_3/share/OpenCV/3rdparty/lib/libippicv.a /usr/local/lib/
Running setup.py bdist_wheel for gnureadline
Error:
DHAVE_RL_CALLBACK -DHAVE_RL_CATCH_SIGNAL -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_COMPLETION_SUPPRESS_APPEND -DHAVE_RL_PRE_INPUT_HOOK -I. -I/usr/include/python2.7 -c Modules/2.x/readline.c -o build/temp.linux-x86_64-2.7/Modules/2.x/readline.o
In file included from Modules/2.x/readline.c:31:0:
./readline/readline.h:385:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/Modules/2.x/readline.o readline/libreadline.a readline/libhistory.a -lncurses -o build/lib.linux-x86_64-2.7/gnureadline.so
/usr/bin/ld: cannot find -lncurses
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Mange Jenkins settings:
Python : CPython-2.7
Path: /usr/bin/python
The problem was gnureadline was in my requirements.txt and when building the virtual environments and installing requirements it could not install the package.
gnureadline isn't required on most OSes. As Ludwig points out in this post:
gnureadline [is only needed] on platforms that don't provide readline
at all, or that substitute readline for an incompatible product like
libedit (i.e. Mac OS X)
So the solution was simply to remove gnureadline from requirements.txt