Category Archives: How to Install

Ruby Install Error running ‘requirements_osx_brew_update_system ruby-2.3.1

Operating system: macOS 10.12.1

Install Ruby 2.3.1 error

The specific error message is as follows.

chaorenbuhuifeideMacBook-Air:~ chaorenbuhuifei$ rvm install 2.3.1

Searching for binary rubies, this might take some time.

Found remote file https://rubies.travis-ci.org/osx/10.12/x86_64/ruby-2.3.1.tar.bz2

Checking requirements for osx.

Installing requirements for osx.

Updating system…….

Error running ‘requirements_osx_brew_update_system ruby-2.3.1′,

showing last 15 lines of /Users/chaorenbuhuifei/.rvm/log/1481424365_ruby-2.3.1/update_system.log

https://github.com/Homebrew/homebrew/wiki/Common-Issues

and make sure `brew update` works before continuing.’

++ rvm_pretty_print stderr

++ case “${rvm_pretty_print_flag:=auto}” in

++ case “${TERM:-dumb}” in

++ case “$1” in

++ [[ -t 2 ]]

++ return 1

++ printf %b ‘Failed to update Homebrew, follow instructions here:

https://github.com/Homebrew/homebrew/wiki/Common-Issues

and make sure `brew update` works before continuing.\n’

Failed to update Homebrew, follow instructions here:

https://github.com/Homebrew/homebrew/wiki/Common-Issues

and make sure `brew update` works before continuing.

++ return 1

Requirements installation failed with status: 1.

Error running ‘requirements_osx_brew_update_system ruby-2.3.1’

 

How to Solve:

Step 1:

$ brew install autoconf automake libtool pkg-config apple-gcc42 libyaml readline libxml2 libxslt libksba openssl sqlite

This method will report error

Error: No available formula with the name “apple-gcc42”

==> Searching for similarly named formulae…

Error: No similarly named formulae found.

==> Searching taps…

This formula was found in a tap:

homebrew/dupes/apple-gcc42

To install it, run:

brew install homebrew/dupes/apple-gcc42

 

Step 2:

$brew install homebrew/dupes/apple-gcc42

 

then re-install

$rvm install 2.3.1

 

 

Error in PostgreSQL installation of win10

problem

The installation of PostgreSQL in win10 reports an error. The 10, 11 and 12 versions downloaded from the official website are not available. The error is as follows

there has been an error. Error running icacls
"c:\Users\abdo\AppData\Local\Temp/postgresql_installer_b4be1776ca"/T/Q/grant: Access is denied


How to fix
install this version https://get.enterprisedb.com/postgresql/postgresql-11.2-1-windows-x64.exe

https://superuser.com/questions/1475822/postgresql-install-fail-in-windows-10-icacls-error-access-denied

Python installation of third-party libraries reported an error: “these packages do not match the hashes from the requirements file.”

Problem: an error “these packages do not match the hashes from the requirements file” appears when installing the third-party library

Reason: the download error is usually caused by the network speed problem, resulting in the corresponding hash value does not match.

Solution: when pip is needed, add the “- upgrade” parameter. Usually, the download will report an error timeout at this time, so adding a “- default timeout = 100000” is more secure (the value of timeout can vary according to the situation).

pip install --upgrade --default-timeout=100000 packagename

Later, when installing pyqt5, I encountered the same problem. I still reported an error by using the above method. After using the online method, I solved the problem

# Install pyqt5
pip install PyQt5 -i https://pypi.douban.com/simple
# Install pyqt5-tools
pip install PyQt5-tools -i http://pypi.douban.com/simple --trusted-host=pypi.douban.com

Yaml Install ERROR: Cannot uninstall ‘PyYAML’.

Error: cannot install pyyaml.

Article Directory:

1.Error cause analysis II. Final error solution

1.Error analysis

1. Start installing
I started installing yaml </ code>, using the following command:

pip install yaml

It is installed correctly and can be imported correctly from the command line, and then an error is reported when executing the program: attributeerror: module 'yaml' has no attribute 'fullloader' </ code> then I checked the version of yaml I installed:

pip show yaml   # show is version 3.12, which is too old

2. Error exploration1
check the tutorial online and say that you want to update the yaml version to 5.2 . The update method is as follows:

