首页 文章 精选 留言 我的

精选列表

搜索[非结构化元数据],共10000篇文章
优秀的个人博客,低调大师

安装llvm、clang指定使用非默认gcc、g++

安装LLVM、clang时不使用系统默认的gcc、g++版本: 官方手册安装文档: We use here the command-line, non-interactive CMake interface. Downloadand install CMake. Version 3.4.3 is the minimum required. Open a shell. Your development tools must be reachable from this shell through the PATH environment variable. Create a build directory. Building LLVM in the source directory is not supported. cd to this directory: $ mkdir mybuilddir $ cd mybuilddir Execute this command in the shell replacingpath/to/llvm/source/rootwith the path to the root of your LLVM source tree: $ cmake path/to/llvm/source/root CMake will detect your development environment, perform a series of tests, and generate the files required for building LLVM. CMake will use default values for all build parameters. See theOptions and variablessection for a list of build parameters that you can modify. This can fail if CMake can’t detect your toolset, or if it thinks that the environment is not sane enough. In this case, make sure that the toolset that you intend to use is the only one reachable from the shell, and that the shell itself is the correct one for your development environment. CMake will refuse to build MinGW makefiles if you have a POSIX shell reachable through the PATH environment variable, for instance. You can force CMake to use a given build tool; for instructions, see theUsagesection, below. After CMake has finished running, proceed to use IDE project files, or start the build from the build directory: $ cmake --build . The--buildoption tellscmaketo invoke the underlying build tool (make,ninja,xcodebuild,msbuild, etc.) The underlying build tool can be invoked directly, of course, but the--buildoption is portable. After LLVM has finished building, install it from the build directory: $ cmake --build . --target install The--targetoption withinstallparameter in addition to the--buildoption tellscmaketo build theinstalltarget. It is possible to set a different install prefix at installation time by invoking thecmake_install.cmakescript generated in the build directory: $ cmake -DCMAKE_INSTALL_PREFIX=/tmp/llvm -P cmake_install.cmake 其中第四步添加些参数: cmake -DCMAKE_INSTALL_PREFIX=/usr/local/llvm-6.0.0_gcc-7.2.0/ -DCMAKE_C_COMPILER=/usr/local/gcc/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/gcc/bin/g++ -DCMAKE_C_FLAGS=-L/usr/local/gcc/lib64 -DCMAKE_CXX_FLAGS=-L/usr/local/gcc/lib64 -DCMAKE_CXX_LINK_FLAGS="-L/usr/local/gcc/lib64 -Wl,-rpath,/usr/local/gcc/lib64" -DGCC_INSTALL_PREFIX=/usr/local/gcc -DCMAKE_BUILD_TYPE=Release /usr/local/llvm-6.0.0.src CMAKE_INSTALL_PREFIX llvm安装路径 LLVM_LIBDIR_SUFFIX llvm库路径 CMAKE_C_COMPILER 指定gcc路径 CMAKE_CXX_COMPILER 指定g++路径 CMAKE_C_FLAGS c库路径 CMAKE_CXX_FLAGS c++库路径 CMAKE_CXX_LINK_FLAGS c++动态链接库 GCC_INSTALL_PREFIX clang安装参考:http://clang.llvm.org/get_started.html Note: as an experimental setup, you can use a single checkout with all the projects, and an easy CMake invocation, see the LLVM Doc "For developers to work with a git monorepo" If you would like to check out and build Clang, the current procedure is as follows: Get the required tools. See Getting Started with the LLVM System - Requirements. Note also that Python is needed for running the test suite. Get it at: http://www.python.org/download Standard build process uses CMake. Get it at: http://www.cmake.org/download Check out LLVM: Change directory to where you want the llvm directory placed. svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm Check out Clang: cd llvm/tools svn co http://llvm.org/svn/llvm-project/cfe/trunk clang cd ../.. Check out extra Clang tools: (optional) cd llvm/tools/clang/tools svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra cd ../../../.. Check out Compiler-RT (optional): cd llvm/projects svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt cd ../.. Check out libcxx: (only required to build and run Compiler-RT tests on OS X, optional otherwise) cd llvm/projects svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx(这个可选包被我删了) cd ../.. Build LLVM and Clang: mkdir build (in-tree build is not supported) cd build cmake -G "Unix Makefiles" ../llvm make This builds both LLVM and Clang for debug mode. Note: For subsequent Clang development, you can just run make clang. CMake allows you to generate project files for several IDEs: Xcode, Eclipse CDT4, CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3. For more details see Building LLVM with CMake page. If you intend to use Clang's C++ support, you may need to tell it how to find your C++ standard library headers. In general, Clang will detect the best version of libstdc++ headers available and use them - it will look both for system installations of libstdc++ as well as installations adjacent to Clang itself. If your configuration fits neither of these scenarios, you can use the -DGCC_INSTALL_PREFIX cmake option to tell Clang where the gcc containing the desired libstdc++ is installed. Try it out (assuming you add llvm/build/bin to your path): clang --help clang file.c -fsyntax-only (check for correctness) clang file.c -S -emit-llvm -o - (print out unoptimized llvm code) clang file.c -S -emit-llvm -o - -O3 clang file.c -S -O3 -o - (output native machine code) Run the testsuite: make check-clang 按照官方的这个操作编译clang时会出现如下错误: error: ‘sort’ is not a member of ‘llvm’ 官方的答复是: 解决方法: http://releases.llvm.org/download.html从这里下载最新的clang代码,替换llvm/tools/clang下的所有文件,重新编译就可以了 参考: 官方文件:http://llvm.org/docs/CMake.html#usage clan安装:http://clang.llvm.org/get_started.html https://www.cnblogs.com/zengkefu/p/6349534.html

