When using emscripten we can print a list of ported libraries with emcc --show-ports the output will be like:
Available ports:
ogg (USE_OGG=1; zlib license)
SDL2_gfx (zlib license)
SDL2_image (USE_SDL_IMAGE=2; zlib license)
giflib (USE_GIFLIB=1; MIT license)
SDL2_net (zlib license)
...
How can we find out the exact version of a ported library emcc?
Related
I am trying to build a glfw and glew c++ code but while building I am getting the following error:
fatal error C1034: GL/glew.h: no include path set
any help is appreciated.
OS: Windows 10
compiler: MSVC++ 17.0.3
package-installer: vcpkg
IDE: Visual Studio Code
Build: Cmake
CmakeLists.txt :
cmake_minimum_required(VERSION 3.0.0)
project(my_project VERSION 0.1.0)
include(CTest)
enable_testing()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_TOOLCHAIN_FILE C:/Users/pc/vcpkg/scripts/buildsystems/vcpkg.cmake)
add_executable(
my_project
main.cpp
)
INCLUDE_DIRECTORIES(
c:/Users/pc/vcpkg/installed/x86-windows/include/
)
LINK_DIRECTORIES(
c:/Users/pc/vcpkg/installed/x86-windows/lib/
)
find_package(fmt CONFIG REQUIRED)
find_package(GLEW REQUIRED)
find_package(glfw3 REQUIRED)
find_package(freetype CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED)
TARGET_LINK_LIBRARIES(my_project
glfw glm::glm GLEW::GLEW freetype fmt::fmt
)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
Setting CMAKE_TOOLCHAIN_FILE after project(my_project VERSION 0.1.0) does not work since project(my_project VERSION 0.1.0) loads the CMAKE_TOOLCHAIN_FILE. So move it before project()
Also remove
INCLUDE_DIRECTORIES(
c:/Users/pc/vcpkg/installed/x86-windows/include/
)
LINK_DIRECTORIES(
c:/Users/pc/vcpkg/installed/x86-windows/lib/
)
since linking against the above targets should be more than enough! (also always use target_* functions instead.)
Furthermore increase
cmake_minimum_required(VERSION 3.0.0)
to something reasonable. You probably don't plan on supporting ancient versions of cmake. If you don't need to support ancient linux distros you can just move to at least 3.17. If you only plan to support windows you can directly move to 3.22 or use whatever vs uses. vcpkg is currently at 3.21.
In opencv compilation, we need gtk. I have gtk-2.0 and gtk-3.0 installed.
This command gave me
dpkg -l libgtk2.0-0 libgtk-3-0
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii libgtk-3-0:amd 3.10.8-0ubun amd64 GTK+ graphical user interface lib
ii libgtk2.0-0:am 2.24.23-0ubu amd64 GTK+ graphical user interface lib
ii libgtk2.0-0:i3 2.24.23-0ubu i386 GTK+ graphical user interface lib
I have gtk-2.0 and gtk-3.0 folder inside /usr/include/.
They exist as /usr/include/gtk-2.0 and /usr/include/gtk-3.0
But my compilation for opencv gave me error as
src/window_gtk.cpp:48:21: fatal error: gtk/gtk.h: No such file or directory
#include "gtk/gtk.h"
^
compilation terminated.
I have gtk/gtk.h inside both gtk-2.0 and gtk-3.0 folders.
What could be wrong?
First, use brackets instead of double quotes searches in your include if that's not a file that belongs to your project, but a third-party one.
We also need to know which version of opencv you're trying to compile. OpenCV 2.x support GTK+ 2 only, whereas OpenCV 3.x support GTK+ 3.
We also need how you call cmake when you configure the OpenCV project, so please add the command line and the logs of that call too.
This will help determine the arguments given to the compiler, to check it uses the right include locations, and also check that it's trying to use the GTK+ backend and not the Qt one for example.
I have tried to build OpenCV 3.1 using CMake (the gui version) to enable Cuda. I have installed Cuda version 7.5 64-bit and CMake automatically found the correct path to the Cuda toolkit. I made sure that the WITH_CUDA value was set to ON, and pressed configure. This is what I got concerning Cuda:
CUDA detected: 7.5
CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_30,code=compute_30
...
Extra dependencies: comctl32 gdi32 ole32 setupapi ws2_32 vfw32 cudart nppc nppi npps cufft -LC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/lib/x64
...
Other third-party libraries:
Use IPP: 9.0.1 [9.0.1]
at: C:/OpenCV-3.1.0/opencv/sources/3rdparty/ippicv/unpack/ippicv_win
Use IPP Async: NO
Use Eigen: NO
Use Cuda: YES (ver 7.5)
Use OpenCL: YES
Use custom HAL: NO
NVIDIA CUDA
Use CUFFT: YES
Use CUBLAS: NO
USE NVCUVID: NO
NVIDIA GPU arch: 20 21 30 35
NVIDIA PTX archs: 30
Use fast math: YES
Then I generate using Visual Studio 12 2013 Win64.
Next I open the newly generated OpenCV.sln project in Visual Studio 2013 and build the project. It completes without any errors, but 103 warnings like this:
LINK : warning LNK4044: unrecognized option '/LC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/lib/x64'; ignored
OpenCV builds just fine and I can build programs with it. I can also include "opencv2/core/cuda.hpp" without any problem. However, when I try to use cuda::getDevice() i get this error:
OpenCV Error: No CUDA support (The library is compiled without CUDA support) in throw_no_cuda, file C:\builds\master_PackSlave-win64-vc12-shared\opencv\modules\core\include\opencv2/core/private.cuda.hpp, line 97
When I print the information from cv::getBuildInformation() i get:
Other third-party libraries:
Use IPP: 9.0.1 [9.0.1]
at: C:\builds\master_PackSlave-win64-vc12-shared\opencv\3rdparty/ippicv/unpack/ippicv_win
Use IPP Async: NO
Use Eigen: NO
Use Cuda: NO
Use OpenCL: YES
Use custom HAL: NO
It seems Cuda is disabled somewhere in the process, but I can't figure out why. I have tried to reconfigure and rebuild several times with the same results. Would love some help on this!
The problem is CMake: it generates wrong link options for Visual Studio.
LINK : warning LNK4044: unrecognized option '/LC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/lib/x64'; ignored
It should be "LIBPATH:C:" instead of "LC:".
To fix the problem:
Generate the solution with CMake
Go to the build directory
Open an IDE/Text editor which is able to do a global search in this directory
For each occurrence of "-LC:" in any file, replace it by "-LIBPATH:C:".
========= EDIT =========
I found the problem, it is in CMakeLists.txt :
foreach(p ${CUDA_LIBS_PATH})
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} -L${p})
endforeach()
Instead of using "${CMAKE_LIBRARY_PATH_FLAG}" which automatically put -LIBPATH, someone put "-L"...
So to fix it:
Open CMakeLists.txt
Replace "-L" by "${CMAKE_LIBRARY_PATH_FLAG}"
Configure & Generate the solution with CMake and compile with VS.
Hope it will help!
You can successfully compile OpenCV with Cuda after manually editing CMakeLists.txt as Dubrzr say.
Also You will have the same result if you download and compile OpenCV straight from github. It is already fixed.
I'm writing a little self-educational project. It has to do with Clang and LLVM internals hacking.
But while I was investigating the code base and reading documentation, strange things were going on with the build process.
What I am trying to do for starters is to build LLVM and Clang for SPARC target. But this rather simple task turns out to be quiet challenging.
I use sources from the stable release 3.4.2 and folder tree looks like that:
llvm/
...
projects/
...
test-suite <-- test-suite-3.4.src.tar.gz extracted here
tools/
...
clang/ <-- cfe-3.4.2.src.tar.gz extracted here
....
tools/
....
extra <-- clang-tools-extra-3.4.src.tar.gz extracted here
And from the intermediate folder (which lays on the same level as llvm) I call the following:
../llvm/configure --disable-optimized --enable-targets=sparc \
--prefix=/home/wf34/projects/helloClang/built
Surprisingly, resulting clang and llvm cannot deal with SPARC arch.
../built/bin/clang file2.c -S --target=sparc-unknown-linux -emit-llvm -o -
Gives (amongst the others) following line:
clang: warning: unknown platform, assuming -mfloat-abi=soft
Result is the same, if I write just --target=sparc.
Finally, attaching result of the llc --version:
LLVM (http://llvm.org/):
LLVM version 3.3
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: corei7-avx
Registered Targets:
cpp - C++ backend
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
Thank you for your insight and ideas!
Edit
Actually, having all that written, I have a guess that maybe I might have been mistaken while getting and untaring and setting the source from stable release. Maybe I would be better off following manual steps directly and getting source from svn trunk. I will fall back to that option if I won't receive any more meaningful suggestion.
I need to compile OpenCV statically linked with libstdc++ to avoid problems of different dll versions of libstdc++-6.dll needed by Qt5 and OpenCV. Following the steps of this article: http://www.argong.com/docs/how-to-OpenCV-2.2.0.pdf and adding the lines below to CMakeLists.txt i expected to get the OpenCV DLLs statically linked with libstdc++, but the OpenCV continues dependent of the libstdc++-6.dll. What i'm doing wrong to get the OpenCV libraries statically linked with libstdc++?
if (MINGW)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++ -s")
endif()
First ensure you're not pulling dependencies on libraries that link on shared system libraries. You can for example enable compilation of bundled source components like zlib, jpeg, etc., with flags BUILD_ZLIB, BUILD_JPEG, etc. You can also disable dependencies on optional components like Vtk (WITH_VTK flag) and others that may be already present in the system as shared libraries. Then, if you are building OpenCV as a shared library, push the setting on the shared linker flags variable (CMAKE_SHARED_LINKER_FLAGS) in the cache with cmake -C command:
set(CMAKE_SHARED_LINKER_FLAGS "-static -static-libgcc -static-libstdc++" CACHE INTERNAL "" FORCE)
Alternatively, if you are compiling OpenCV statically with -DBUILD_SHARED_LIBS=FALSE, you can plug gcc linker flags for static linking on your final shared object or executable.