pip install -U PyYAML

In the process of updating, an error was reported:

ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

And then continue to find out how to solve this problem. Most of the solutions given are: delete all the yaml files under site packages , and guess what, LZ has been deleted completely. As a result, it is still this by when installing. Are you angry or not!

3. Error exploration 2

But I had to go to pypi website to download the wheel, and then install it directly

PyYAML-5.2-cp27-cp27m-win_ amd64.whlPyYAML-5.2-cp27-cp27m-win32.whl

Then install the wheels directly:

pip install PyYAML-5.2-cp27-cp27m-win_amd64.whl
# Then it said the platform is not supported, I looked at the amd may not be supported, so I tried again 32

pip install PyYAML-5.2-cp27-cp27m-win32.whl
# Again, the platform is not supported, I'm speechless

it seems that exploration is a failure. Let's find another way!

2、 Final error resolution

Use the following installation method to solve the problem:

# it worked
pip install --ignore-installed PyYAML

Another one, I don’t test it. You can try it

pip install  --force-reinstall PyYAML

or

pip install docker-py --ignore-installed PyYAML

Reference:
1 https://github.com/pypa/pip/issues/5247
2、 https://stackoverflow.com/questions/49911550/how-to-upgrade-disutils-package-pyyaml

Vue project installs Axios to implement HTTP request

Contents of articles

First, install Axios. Second, use axios1. Introduce axios2. Get method. Third, post method

summary


preface

we all know that the front end needs to request some data and services asynchronously from the back end, which is the so-called Ajax technology. and Vue.js It has no Ajax capability, so it needs to use Axios to complete the Ajax request.


1、 Install Axios

Axios is a promise based HTTP library, which can be used in browsers and websites node.js Medium

Using NPM:

$ npm install axios

Using yarn:

$ yarn add axios

note: install in the root directory of Vue project, and select the configuration file of the project package.json With the corresponding version number, the installation is successful

2、 Using Axios

1. Introducing Axios

stay main.js When the file is injected into Axios:

import axios from 'axios'
Vue.prototype.$axios = axios  //The $axios before the equal sign can be replaced with another name, but use it consistently 

2. Get method

a relatively complete format: </ font>

this.$axios({ //The $axios here is the one named in main.js
            method: "get",
            url: "http://wthrcdn.etouch.cn/weather_mini",//an API for querying city weather
            headers:{
              'Content-type': "application/json;charset=utf-8"
            },
            params : { 
              city : "GuangZhou"
            },
            dataType:'json',
          })
          .then((res)=>{
            console.log(res.data);
            console.log("success")
          })
          .catch(function (error) {
            console.log(error);
            alert("Failed to connect server");
            console.log("fail")
          });

3. Post method

a relatively complete format: </ font>

this.$axios({
            method:"post",
            url:"http://test/...",
            headers:{
              'Content-type': "application/json;charset=utf-8"
            },
            data : { 
              a : '',
              b : ''
            },
            dataType:'json',
          })
          .then((res)=>{
            console.log(res.data);
            console.log("success")
          })
          .catch(function (error) {
            console.log(error);
            alert("Failed to connect server");
            console.log("fail")
          });

summary

for Axios, it is not too difficult to use without studying its principle. And through the above get and post methods, we can also find that its syntax is very similar to jQuery’s Ajax, and we can easily use it.

Use Maven install to type the war package, which shows that the package XXX does not exist

Today, a jar package has been introduced into the project. When install is typed as war package, the package XXX does not exist.

The solution is as follows: add a paragraph to the POM file.

<configuration>
	<source>1.7</source>
	<target>1.7</target>
	<!--Add this paragraph here, because my jar package is introduced under the WEB-INF path, so write this path here-->
	<compilerArguments>
		<extdirs>src/main/webapp/WEB-INF/lib</extdirs>
	</compilerArguments>
</configuration>

Finally, install succeeded!

Tensorflow: How to Use static_rnn

tf.nn.static_ rnn

Aliases:

tf.contrib.rnn.static_ rnn

tf.nn.static_ rnn

Use the specified RNN neurons to create a recurrent neural network

tf.nn.static_rnn(

    cell,

    inputs,

    initial_state=None,

    dtype=None,

    sequence_length=None,

    scope=None

)