优秀的个人博客,低调大师

童玲:跨越非连续性,拥抱更好的自己

一百年前,一系列发生在欧洲和美洲的女权运动毫无疑问大大提升了劳动女性的社会地位与话语权,同时也共同促成了“三八国际妇女节”的诞生。如今,女性在各行各业都绽放着她们独特的温柔力量,让世界充满了爱与想象。 但我们仍然不能忽视的是,目前在STEM(S代表Science科学,T代表Technology科技,E代表Engineering工程,M代表 Mathematic数学)这类学科的教育和职业选择中,女性参与的比例仍然较少。 对科学的热爱应是不分性别的,同时我们也相信榜样的力量是无穷的。至此一年一度的“三八国际妇女节”到来之际,蚂蚁金服科技将与大家分享我们女技术人的故事,以启发更多年轻的女性能够加入技术探索的世界。在蚂蚁金服的技术岗位中,女性人数超过600人,该比例仍在持续增长。在这群充满智慧的女技术人中,大家各自扮演者不同的角色,甚至在技术

优秀的个人博客,低调大师

hbase 学习(十二)非mapreduce生成Hfile,然后导入hbase当中

最近一个群友的boss让研究hbase,让hbase的入库速度达到5w+/s,这可愁死了,4台个人电脑组成的集群,多线程入库调了好久,速度也才1w左右,都没有达到理想的那种速度,然后就想到了这种方式,但是网上多是用mapreduce来实现入库,而现在的需求是实时入库,不生成文件了,所以就只能自己用代码实现了,但是网上查了很多资料都没有查到,最后在一个网友的指引下,看了源码,最后找到了生成Hfile的方式,实现了之后,发现单线程入库速度才达到1w4左右,和之前的多线程的全速差不多了,百思不得其解之时,调整了一下代码把列的Byte.toBytes(cols)这个方法调整出来只做一次,速度立马就到3w了,提升非常明显,这是我的电脑上的速度,估计在它的集群上能更快一点吧,下面把代码和大家分享一下。 String tableName = "taglog"; byte[] family = Bytes.toBytes("logs"); //配置文件设置 Configuration conf = HBaseConfiguration.create(); conf.set("hbase.master", "192.168.1.133:60000"); conf.set("hbase.zookeeper.quorum", "192.168.1.135"); //conf.set("zookeeper.znode.parent", "/hbase"); conf.set("hbase.metrics.showTableName", "false"); //conf.set("io.compression.codecs", "org.apache.hadoop.io.compress.SnappyCodec"); String outputdir = "hdfs://hadoop.Master:8020/user/SEA/hfiles/"; Path dir = new Path(outputdir); Path familydir = new Path(outputdir, Bytes.toString(family)); FileSystem fs = familydir.getFileSystem(conf); BloomType bloomType = BloomType.NONE; final HFileDataBlockEncoder encoder = NoOpDataBlockEncoder.INSTANCE; int blockSize = 64000; Configuration tempConf = new Configuration(conf); tempConf.set("hbase.metrics.showTableName", "false"); tempConf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 1.0f); //实例化HFile的Writer,StoreFile实际上只是HFile的轻量级的封装 StoreFile.Writer writer = new StoreFile.WriterBuilder(conf, new CacheConfig(tempConf), fs, blockSize) .withOutputDir(familydir) .withCompression(Compression.Algorithm.NONE) .withBloomType(bloomType).withComparator(KeyValue.COMPARATOR) .withDataBlockEncoder(encoder).build(); long start = System.currentTimeMillis(); DecimalFormat df = new DecimalFormat("0000000"); KeyValue kv1 = null; KeyValue kv2 = null; KeyValue kv3 = null; KeyValue kv4 = null; KeyValue kv5 = null; KeyValue kv6 = null; KeyValue kv7 = null; KeyValue kv8 = null; //这个是耗时操作,只进行一次 byte[] cn = Bytes.toBytes("cn"); byte[] dt = Bytes.toBytes("dt"); byte[] ic = Bytes.toBytes("ic"); byte[] ifs = Bytes.toBytes("if"); byte[] ip = Bytes.toBytes("ip"); byte[] le = Bytes.toBytes("le"); byte[] mn = Bytes.toBytes("mn"); byte[] pi = Bytes.toBytes("pi"); int maxLength = 3000000; for(int i=0;i<maxLength;i++){ String currentTime = ""+System.currentTimeMillis() + df.format(i); long current = System.currentTimeMillis(); //rowkey和列都要按照字典序的方式顺序写入,否则会报错的 kv1 = new KeyValue(Bytes.toBytes(currentTime), family, cn,current,KeyValue.Type.Put,Bytes.toBytes("3")); kv2 = new KeyValue(Bytes.toBytes(currentTime), family, dt,current,KeyValue.Type.Put,Bytes.toBytes("6")); kv3 = new KeyValue(Bytes.toBytes(currentTime), family, ic,current,KeyValue.Type.Put,Bytes.toBytes("8")); kv4 = new KeyValue(Bytes.toBytes(currentTime), family, ifs,current,KeyValue.Type.Put,Bytes.toBytes("7")); kv5 = new KeyValue(Bytes.toBytes(currentTime), family, ip,current,KeyValue.Type.Put,Bytes.toBytes("4")); kv6 = new KeyValue(Bytes.toBytes(currentTime), family, le,current,KeyValue.Type.Put,Bytes.toBytes("2")); kv7 = new KeyValue(Bytes.toBytes(currentTime), family, mn,current,KeyValue.Type.Put,Bytes.toBytes("5")); kv8 = new KeyValue(Bytes.toBytes(currentTime), family,pi,current,KeyValue.Type.Put,Bytes.toBytes("1")); writer.append(kv1); writer.append(kv2); writer.append(kv3); writer.append(kv4); writer.append(kv5); writer.append(kv6); writer.append(kv7); writer.append(kv8); } writer.close(); //把生成的HFile导入到hbase当中 HTable table = new HTable(conf,tableName); LoadIncrementalHFiles loader = new LoadIncrementalHFiles(conf); loader.doBulkLoad(dir, table); 最后再附上查看hfile的方式,查询正确的hfile和自己生成的hfile,方便查找问题。 hbase org.apache.hadoop.hbase.io.hfile.HFile -p -f hdfs://hadoop.Master:8020/user/SEA/hfiles/logs/51aa97b2a25446f89d5c870af92c9fc1

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册