I'm trying to compile some C++/OpenGL source codes in FreeBSD-10.2-RELEASE.
To be specific, I'm following the instruction below:
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/#Building_on_Linux
In step 6, I got an error message says:
In file included from /home/(my username)/Downloads/OpenGL-tutorial_v0014_33/external/glew-1.9.0/src/glew.c:32:
/home/(my username)/Downloads/OpenGL-tutorial_v0014_33/external/glew-1.9.0/include/GL/glew.h:1180:14: fatal error:
'GL/glu.h' file not found
# include <GL/glu.h>
^
1 error generated.
*** Error code 1
Stop.
I installed some packages such as graphics/glew, graphics/glfw, math/glm, graphics/libGL, graphics/libGLU, etc, but it still fails.
What should I do to make them work?
Thank you.
In FreeBSD OpenGL includes are located in /usr/local/include, so you need -I/usr/local/include flag.
To make tutorials link properly, you'd also need to replace
set(ALL_LIBS
${OPENGL_LIBRARY}
GLFW_303
GLEW_190
)
with
set(ALL_LIBS
${OPENGL_LIBRARY}
glfw3
GLEW
)
Note that you seemingly using headers from older libraries, this might cause more problems.
Related
I would like to use Open3d in LAMMPS. Open3D details how to find the pre-installed Open3D package using cmake.
Using the above, I have written a cmake file that I believe LAMMPS uses during its build stage to find packages and link them. Curiously, the line
target_link_libraries(lammps PRIVATE Open3D::Open3D)
appears to cause the compiler to find errors in the LAMMPS src code, i.e.,
/home/USER/lammps/src/fmtlib_format.cpp:58:51: error: duplicate explicit instantiation of ‘struct fmt::v7_lmp::detail::basic_data<void>’ [-fpermissive]
58 | template struct FMT_INSTANTIATION_DEF_API detail::basic_data<void>;
If I comment the target_link_libraries statement, the code compiles just fine (but doesn't link to Open3D). Apologies for being unable to provide a MWE as I do not know how to replicate this behaviour in a simple manner. Could you please explain to me why the target_link_libraries command causes the compiler to find errors in the LAMMPS src code and provide a solution to prevent this from occuring? If relevant I am using Clion 2021.1.2 and
CMAKE_CXX_COMPILER_VERSION = 9.3.0
CMAKE_CXX_STANDARD = 11
CMAKE_VERSION = 3.19.2
CMake is giving me a real hard time, here. I checked out llvm, clang, and extras, and I created a custom driver folder, added it to the llvm\tools\clang\tools\extra\CMakeLists.txt and created my own CMakeLists.txt:
cmake_minimum_required(VERSION 3.8)
set(LLVM_LINK_COMPONENTS
Support
)
set(CMAKE_CXX_FLAGS ${LLVM_CONFIG})
set(CMAKE_CXX_COMPILER "clang++")
add_clang_executable(mydriver
main.cpp
)
set(CLANG_LIBS clangFrontend clangDriver clangSerialization clangParse
clangCodeGen clangSema clangAnalysis clangEdit clangAST clangLex
clangBasic )
target_link_libraries(mydriver ${CLANG_LIBS})
target_link_libraries(mydriver ${LLVM_LIBS})
CMake works fine. I target VS2017 and build the mydriver project with msbuild
λ msbuild tools\clang\tools\extra\mydriver\mydriver.vcxproj
This results in the following error:
"C:\dev\llvm-build\tools\clang\tools\extra\mydriver\mydriver.vcxproj" (default target) (1) ->
(ClCompile target) ->
C:\dev\llvm\tools\clang\tools\extra\mydriver\main.cpp(45): error C2027: use of undefined type 'clang::Preprocessor Options' [C:\dev\llvm-build\tools\clang\tools\extra\mydriver\mydriver.vcxproj]
C:\dev\llvm\tools\clang\tools\extra\mydriver\main.cpp(45): error C2228: left of '.addRemappedFile' must have class /struct/union [C:\dev\llvm-build\tools\clang\tools\extra\mydriver\mydriver.vcxproj]
C:\dev\llvm\tools\clang\tools\extra\mydriver\main.cpp(50): error C2664: 'void clang::CompilerInstance::setInvocati on(std::shared_ptr<clang::CompilerInvocation>)': cannot convert argument 1 from 'clang::CompilerInvocation *' to 'st d::shared_ptr<clang::CompilerInvocation>' [C:\dev\llvm-build\tools\clang\tools\extra\mydriver\mydriver.vcxproj]
However, clangLex is clearly included in the CLANG_LIBS variable in my CMakeLists.txt. The documentation of the clang::PreprocessorOptions class seems to indicate that I have the right libs included.
Any ideas?
Please note that this question is closely related to this one:
Generate assembly from C code in memory using libclang
In classic SO fashion, the problem was that the include file had migrated since the example was posted. The clang documentation requires a new header file, that is, in fact, in the include path. All I needed was:
#include <clang/Lex/PreprocessorOptions.h>
Sorry folks, nothing to see here.
I have been trying to use Matlab compiler SDK to packaging my Matlab program as C++ shared library in Debian system. I have got the folder including test.c, test.h, test.so (test is my Matlab program name), and I have installed the Matlab_runtime in the Debian system. I have set the variables LD_LIBRARY_PATH_ and _ XAPPLRESDIR_ as required in the readme.txt _ *( _ replace MCR_ROOT by the directory where the MATLAB Runtime is installed on the target machine.
(1) Set the environment variable XAPPLRESDIR to this value:
MCR_ROOT/v91/X11/app-defaults
(2) If the environment variable LD_LIBRARY_PATH is undefined, set it to the concatenation of the following strings:
MCR_ROOT/v91/runtime/glnxa64:
MCR_ROOT/v91/bin/glnxa64:
MCR_ROOT/v91/sys/os/glnxa64:
MCR_ROOT/v91/sys/opengl/lib/glnxa64_)*
.
I edit my main.cpp include test.h. when I try to compile the main.cpp use _ gcc main.cpp -o main_, I got the error as follows:
In file included from main.cpp:2:0:
test.h:15:22: fetal error: mclmcrrt.h: No such file or directory
#include "mclmcrrt.h"
I know that mclmcrrt.h is in the package of Matlab_runtime, it means I failed to link to the library of Matlab_runtime. Anybody knows what should I do to make my main.cpp compile successfully? I tried two days to work on how to connect to the Matlab_runtime library, but still failed. I am a beginner to linux. Great thanks if anyone can help.
This is a compilation problem, not linkage. Your compiler does not know where mclmcrrt.h is. Please help it find it by telling it where it is:
gcc -I<the_folder_where_mclmcrrt.h_lives_in> ...
I use MinGW64+msys on Winodws7 64bit
Now I’m trying to build CMAKE but I can’t.
When I typed ./configure soon an error happened. .
---------------------------------------------
CMake 3.2.3, Copyright 2000-2015 Kitware, Inc.
Found GNU toolchain
C compiler on this system is: gcc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C++ compiler on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.
I also find error messages in Bootstrap.cmk/cmake_bootstrap.log like bellow.
[First Message in the log file]
In file included from c:/mingw64/x86_64-w64-mingw32/include/c++/iosfwd:40:0,^M
from c:/mingw64/x86_64-w64-mingw32/include/c++/ios:38,^M
from c:/mingw64/x86_64-w64-mingw32/include/c++/ostream:38,^M
from c:/mingw64/x86_64-w64-mingw32/include/c++/iostream:39,^M
from cmake_bootstrap_4468_test.cxx:3:^M
c:/mingw64/x86_64-w64-mingw32/include/c++/bits/postypes.h:40:35: fatal error: cw
char: No such file or directory^M
compilation terminated.^M
[Second Message in the log file]
cmake_bootstrap_4468_test.cxx:5:23: fatal error: iostream.h: No such file or dir
ectory^M
compilation terminated.^M
Test failed to compile
They said cwchar and iostream.h doesn't exist, although I have them and set their path to environmental variable.
The first massage said my C++ compiler isn’t appropriate. I installed it by mingw-get.exe.
Does anyone know, how can I get appropriate C++ compiler?
You mixed two compilers. I recommend: delete your old one and install msys2+mingw64.
When trying to make GLEW with MSYS, I'm getting the following error:
In file included from src/glew.c:37:0:
include/GL/glxew.h:97:22: fatal error: X11/Xlib.h: No such file or directory
#include <X11/Xlib.h>
compilation terminated.
make: *** [tmp/mingw/default/shared/glew.o] Error 1
Why?
MSYS does not have X11. It's *M*inimal SYStem for a reason. You want Cygwin.
Or if you want to keep things Win32 native without Cygwin, take a look at Xming.