Parameter Description:

  1. Cell: RNN neuron used in neural network, such as basic RNN cell, basic LSTM cell
  2. inputs: a list of length T, each element in the list is a tensor, which is in the form of: [batch]_ size,input_ size]
  3. initial_ state:RNN The initial state of, if cell.state_ If size is an integer, it must be of the appropriate type and shape, such as [batch]_ size, cell.state_ The tensor of [size]. as cell.state_ If size is a tuple, it should be a tensor tuple cell.state_ S in size should have the form of [batch]_ The tuple of the tensor of [size, S].
  4. Dtype: data type of initial state and expected output. Optional parameters.
  5. sequence_ Length: Specifies the length of each input sequence. The size is batch_ The vector of size.
  6. Scope: variable range

Return value:

A (outputs, state) pair

Outputs: a list of length T, in which each element is the corresponding output of each input. For example, one time step corresponds to one output.

State: the final state

Code example:

import tensorflow as tf



x=tf.Variable(tf.random_normal([2,4,3])) #[batch_size,timesteps,embedding_dim]

x=tf.unstack(x,axis=1) #Expand by time step

n_neurons = 5 # Number of output neurons



basic_cell = tf.contrib.rnn.BasicRNNCell(num_units=n_neurons)

output_seqs, states = tf.contrib.rnn.static_rnn(basic_cell,x, dtype=tf.float32)



print(len(output_seqs)) #Four time steps

print(output_seqs[0]) # Output one tensor per time step

print(output_seqs[1]) # output one tensor per time step

print(states) #Hide states

The output is as follows:

4 Tensor(“rnn/basic_rnn_cell/Tanh:0”, shape=(2, 5), dtype=float32) Tensor(“rnn/basic_rnn_cell/Tanh_1:0”, shape=(2, 5), dtype=float32) Tensor(“rnn/basic_rnn_cell/Tanh_3:0”, shape=(2, 5), dtype=float32)

Debian: How to install MariaDB

    1. command
apt install mariadb-server

sudo apt purge autoremove

No account password is required for local login, and IP / etc / MySQL can be remotely connected/ mariadb.conf . D directory, comment out this line or IP change

instead

    1. change the password of root
update mysql.user set password=password('ChinaSkill20!') where user='root';
flush privileges;

Create a remote user and set a password

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;

UNIX socket authentication is used by default. Some phpMyAdmin will have “access denied” error when logging in. We can use native MySQL authentication

update mysql.user set plugin = 'mysql_native_password' where User='root';   
flush privileges;  

restart

systemctl restart mariadb

Clion installing glfw_Using clion to configure Vulkan development environment on MacOS

preface
When learning graphics programming, in fact, in MacOS programming environment is the default Xcode, Windows and often use Visual Studio. But since I often have to switch programming between Windows and MacOS, occasionally switch to Ubuntu, and don’t want to switch between different IDEs repeatedly, I chose CLion. The nice thing about CLion is that it’s cross-platform.
Today, I spent several hours configuring the development environment of CLion +Vulkan on MacOS, which paved the way for learning Vulkan later. Those who know CLion know that C/C++ programming of CLion uses CMAKE to do engineering construction, which can force me to use a cross-platform architecture scheme, so that I can know the underlying engineering construction like the palm of my hand, and can also promote me to further understand and learn CMAKE.
My work environment
MacOS: Big Sur

gcc version

~/C/V/shaders ❯❯❯ gcc --versionConfigured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1Apple clang version 12.0.0 (clang-1200.0.32.27)Target: x86_64-apple-darwin20.2.0Thread model: posixInstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Configure the Lib required by Vulkan
Vulkan MacOS configuration mainly refers to the Vulkan Tutorial Development Environment. However, many MacOS articles only provide Xcode configuration, but the dependency on the file package is the same. Three main things are needed: Vulkan SDK, GLFW, and GLM.
Let’s take a look at how to install each of these.
Vulkan SDK installation
Vulkan SDK can be downloaded from https://vulkan.lunarg.com/sdk/home directly. See Getting Started with the MacOS Vulkan SDK for details on the installation process. In the process of specific installation, I adopted the step of Install the SDK-alternate method using system paths. Run the Python installation script that comes with the SDK to install:

sudo ./install_vulkan.py

