When compiling GCC it is possible to get very far in the build process only to hiccup on an error complaining about the lack of gperf installed. After installing gperf and running, I hit an "undefined reference to libc_name_p." I've looked at the solutions here and here but they weren't helpful.
When gperf wasn't installed, the compilation script ran the command anyway but generated a blank ./gcc/cp/cfns.h. Since this file was newer than the source (./gcc/cp/cfns.gperf) the makefile left it alone and never regenerated the 'real' file when you actually had gperf. To continue, run rm ./gcc/cp/cfns.h and try again.
Related
I am getting a linking error while compiling opencv with cuda on Mac OS X high Sierra (10.13.6).
Error message:
[ 21%] Linking CXX shared library ../../lib/libopencv_cudev.dylib
ld: warning: directory not found for option '-L/Users/unknownn/opencv/-Wl,-rpath,/usr/local/cuda'
ld: warning: directory not found for option '-L-Wl,-rpath,/usr/local/cuda'
ld: library not found for -llib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libopencv_cudev.4.0.1.dylib] Error 1
make[1]: *** [modules/cudev/CMakeFiles/opencv_cudev.dir/all] Error 2
make: *** [all] Error 2
I have already tried pretty much every cuda (9, 9.2, 10) and opencv (3.4, 4.0.1) version. Also I am aware that every cuda version requires a specific Xcode version.
I have also tried various cmake versions
I checked for the correct cuda paths in ccmake.
I dont know why the ld warnings appear since /usr/local/cuda exist.
What is -llib?
I had the same problem as well, what's interesting is that the problem does not appear to be with OpenCV, but with cmake.
The FindCUDA that comes with cmake seems to be broken, producing that strange -llib. You can see it during the cmake run as well as:
Extra dependencies: cudart_static lib nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda/lib -L-Wl,-rpath,/usr/local/cuda
(Note the second element "lib", the last two -L... elements will cause problem when you do make install as well)
However, the opencv source package comes with FindCUDA.cmake files that seem to work.
Assuming:
cmake is in /usr/local/share/cmake
opencv source is in ~/opencv
Do the following first:
mv /usr/local/share/cmake/Modules/FindCUDA* /tmp # Or some other back up location
cp -r ~/opencv/cmake/FindCUDA* /usr/local/share/cmake/Modules
Then run your build steps as before (cmake ..., make ..., make install), and hopefully it will work this time (it did for me).
As far as I can tell, cmake has deprecated FindCUDA.cmake, so I'm guessing it won't get fixed any time soon.
Answer by Jack Leow was very usefull, but I had to make farther investigation, because indeed his solution doesn't work any more.
Finally I have found this answer on opencv github by alalek. If in short, he proposes to add following cmake definition:
-DOPENCV_CUDA_FORCE_BUILTIN_CMAKE_MODULE=ON
This solution works to me.
P.S.: Currently I managed to solve few more issues on my way to get awesome opencv build. But currently build is in progress (44%) hope it will be finished in next half an hour, haha!
sorry, although this workaround worked once with opencv-3.4.9 / XCode8.2 (Clang 8) / CMake 3.12, now the switching of the FindCUDA files does not work anymore with the combination
opencv-3.4.9 / XCode9.2 (Clang 9) / CMake 3.16 with the following error:
CMake Error at /Applications/CMake.app/Contents/share/cmake3.16/Modules/FindCUDA.cmake:416 (file):
file failed to open for writing (Permission denied):
/Users/filippo/opencv- 3.4.9/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_genera ted_gpu_mat.cu.o.depend
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindCUDA.cmake:1363 (cuda_include_nvcc_dependencies)
/Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindCUDA.cmake:1650 (CUDA_WRAP_SRCS)
/Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindCUDA.cmake:1663 (cuda_compile_base)
cmake/OpenCVDetectCUDA.cmake:262 (CUDA_COMPILE)
cmake/OpenCVUtils.cmake:1513 (ocv_cuda_compile)
cmake/OpenCVModule.cmake:927 (ocv_add_library)
cmake/OpenCVModule.cmake:848 (_ocv_create_module)
modules/core/CMakeLists.txt:81 (ocv_create_module)
I had to update XCode to the 9.2 because I had a "nullability" compiling error in the building opencv-3.4.9 probably caused by Clang.
I've just installed CLion and i needed compiler. I installed Cygwin.
But there was an error:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
CMake Error: Error executing cmake::LoadCache(). Aborting.
Error code: 1
So, CMake was "bundled" and i tried to install it from site. But there was the next error:
Selected CMake might be incompatible with the Cygwin environment.
In order to run on Cygwin, CMake needs to be specially compiled.
Please select either CMake bundled with CLion or CMake from the Cygwin installation.
CMake Error: The source directory "/cygdrive/c/Users/Пользователь/AppData/Local/Temp/cmake_check_environment" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
Error code: 1
Then i've tried to install MinGW - this time it was the following problem:
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe -- broken
CMake Error at D:/CLion 182.2574.4/bin/cmake/share/cmake-3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"D:/MinGW/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp
Run Build Command:"D:/MinGW/mingw64/bin/mingw32-make.exe" "cmTC_a4ce5/fast"
D:/MinGW/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_a4ce5.dir\build.make CMakeFiles/cmTC_a4ce5.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj
D:\MinGW\mingw64\bin\gcc.exe -o CMakeFiles\cmTC_a4ce5.dir\testCCompiler.c.obj -c C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
mingw32-make.exe[1]: *** [CMakeFiles\cmTC_a4ce5.dir\build.make:65: CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:125: cmTC_a4ce5/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".
Error code: 1
In both cases it's problems with paths, i think. I tried to give root to CLion, gcc, etc. - nothing.
I've tried to find logs or just way to this path - but all was worthless - path doesn't exist.I just can't find out, why that's happening.
Help me, please
Looks like there is a problem with encodings somewhere between windows/cygwin/clion/cmake (I assume you user name is non-ascii).
As a quick workaround try:
installing CLion in the location without non-latin symbols
changing CLion's system and config folders to the location without non-latin symbols. instructions
And to troubleshoot the problem, could you please check if the cygwin's console shows the user home path correctly? (e.g. use ls /cygdrive/c/Users/, then cd to the user home path).
If Cygwin can correctly work with the user home, could you please file a bug report and attach CLion's log files? (Help | Show Log in Explorer)
-- Question solved --
This question is solved. Thanks for all the help!
The problem and the reason is briefly stated as following for other readers in the future:
[Environment]
Ubuntu 14.04, Bazel, C++
[Question]
I want to include an external library. So I download the source file and make it as as a static lib .a.
I correctly set the BUILD, WORKSPACE and related files. However, when compile, it alerts the error:
Linking of rule '//main' failed (Exit 1)
main: error: undefined reference to 'void ex_lib::compute(double*, double const*, double const*)'
collect2: error: ld returned 1 exit status
I tried with the .lo and alwayslink method here but doesn't work.
Alternate to "`--whole-archive`" in bazel
[Reason]
It is because that the external library source files contains duplicate header files. So I fix the header file problem. Make the .a again. Then everything works.
So nothing wrong with the bazel. It is the library itself that cause the problem. But the error information is confusing and I think it is caused by bazel.
What you can do to investigate further is to run the clean bazel build with --subcommands to see individual command lines of actions executed. Then you can cd into the sandbox, and execute the same gcc command as bazel does and debug what's wrong. Or you can try to get linking to work by handwriting gcc command, and pasting here both the command bazel generated, and your desired command. Is it possible that you have multiple liegroups libs installed on the system and gcc is getting one that's incompatible with headers you're including?
The problem is solved. Special thanks to mhlopko.
It is mainly because there is errors with the lib source file. Thus .a file I use contains errors. Now the bazel works fine with the new lib file.
By the way, now bazel works fine with both .a or .so file that I generated.
I recently change my OS to the last mint cinamon. Compiling one of the library I need (and that I used to used without problem), I get this message:
fatal error: Eigen/Core: No such file or directory compilation terminated.
I don't know what to do.
Thanks for the help.
Including directory /usr/local/include/eigen3/ solved this for me.
Like this, for example:
g++ -I/usr/local/include/eigen3/ CODE.cpp -o EXECUTABLE
Try to install eigen3 library,
on Ubuntu it would be
sudo apt-get install libeigen3-dev
I am trying to build a program that relies on wxWidgets to run properly. I have the latest version of Xcode installed. I have tried building wxWidgets (both wxWidgets-3.0.2 and wxWidgets-2.9.4, the version originally used by the main program). However, in both cases, running the makefile for the main program gives the following error:
make: /Users/path to wxWidgets/wxWidgets-2.9.4/build-cocoa-release/utils/wxrc/wxrc: No such file or directory
As I understand it, I need to build wxrc to get my main program to build properly (I have tried this, but apparently some header files are missing). Is there any way to configure wxWidgets before this step that will automatically build wxrc as well? Or is that something I need to build separately? If it is separate, how would that be done?
I've pasted the code I originally used to configure wxWidgets below, with line breaks to make it easier to read:
../configure --with-osx_cocoa --with-macosx-version-min=10.7
--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
--prefix="$(pwd)" --with-opengl CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++ -std=c++11"
OBJCXXFLAGS="-stdlib=libc++ -std=c++11" LDFLAGS=-stdlib=libc++
There is one error while building wxWidgets:
../src/osx/cocoa/utils.mm:250:28: error: cannot initialize a parameter of type 'id' with an lvalue of type
'wxNSAppController *'
[NSApp setDelegate:appcontroller];
When I go into the samples directory and enter "make", I get: ld: library not found for -lwx_osx_cocoau_xrc-2.9 clang: error: linker command failed with exit code 1 (use -v to see invocation) When entering "make" in demos, I get: ld: library not found for -lwx_osx_cocoau_core-2.9 clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I missed any steps I should have taken before these (something with Xcode maybe?) please let me know. Thank you very much in advance.
Similar question. I have sugested a workaround proposed on a forum as follows: you can use --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/".