The script is to install the Vulkan SDK libraries and header files in /usr/local.
/usr/local/lib is one of the directories that linker searches for required libraries. The lib installed by the user is stored in the /usr/local folder. The CLion search library is based mainly on the directories specified by the include_directories defined by Cmake.

Copying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-opt to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/vkvia to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/SPVRemapperTargets-release.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/SPIRV-Tools to /usr/local/lib/cmake/vulkan/SPIRV-ToolsCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-link to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-cfg to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-c-shared.0.44.0.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-val to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/include/vulkan to /usr/local/include/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/SPIRVTargets.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libSPIRV.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/MoltenVKShaderConverter to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/glslangTargets-release.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/share/vulkan to /usr/local/share/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libshaderc_util.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libSPIRV-Tools.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/vulkaninfo to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-as to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libSPIRV-Tools-opt.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/SPIRVTargets-release.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/Applications/vkconfig.app to /Applications/vkconfig.appCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/glslangValidatorTargets.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/OGLCompilerTargets.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-c-shared.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-cpp.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/glslc to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/HLSLTargets.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/Applications/vkcubepp.app to /Applications/vkcubepp.appCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libGenericCodeGen.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-c-shared.0.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-glsl.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-msl.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-remap to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-dis to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/include/spirv_cross to /usr/local/include/spirv_crossCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/SPIRV-Tools-link to /usr/local/lib/cmake/vulkan/SPIRV-Tools-linkCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/SPVRemapperTargets.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/dxc-3.7 to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/SPIRV-Tools-opt to /usr/local/lib/cmake/vulkan/SPIRV-Tools-optCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/OGLCompilerTargets-release.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/glslangValidator to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-lesspipe.sh to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/Applications/vkcube.app to /Applications/vkcube.appCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/HLSLTargets-release.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/spirv-remapTargets.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/glslangValidatorTargets-release.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libSPIRV-Tools-link.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-c.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-reflect to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/Applications/vulkaninfo.app to /Applications/vulkaninfo.appCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-hlsl.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/include/shaderc to /usr/local/include/shadercCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libSPIRV-Tools-reduce.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libshaderc_combined.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-util.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libvulkan.1.2.162.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libOGLCompiler.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libshaderc_shared.1.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libSPIRV-Tools-shared.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libvulkan.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libOSDependent.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libshaderc.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/include/spirv-tools to /usr/local/include/spirv-toolsCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/SPIRV-Tools-reduce to /usr/local/lib/cmake/vulkan/SPIRV-Tools-reduceCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libglslang.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libdxcompiler.3.7.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libMoltenVK.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-reflect.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libHLSL.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libdxcompiler.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-cross to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libVkLayer_khronos_validation.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/include/glslang to /usr/local/include/glslangCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/spirv-reduce to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/OSDependentTargets.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/bin/dxc to /usr/local/binCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libspirv-cross-core.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libSPVRemapper.a to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libVkLayer_api_dump.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/spirv-remapTargets-release.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/OSDependentTargets-release.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libvulkan.1.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/cmake/glslangTargets.cmake to /usr/local/lib/cmake/vulkanCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libshaderc_shared.dylib to /usr/local/libCopying /Volumes/vulkansdk-macos-1.2.162.0/macOS/lib/libMachineIndependent.a to /usr/local/lib

Install GLFW
GLFW is used to create Windows, which supports different operating systems. Both OpenGL and Vulkan are only responsible for rendering graphics to the desktop in memory for display on the screen. As for the final creation of the desktop for each operating system, GL and Vulkan are not responsible for it. That’s what GLFW does. On Apple, GLFW can be installed through BREW. My Mac already had BREW installed, so I simply installed GLFW directly through BREW.

brew install glfw

Install the GLM
Vulkan also does not contain a mathematical library for linear algebra. So we’re going to have to use GLM when we change the graph. He can also install it through BREW.

brew install glm

After installing all the required libs above, we can set our own environment variables in a shell profile. These set environment variables will be used to indicate the path to which libraries to search when I use the CMAKE configuration file in the CLion IDE. Since I’m using ZSH, I added the GLFW and GLM lib paths to ~/.zprofile.

export GLFW_HOME="/usr/local/Cellar/glfw/3.3.2"export GLM_HOME="/usr/local/include/glm"

Note: BREW will place all installations in a directory called CELLAR, and then create soft links in /usr/local to connect to these directories under CELLAR.
And then we’re going to reroute my.zprofile.
When everything is configured, you can call the VKSDK command vkvia</code bbb> check if Vulkan was successfully installed.
You can also run the Vulkan SDK's Cube app to check it out.

Create the CLion project
Let's create a Vulkandemo project. Once created, the project is very simple, with a single HelloWorld code for main.cpp.
Let's draw a triangle here, so let's configure cmake file to make sure that all the header files and libraries we need are loaded correctly.

cmake_minimum_required(VERSION 3.17)project(VulkanDemo)set(CMAKE_CXX_STANDARD 17)# Check environment variables if (NOT DEFINED ENV{GLFW_HOME})    message(FATAL_ERROR "found no env named GLFW_HOME")endif()if (NOT DEFINED ENV{GLM_HOME})    message(FATAL_ERROR "found no env named GLM_HOME")endif()# 暂存环境变量set(GLFW_HOME $ENV{GLFW_HOME})set(GLM_HOME $ENV{GLM_HOME})add_executable(VulkanDemo main.cpp)# 添加 GLFW3 预编译库add_library(glfw SHARED IMPORTED)SET_TARGET_PROPERTIES(glfw PROPERTIES IMPORTED_LOCATION "${GLFW_HOME}/lib/libglfw.3.dylib")# GLMinclude_directories(${GLM_INCLUDE_DIRS})# Vulkanfind_package(Vulkan REQUIRED FATAL_ERROR)target_link_libraries(${PROJECT_NAME} glfw Vulkan::Vulkan)#include_directories(${Vulkan_INCLUDE_DIRS})#target_include_directories(${PROJECT_NAME} PUBLIC ${Vulkan_INCLUDE_DIRS})# copy the shader files to the cmake-build-debug folderfile(COPY shaders DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

Once cmake is configured we start drawing our triangle. This article uses the Vulkan Tutorial code directly. Copy the code to main.cpp</code bbb> We're going to use two shaders here because we're drawing triangles. The code for shader comes from this section. So we need to add two shader files and a compile script to help us generate the spir-v files.
file(COPY shaders DESTINATION ${CMAKE_CURRENT_BINARY_DIR})</code bbb>because calling openfile in main needs to open our shader file. When Clion runs the binaries of the project, it assumes that the resource files are in the cmake-build-debug</code bbb>lder. So we must copy the shader folder to cmake-build-debug</code bbb>
Take a look at what your project as a whole looks like:

Okay, finally, let's run our Vulkandemo program in CLion. A triangle was born!

How to set font color in Latex (3 ways)

1. Use the defined color directly
\usepackage{color}

\textcolor{red/blue/green/black/white/cyan/magenta/yellow}{text}

where textcolor{…} contains the system-defined colors

 

2. Combine the values of red, green and blue to form the color we want
\usepackage{color}

\textcolor[rgb]{r,g,b}{text}

where {r,g,b} represents the combination of red, green and blue colors, and takes values in the range [0-1]

\textcolor[RGB]{R,G,B}{text}

where {R,G,B} represents the combination of red, green and blue colors, and the range of values is [0-255]

 

3. Define a color, call directly
\usepackage{color}

\definecolor{ColorName}{rgb}{r,g,b} This time r/g/b is defined in the range [0-1].

\definecolor{ColorName}{RGB}{R,G,B}, when the domain of R/G/B is defined in [0-255].

Here the name ColorName is defined for the color, and the following can call this color scheme directly

\textcolor{ColorName}{text}

How to Set latex text Bold & Italic

Show upright text: \textup{text}
italic: \textit{text}
slanted italic: \textsl{text}
Display lowercase uppercase text: \textsc{text}
Medium weight: \textmd{text}
Bold command: \textbf{text}
Default value: \textnormal{text}

Italic: \textit{italic}, or \emph{italic}

Fine font: \textlf{light font}

Use equal-width fonts: \texttt{code}

Use sans-serif font: \textsf{sans-serif}

All letters uppercase: \uppercase{CAPITALS}

All letters uppercase, but lowercase letters are smaller: \textsc{Small Capitals}