TU0123 Creating a core component
编译tensflow:因为非法指令(吐核)

编译tensflow:因为⾮法指令(吐核)intel官⽹在linux(centos)上从源码安装tensorflow:来⾃官⽹:不推荐使⽤源代码构建 TensorFlow。
然⽽,如果上述指令因为 ISA 不受⽀持⽽⽆法运⾏,您随时可使⽤源代码进⾏构建。
使⽤源代码构建 TensorFlow 需要安装 Bazel,相关信息请参考安装 Bazel。
安装说明:运⾏ TensorFlow 源代码⽬录中的 "./configure执⾏以下命令创建 pip 程序包,以安装经过优化的 TensorFlow build。
可更改PATH,使其指向特定 GCC 编译器版本:export PATH=/PATH//bin:$PATHLD_LIBRARY_PATH 还⽀持全新:export LD_LIBRARY_PATH=/PATH//lib64:$LD_LIBRARY_PATH对标记进⾏相应设置,以使⽤英特尔® 数学核⼼函数库(英特尔® MLK)构建 TensorFlow,并传递您希望⽤于编译库的合适指令集:bazel build --config=mkl -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mavx512f --copt=-mavx512pf --copt=-mavx512cd --copt=-mavx512er //tensorflow/tools/pip_package:build_pip_package 3.安装优化的 TensorFlow wheelbazel-bin/tensorflow/tools/pip_package/build_pip_package ~/path_to_save_wheelpip install --upgrade --user ~/path_to_save_wheel /<wheel_name.whl>其他使⽤的是python2.7 未测试oracleLinux 编译参考地址:配置yum源后安装python及必须包yum install -y python3-devel python3-pipyum install python3-devel g++ unzip zip gcc-c++ patch##安装 TensorFlow pip 软件包依赖项(如果使⽤虚拟环境,请省略 --user 参数):暂时pip install -U --user pip six numpy wheel setuptools mock future>=0.17.1pip install -U --user keras_applications==1.0.6 --no-depspip install -U --user keras_preprocessing==1.0.5 --no-deps##下载离线包及安装pip3 download six numpy wheel setuptools mock future==0.17.1pip3 download keras_applications==1.0.6pip3 download keras_applications==1.0.6 keras_preprocessing==1.0.5-rw-r--r-- 1 root root 762 Feb 17 15:55 =0.17.1-rw-r--r-- 1 root root 44277 Feb 17 15:56 Keras_Applications-1.0.6-py2.py3-none-any.whl-rw-r--r-- 1 root root 30674 Feb 17 15:57 Keras_Preprocessing-1.0.5-py2.py3-none-any.whl-rw-r--r-- 1 root root 829119 Feb 17 15:56 future-0.17.1.tar.gz-rw-r--r-- 1 root root 829220 Feb 17 15:55 future-0.18.2.tar.gz-rw-r--r-- 1 root root 2870576 Feb 17 15:56 h5py-2.10.0-cp36-cp36m-manylinux1_x86_64.whl-rw-r--r-- 1 root root 28699 Feb 17 15:55 mock-4.0.1-py3-none-any.whl-rw-r--r-- 1 root root 20143300 Feb 17 15:55 numpy-1.18.1-cp36-cp36m-manylinux1_x86_64.whl-rw-r--r-- 1 root root 584228 Feb 17 15:55 setuptools-45.2.0-py3-none-any.whl-rw-r--r-- 1 root root 10938 Feb 17 15:55 six-1.14.0-py2.py3-none-any.whl-rw-r--r-- 1 root root 26502 Feb 17 15:55 wheel-0.34.2-py2.py3-none-any.whl安装 Bazel:到https:///bazelbuild/bazel/releases 下载指定版本bazel-0.15.0-installer-linux-x86_64.sh参考链接:ubuntu版本##download the corresponding .repo file from Fedora COPR and copy it to /etc/yum.repos.d/.## https:///coprs/vbatts/bazel/repo/epel-7/vbatts-bazel-epel-7.repovbatts-bazel-epel-7.repo[copr::vbatts:bazel]name=Copr repo for bazel owned by vbattsbaseurl=https:///results/vbatts/bazel/epel-7-$basearch/type=rpm-mdskip_if_unavailable=Truegpgcheck=1gpgkey=https:///results/vbatts/bazel/pubkey.gpgrepo_gpgcheck=0enabled=1enabled_metadata=1curl -o /etc/yum.repos.d/vbatts-bazel-epel-7.repo https:///coprs/vbatts/bazel/repo/epel-7/vbatts-bazel-epel-7.repo ##需要安装jdk1.8.x g++ unzip ziprpm -ivh jdk-8u221-linux-x64.rpm##Run the following command:##yum install bazel##需要使⽤⼆进制安装bazel yum 安装的版本太⾼chmod +x bazel-<version>-installer-linux-x86_64.sh./bazel-<version>-installer-linux-x86_64.sh --user--user flag installs Bazel to the $HOME/bin directory on your system and sets the .bazelrc path to $HOME/.bazelrc##设置环境变量export PATH="$PATH:$HOME/bin"##查看版本bazel versionBuild label: 0.15.0下载tensorflow源码或来源: tensflow版本分选择python 库选择:/usr/lib/python3.6/site-packages./configure 配置的选择:[root@wn10aimapap1001 tensorflow-1.10.0]# ./configureWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".You have bazel 0.15.0 installed.Please specify the location of python. [Default is /usr/bin/python]:Found possible Python library paths:/usr/lib/python2.7/site-packages/usr/lib64/python2.7/site-packagesPlease input the desired Python library path to use. Default is [/usr/lib/python2.7/site-packages]/usr/lib/python3.6/site-packagesDo you wish to build TensorFlow with jemalloc as malloc support? [Y/n]: nNo jemalloc as malloc support will be enabled for TensorFlow.Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]: nNo Google Cloud Platform support will be enabled for TensorFlow.Do you wish to build TensorFlow with Hadoop File System support? [Y/n]: nNo Hadoop File System support will be enabled for TensorFlow.Do you wish to build TensorFlow with Amazon AWS Platform support? [Y/n]: nNo Amazon AWS Platform support will be enabled for TensorFlow.Do you wish to build TensorFlow with Apache Kafka Platform support? [Y/n]: nNo Apache Kafka Platform support will be enabled for TensorFlow.Do you wish to build TensorFlow with XLA JIT support? [y/N]: nNo XLA JIT support will be enabled for TensorFlow.Do you wish to build TensorFlow with GDR support? [y/N]: nNo GDR support will be enabled for TensorFlow.Do you wish to build TensorFlow with VERBS support? [y/N]: nNo VERBS support will be enabled for TensorFlow.Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: nNo OpenCL SYCL support will be enabled for TensorFlow.Do you wish to build TensorFlow with CUDA support? [y/N]: nNo CUDA support will be enabled for TensorFlow.Do you wish to download a fresh release of clang? (Experimental) [y/N]: nClang will not be downloaded.Do you wish to build TensorFlow with MPI support? [y/N]: nNo MPI support will be enabled for TensorFlow.Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]:Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: nNot configuring the WORKSPACE for Android builds.Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See tools/bazel.rc for more details.--config=mkl # Build with MKL support.--config=monolithic # Config for mostly static monolithic build.Configuration finishedbazel编译报错解决⽰例:[root@wn10aimapap1001 tensorflow-1.10.0]# bazel build --config=opt //tensorflow/tools/pip_package:build_pip_packageStarting local Bazel server and connecting to it..................ERROR: in target '//external:cc_toolchain': no such package '@local_config_cc//': Traceback (most recent call last):File "/root/.cache/bazel/_bazel_xxxx/6922e28936bf9c1ce50ca7cdbe5953e3/external/bazel_tools/tools/cpp/cc_configure.bzl", line 56configure_unix_toolchain(repository_ctx, cpu_value, overriden...)File "/root/.cache/bazel/_bazel_xxxx/6922e28936bf9c1ce50ca7cdbe5953e3/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 477, in configure_unix_toolchain _find_generic(repository_ctx, "gcc", "CC", overriden...)File "/root/.cache/bazel/_bazel_xxxx/6922e28936bf9c1ce50ca7cdbe5953e3/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 459, in _find_genericauto_configure_fail(msg)File "/root/.cache/bazel/_bazel_xxxx/6922e28936bf9c1ce50ca7cdbe5953e3/external/bazel_tools/tools/cpp/lib_cc_configure.bzl", line 109, in auto_configure_failfail(("\n%sAuto-Configuration Error:%...)))Auto-Configuration Error: Cannot find gcc or CC; either correct your path or set the CC environment variableINFO: Elapsed time: 8.434sINFO: 0 processes.FAILED: Build did NOT complete successfully (2 packages loaded)##############################################################[root@wn10aimapap1001 tensorflow-1.10.0]# bazel build --config=opt //tensorflow/tools/pip_package:build_pip_packageERROR: /home/ap/xxxx/tensorflow-1.10.0/tensorflow/tools/pip_package/BUILD:123:1: no such package '@png_archive//': Traceback (most recent call last):File "/home/ap/xxxx/tensorflow-1.10.0/third_party/repo.bzl", line 99_apply_patch(ctx, ctx.attr.patch_file)File "/home/ap/xxxx/tensorflow-1.10.0/third_party/repo.bzl", line 64, in _apply_patchfail("patch command is not found, ple...")patch command is not found, please install it and referenced by '//tensorflow/tools/pip_package:licenses'ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: no such package '@png_archive//': Traceback (most recent call last):File "/home/ap/xxxx/tensorflow-1.10.0/third_party/repo.bzl", line 99_apply_patch(ctx, ctx.attr.patch_file)File "/home/ap/xxxx/tensorflow-1.10.0/third_party/repo.bzl", line 64, in _apply_patchfail("patch command is not found, ple...")patch command is not found, please install itINFO: Elapsed time: 16.697sINFO: 0 processes.FAILED: Build did NOT complete successfully (79 packages loaded)currently loading: tensorflow/core#########################################################[root@wn10aimapap1001 tensorflow-1.10.0]# bazel build --config=opt //tensorflow/tools/pip_package:build_pip_packageERROR: /home/ap/xxxx/tensorflow-1.10.0/third_party/python_runtime/BUILD:5:1: no such package '@local_config_python//': Traceback (most recent call last):File "/home/ap/xxxx/tensorflow-1.10.0/third_party/py/python_configure.bzl", line 308_create_local_python_repository(repository_ctx)File "/home/ap/xxxx/tensorflow-1.10.0/third_party/py/python_configure.bzl", line 272, in _create_local_python_repository_get_numpy_include(repository_ctx, python_bin)File "/home/ap/xxxx/tensorflow-1.10.0/third_party/py/python_configure.bzl", line 256, in _get_numpy_include_execute(repository_ctx, [python_bin, "-c",..."], <2 more arguments>)File "/home/ap/xxxx/tensorflow-1.10.0/third_party/py/python_configure.bzl", line 55, in _execute_fail("\n".join([error_msg.strip() if ... ""]))File "/home/ap/xxxx/tensorflow-1.10.0/third_party/py/python_configure.bzl", line 28, in _failfail(("%sPython Configuration Error:%...)))Python Configuration Error: Problem getting numpy include path.Traceback (most recent call last):File "<string>", line 1, in <module>ImportError: No module named numpyIs numpy installed?and referenced by '//third_party/python_runtime:headers'ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: Analysis failedINFO: Elapsed time: 5.363sINFO: 0 processes.FAILED: Build did NOT complete successfully (146 packages loaded)currently loading: tensorflow/core/kernelsFetching https://mirror.bazel.build//google/re2/archive/2018-04-01.tar.gz#######################ERROR: /root/.cache/bazel/_bazel_xxxx/6922e28936bf9c1ce50ca7cdbe5953e3/external/protobuf_archive/BUILD:260:1: C++ compilation of rule '@protobuf_archive//:js_embed' failed (Exit 1) gcc: error trying to exec 'cc1plus': execvp: No such file or directoryTarget //tensorflow/tools/pip_package:build_pip_package failed to buildUse --verbose_failures to see the command lines of failed build steps.##yum install gcc patchyum install gcc-c++复制python 的头⽂件到系统⽬录下cp /usr/include/python3.6m/* /usr/include/##多个python版本导致yum 下载问题bazel依赖bazel build 时需要更多的依赖,离线时安装⽐较⿇烦,参考如下离线源码安https:///s_sunnyy/article/details/86074114 装tensorflow:所有要下载的⽂件见: tensorflow 源代码根⽬录下WORKSPACEtensorflow/workspace.bzl### cd /home/ap/xxxx/tensorflow-1.10.0grep '"http' WORKSPACE"https://mirror.bazel.build//bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz","https:///bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz", # 2018-04-13"//models/inception_v1.zip","/models/inception_v1.zip","//models/object_detection/ssd_mobilenet_v1_android_export.zip","/models/object_detection/ssd_mobilenet_v1_android_export.zip","//models/mobile_multibox_v1a.zip","/models/mobile_multibox_v1a.zip","//models/stylize_v1.zip","/models/stylize_v1.zip","//models/speech_commands_v0.01.zip","/models/speech_commands_v0.01.zip",grep '"http' tensorflow/workspace.bzl"https://mirror.bazel.build//intel/mkl-dnn/releases/download/v0.14/mklml_lnx_2018.0.3.20180406.tgz","https:///intel/mkl-dnn/releases/download/v0.14/mklml_lnx_2018.0.3.20180406.tgz""https://mirror.bazel.build//intel/mkl-dnn/releases/download/v0.14/mklml_win_2018.0.3.20180406.zip","https:///intel/mkl-dnn/releases/download/v0.14/mklml_win_2018.0.3.20180406.zip""https://mirror.bazel.build//intel/mkl-dnn/releases/download/v0.14/mklml_mac_2018.0.3.20180406.tgz","https:///intel/mkl-dnn/releases/download/v0.14/mklml_mac_2018.0.3.20180406.tgz""https://mirror.bazel.build//intel/mkl-dnn/archive/v0.14.tar.gz","https:///intel/mkl-dnn/archive/v0.14.tar.gz","https://mirror.bazel.build//abseil/abseil-cpp/archive/9613678332c976568272c8f4a78631a29159271d.tar.gz","https:///abseil/abseil-cpp/archive/9613678332c976568272c8f4a78631a29159271d.tar.gz","https://mirror.bazel.build//eigen/eigen/get/fd6845384b86.tar.gz","https:///eigen/eigen/get/fd6845384b86.tar.gz","https://mirror.bazel.build//raspberrypi/tools/archive/0e906ebc527eab1cdbf7adabff5b474da9562e9f.tar.gz",# "https:///raspberrypi/tools/archive/0e906ebc527eab1cdbf7adabff5b474da9562e9f.tar.gz","https://mirror.bazel.build//hfp/libxsmm/archive/1.9.tar.gz","https:///hfp/libxsmm/archive/1.9.tar.gz","https://mirror.bazel.build//google/or-tools/archive/253f7955c6a1fd805408fba2e42ac6d45b312d15.tar.gz",# "https:///google/or-tools/archive/253f7955c6a1fd805408fba2e42ac6d45b312d15.tar.gz","https://mirror.bazel.build//google/re2/archive/2018-04-01.tar.gz","https:///google/re2/archive/2018-04-01.tar.gz","https://mirror.bazel.build//GoogleCloudPlatform/google-cloud-cpp/archive/f875700a023bdd706333cde45aee8758b272c357.tar.gz","https:///GoogleCloudPlatform/google-cloud-cpp/archive/f875700a023bdd706333cde45aee8758b272c357.tar.gz","https://mirror.bazel.build//googleapis/googleapis/archive/f81082ea1e2f85c43649bee26e0d9871d4b41cdb.zip","https:///googleapis/googleapis/archive/f81082ea1e2f85c43649bee26e0d9871d4b41cdb.zip","https://mirror.bazel.build//google/gemmlowp/archive/38ebac7b059e84692f53e5938f97a9943c120d98.zip","https:///google/gemmlowp/archive/38ebac7b059e84692f53e5938f97a9943c120d98.zip","https://mirror.bazel.build//google/farmhash/archive/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz","https:///google/farmhash/archive/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz","http://mirror.bazel.build//google/highwayhash/archive/fd3d9af80465e4383162e4a7c5e2f406e82dd968.tar.gz","https:///google/highwayhash/archive/fd3d9af80465e4383162e4a7c5e2f406e82dd968.tar.gz","https://mirror.bazel.build//pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.bz2","/repo/pkgs/nasm/nasm-2.13.03.tar.bz2/sha512/d7a6b4cee8dfd603d8d4c976e5287b5cc542fa0b466ff989b743276a6e28114e64289bf02a7819eca63142a5278aa6eed57773007e5f589e157 "/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.bz2","https://mirror.bazel.build//libjpeg-turbo/libjpeg-turbo/archive/1.5.3.tar.gz","https:///libjpeg-turbo/libjpeg-turbo/archive/1.5.3.tar.gz","https://mirror.bazel.build//glennrp/libpng/archive/v1.6.34.tar.gz","https:///glennrp/libpng/archive/v1.6.34.tar.gz","https://mirror.bazel.build//2018/sqlite-amalgamation-3240000.zip","https:///2018/sqlite-amalgamation-3240000.zip","https://mirror.bazel.build//project/giflib/giflib-5.1.4.tar.gz","/project/giflib/giflib-5.1.4.tar.gz","https://mirror.bazel.build//packages/source/s/six/six-1.10.0.tar.gz","https:///packages/source/s/six/six-1.10.0.tar.gz","https://mirror.bazel.build//packages/d8/be/c4276b3199ec3feee2a88bc64810fbea8f26d961e0a4cd9c68387a9f35de/astor-0.6.2.tar.gz","https:///packages/d8/be/c4276b3199ec3feee2a88bc64810fbea8f26d961e0a4cd9c68387a9f35de/astor-0.6.2.tar.gz","https://mirror.bazel.build//packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gz","https:///packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gz","https://mirror.bazel.build//packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz","https:///packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz","https://mirror.bazel.build//abseil/abseil-py/archive/pypi-v0.2.2.tar.gz","https:///abseil/abseil-py/archive/pypi-v0.2.2.tar.gz","https://mirror.bazel.build//packages/bc/cc/3cdb0a02e7e96f6c70bd971bc8a90b8463fda83e264fa9c5c1c98ceabd81/backports.weakref-1.0rc1.tar.gz","https:///packages/bc/cc/3cdb0a02e7e96f6c70bd971bc8a90b8463fda83e264fa9c5c1c98ceabd81/backports.weakref-1.0rc1.tar.gz","https://mirror.bazel.build//2.7/_sources/license.txt","https:///2.7/_sources/license.txt","https://mirror.bazel.build//google/protobuf/archive/v3.6.0.tar.gz","https:///google/protobuf/archive/v3.6.0.tar.gz","https://mirror.bazel.build//google/protobuf/archive/v3.6.0.tar.gz","https:///google/protobuf/archive/v3.6.0.tar.gz","https://mirror.bazel.build//google/protobuf/archive/v3.6.0.tar.gz","https:///google/protobuf/archive/v3.6.0.tar.gz","https://mirror.bazel.build//google/nsync/archive/1.20.0.tar.gz","https:///google/nsync/archive/1.20.0.tar.gz","https://mirror.bazel.build//google/googletest/archive/9816b96a6ddc0430671693df90192bbee57108b6.zip","https:///google/googletest/archive/9816b96a6ddc0430671693df90192bbee57108b6.zip","https://mirror.bazel.build//gflags/gflags/archive/v2.2.1.tar.gz","https:///gflags/gflags/archive/v2.2.1.tar.gz","https://mirror.bazel.build//pub/pcre/pcre-8.42.tar.gz","/pub/pcre/pcre-8.42.tar.gz","https://mirror.bazel.build//project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz","/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz","/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz","https://mirror.bazel.build/curl.haxx.se/download/curl-7.60.0.tar.gz","https://curl.haxx.se/download/curl-7.60.0.tar.gz","https://mirror.bazel.build//grpc/grpc/archive/v1.13.0.tar.gz","https:///grpc/grpc/archive/v1.13.0.tar.gz","https://mirror.bazel.build//antirez/linenoise/archive/c894b9e59f02203dbe4e2be657572cf88c4230c3.tar.gz","https:///antirez/linenoise/archive/c894b9e59f02203dbe4e2be657572cf88c4230c3.tar.gz","https://mirror.bazel.build//llvm-mirror/llvm/archive/bd8c8d759852871609ba2e4e79868420f751949d.tar.gz","https:///llvm-mirror/llvm/archive/bd8c8d759852871609ba2e4e79868420f751949d.tar.gz","https://mirror.bazel.build//LMDB/lmdb/archive/LMDB_0.9.22.tar.gz","https:///LMDB/lmdb/archive/LMDB_0.9.22.tar.gz","https://mirror.bazel.build//open-source-parsers/jsoncpp/archive/1.8.4.tar.gz","https:///open-source-parsers/jsoncpp/archive/1.8.4.tar.gz","https://mirror.bazel.build//google/boringssl/archive/a0fb951d2a26a8ee746b52f3ba81ab011a0af778.tar.gz","https:///google/boringssl/archive/a0fb951d2a26a8ee746b52f3ba81ab011a0af778.tar.gz","https://mirror.bazel.build//zlib-1.2.11.tar.gz","https:///zlib-1.2.11.tar.gz","https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz","http://www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz","https://mirror.bazel.build//google/snappy/archive/1.1.7.tar.gz","https:///google/snappy/archive/1.1.7.tar.gz","https://mirror.bazel.build//nvidia/nccl/archive/03d856977ecbaac87e598c0c4bafca96761b9ac7.tar.gz","https:///nvidia/nccl/archive/03d856977ecbaac87e598c0c4bafca96761b9ac7.tar.gz","https://mirror.bazel.build//edenhill/librdkafka/archive/v0.11.4.tar.gz","https:///edenhill/librdkafka/archive/v0.11.4.tar.gz","https://mirror.bazel.build//aws/aws-sdk-cpp/archive/1.3.15.tar.gz","https:///aws/aws-sdk-cpp/archive/1.3.15.tar.gz","https://mirror.bazel.build//maven2/junit/junit/4.12/junit-4.12.jar","/maven2/junit/junit/4.12/junit-4.12.jar","/maven2/junit/junit/4.12/junit-4.12.jar","https://mirror.bazel.build//maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar","/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar","/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar","https://mirror.bazel.build//jemalloc/jemalloc/archive/4.4.0.tar.gz","https:///jemalloc/jemalloc/archive/4.4.0.tar.gz","http://mirror.bazel.build//maven2/com/google/testing/compile/compile-testing/0.11/compile-testing-0.11.jar","/maven2/com/google/testing/compile/compile-testing/0.11/compile-testing-0.11.jar","http://mirror.bazel.build//maven2/com/google/truth/truth/0.32/truth-0.32.jar","/maven2/com/google/truth/truth/0.32/truth-0.32.jar","http://mirror.bazel.build//maven2/org/checkerframework/checker-qual/2.4.0/checker-qual-2.4.0.jar","/maven2/org/checkerframework/checker-qual/2.4.0/checker-qual-2.4.0.jar","http://mirror.bazel.build//maven2/com/squareup/javapoet/1.9.0/javapoet-1.9.0.jar","/maven2/com/squareup/javapoet/1.9.0/javapoet-1.9.0.jar","https://mirror.bazel.build//google/pprof/archive/c0fb62ec88c411cc91194465e54db2632845b650.tar.gz","https:///google/pprof/archive/c0fb62ec88c411cc91194465e54db2632845b650.tar.gz","https://mirror.bazel.build//NVlabs/cub/archive/1.8.0.zip","https:///NVlabs/cub/archive/1.8.0.zip","https://mirror.bazel.build//cython/cython/archive/0.28.4.tar.gz","https:///cython/cython/archive/0.28.4.tar.gz","https://mirror.bazel.build//bazelbuild/bazel-toolchains/archive/37acf1841ab1475c98a152cb9e446460c8ae29e1.tar.gz","https:///bazelbuild/bazel-toolchains/archive/37acf1841ab1475c98a152cb9e446460c8ae29e1.tar.gz","https://mirror.bazel.build//intel/ARM_NEON_2_x86_SSE/archive/0f77d9d182265259b135dad949230ecbf1a2633d.tar.gz","https:///intel/ARM_NEON_2_x86_SSE/archive/0f77d9d182265259b135dad949230ecbf1a2633d.tar.gz","https://mirror.bazel.build//google/flatbuffers/archive/v1.9.0.tar.gz","https:///google/flatbuffers/archive/v1.9.0.tar.gz","https:///google/double-conversion/archive/3992066a95b823efc8ccc1baf82a1cfc73f6e9b8.zip","https://mirror.bazel.build///models/tflite/mobilenet_v1_224_android_quant_2017_11_08.zip","https:////models/tflite/mobilenet_v1_224_android_quant_2017_11_08.zip","https://mirror.bazel.build///models/tflite/mobilenet_ssd_tflite_v1.zip","https:////models/tflite/mobilenet_ssd_tflite_v1.zip","https://mirror.bazel.build///models/tflite/coco_ssd_mobilenet_v1_0.75_quant_2018_06_29.zip","https:////models/tflite/coco_ssd_mobilenet_v1_0.75_quant_2018_06_29.zip","https://mirror.bazel.build///models/tflite/conv_actions_tflite.zip","https:////models/tflite/conv_actions_tflite.zip","https://mirror.bazel.build///models/tflite/smartreply_1.0_2017_11_01.zip","https:////models/tflite/smartreply_1.0_2017_11_01.zip""https://mirror.bazel.build///data/ovic.zip","https:////data/ovic.zip","https://mirror.bazel.build//bazelbuild/rules_android/archive/v0.1.1.zip","https:///bazelbuild/rules_android/archive/v0.1.1.zip",####未去重https://mirror.bazel.build//bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gzhttps:///bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz//models/inception_v1.zip/models/inception_v1.zip//models/object_detection/ssd_mobilenet_v1_android_export.zip/models/object_detection/ssd_mobilenet_v1_android_export.zip//models/mobile_multibox_v1a.zip/models/mobile_multibox_v1a.zip//models/stylize_v1.zip/models/stylize_v1.zip//models/speech_commands_v0.01.zip/models/speech_commands_v0.01.ziphttps://mirror.bazel.build//intel/mkl-dnn/releases/download/v0.14/mklml_lnx_2018.0.3.20180406.tgzhttps:///intel/mkl-dnn/releases/download/v0.14/mklml_lnx_2018.0.3.20180406.tgzhttps://mirror.bazel.build//intel/mkl-dnn/releases/download/v0.14/mklml_win_2018.0.3.20180406.ziphttps:///intel/mkl-dnn/releases/download/v0.14/mklml_win_2018.0.3.20180406.ziphttps://mirror.bazel.build//intel/mkl-dnn/releases/download/v0.14/mklml_mac_2018.0.3.20180406.tgzhttps:///intel/mkl-dnn/releases/download/v0.14/mklml_mac_2018.0.3.20180406.tgzhttps://mirror.bazel.build//intel/mkl-dnn/archive/v0.14.tar.gzhttps:///intel/mkl-dnn/archive/v0.14.tar.gzhttps://mirror.bazel.build//abseil/abseil-cpp/archive/9613678332c976568272c8f4a78631a29159271d.tar.gzhttps:///abseil/abseil-cpp/archive/9613678332c976568272c8f4a78631a29159271d.tar.gzhttps://mirror.bazel.build//eigen/eigen/get/fd6845384b86.tar.gzhttps:///eigen/eigen/get/fd6845384b86.tar.gzhttps://mirror.bazel.build//raspberrypi/tools/archive/0e906ebc527eab1cdbf7adabff5b474da9562e9f.tar.gzhttps:///raspberrypi/tools/archive/0e906ebc527eab1cdbf7adabff5b474da9562e9f.tar.gzhttps://mirror.bazel.build//hfp/libxsmm/archive/1.9.tar.gzhttps:///hfp/libxsmm/archive/1.9.tar.gzhttps://mirror.bazel.build//google/or-tools/archive/253f7955c6a1fd805408fba2e42ac6d45b312d15.tar.gzhttps:///google/or-tools/archive/253f7955c6a1fd805408fba2e42ac6d45b312d15.tar.gzhttps://mirror.bazel.build//google/re2/archive/2018-04-01.tar.gzhttps:///google/re2/archive/2018-04-01.tar.gzhttps://mirror.bazel.build//GoogleCloudPlatform/google-cloud-cpp/archive/f875700a023bdd706333cde45aee8758b272c357.tar.gzhttps:///GoogleCloudPlatform/google-cloud-cpp/archive/f875700a023bdd706333cde45aee8758b272c357.tar.gzhttps://mirror.bazel.build//googleapis/googleapis/archive/f81082ea1e2f85c43649bee26e0d9871d4b41cdb.ziphttps:///googleapis/googleapis/archive/f81082ea1e2f85c43649bee26e0d9871d4b41cdb.ziphttps://mirror.bazel.build//google/gemmlowp/archive/38ebac7b059e84692f53e5938f97a9943c120d98.ziphttps:///google/gemmlowp/archive/38ebac7b059e84692f53e5938f97a9943c120d98.ziphttps://mirror.bazel.build//google/farmhash/archive/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gzhttps:///google/farmhash/archive/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gzhttp://mirror.bazel.build//google/highwayhash/archive/fd3d9af80465e4383162e4a7c5e2f406e82dd968.tar.gzhttps:///google/highwayhash/archive/fd3d9af80465e4383162e4a7c5e2f406e82dd968.tar.gzhttps://mirror.bazel.build//pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.bz2/repo/pkgs/nasm/nasm-2.13.03.tar.bz2/sha512/d7a6b4cee8dfd603d8d4c976e5287b5cc542fa0b466ff989b743276a6e28114e64289bf02a7819eca63142a5278aa6eed57773007e5f589e15768e645 /pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.bz2https://mirror.bazel.build//libjpeg-turbo/libjpeg-turbo/archive/1.5.3.tar.gzhttps:///libjpeg-turbo/libjpeg-turbo/archive/1.5.3.tar.gzhttps://mirror.bazel.build//glennrp/libpng/archive/v1.6.34.tar.gzhttps:///glennrp/libpng/archive/v1.6.34.tar.gzhttps://mirror.bazel.build//2018/sqlite-amalgamation-3240000.ziphttps:///2018/sqlite-amalgamation-3240000.ziphttps://mirror.bazel.build//project/giflib/giflib-5.1.4.tar.gz/project/giflib/giflib-5.1.4.tar.gzhttps://mirror.bazel.build//packages/source/s/six/six-1.10.0.tar.gzhttps:///packages/source/s/six/six-1.10.0.tar.gzhttps://mirror.bazel.build//packages/d8/be/c4276b3199ec3feee2a88bc64810fbea8f26d961e0a4cd9c68387a9f35de/astor-0.6.2.tar.gzhttps:///packages/d8/be/c4276b3199ec3feee2a88bc64810fbea8f26d961e0a4cd9c68387a9f35de/astor-0.6.2.tar.gzhttps://mirror.bazel.build//packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gzhttps:///packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gzhttps://mirror.bazel.build//packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gzhttps:///packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gzhttps://mirror.bazel.build//abseil/abseil-py/archive/pypi-v0.2.2.tar.gzhttps:///abseil/abseil-py/archive/pypi-v0.2.2.tar.gzhttps://mirror.bazel.build//packages/bc/cc/3cdb0a02e7e96f6c70bd971bc8a90b8463fda83e264fa9c5c1c98ceabd81/backports.weakref-1.0rc1.tar.gzhttps:///packages/bc/cc/3cdb0a02e7e96f6c70bd971bc8a90b8463fda83e264fa9c5c1c98ceabd81/backports.weakref-1.0rc1.tar.gzhttps://mirror.bazel.build//2.7/_sources/license.txthttps:///2.7/_sources/license.txthttps://mirror.bazel.build//google/protobuf/archive/v3.6.0.tar.gzhttps:///google/protobuf/archive/v3.6.0.tar.gzhttps://mirror.bazel.build//google/protobuf/archive/v3.6.0.tar.gzhttps:///google/protobuf/archive/v3.6.0.tar.gzhttps://mirror.bazel.build//google/protobuf/archive/v3.6.0.tar.gzhttps:///google/protobuf/archive/v3.6.0.tar.gzhttps://mirror.bazel.build//google/nsync/archive/1.20.0.tar.gzhttps:///google/nsync/archive/1.20.0.tar.gzhttps://mirror.bazel.build//google/googletest/archive/9816b96a6ddc0430671693df90192bbee57108b6.ziphttps:///google/googletest/archive/9816b96a6ddc0430671693df90192bbee57108b6.ziphttps://mirror.bazel.build//gflags/gflags/archive/v2.2.1.tar.gzhttps:///gflags/gflags/archive/v2.2.1.tar.gzhttps://mirror.bazel.build//pub/pcre/pcre-8.42.tar.gz/pub/pcre/pcre-8.42.tar.gzhttps://mirror.bazel.build//project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gzhttps://mirror.bazel.build/curl.haxx.se/download/curl-7.60.0.tar.gzhttps://curl.haxx.se/download/curl-7.60.0.tar.gzhttps://mirror.bazel.build//grpc/grpc/archive/v1.13.0.tar.gzhttps:///grpc/grpc/archive/v1.13.0.tar.gzhttps://mirror.bazel.build//antirez/linenoise/archive/c894b9e59f02203dbe4e2be657572cf88c4230c3.tar.gzhttps:///antirez/linenoise/archive/c894b9e59f02203dbe4e2be657572cf88c4230c3.tar.gzhttps://mirror.bazel.build//llvm-mirror/llvm/archive/bd8c8d759852871609ba2e4e79868420f751949d.tar.gzhttps:///llvm-mirror/llvm/archive/bd8c8d759852871609ba2e4e79868420f751949d.tar.gzhttps://mirror.bazel.build//LMDB/lmdb/archive/LMDB_0.9.22.tar.gzhttps:///LMDB/lmdb/archive/LMDB_0.9.22.tar.gzhttps://mirror.bazel.build//open-source-parsers/jsoncpp/archive/1.8.4.tar.gzhttps:///open-source-parsers/jsoncpp/archive/1.8.4.tar.gzhttps://mirror.bazel.build//google/boringssl/archive/a0fb951d2a26a8ee746b52f3ba81ab011a0af778.tar.gzhttps:///google/boringssl/archive/a0fb951d2a26a8ee746b52f3ba81ab011a0af778.tar.gzhttps://mirror.bazel.build//zlib-1.2.11.tar.gzhttps:///zlib-1.2.11.tar.gzhttps://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgzhttp://www.kurims.kyoto-u.ac.jp/~ooura/fft.tgzhttps://mirror.bazel.build//google/snappy/archive/1.1.7.tar.gzhttps:///google/snappy/archive/1.1.7.tar.gzhttps://mirror.bazel.build//nvidia/nccl/archive/03d856977ecbaac87e598c0c4bafca96761b9ac7.tar.gzhttps:///nvidia/nccl/archive/03d856977ecbaac87e598c0c4bafca96761b9ac7.tar.gzhttps://mirror.bazel.build//edenhill/librdkafka/archive/v0.11.4.tar.gzhttps:///edenhill/librdkafka/archive/v0.11.4.tar.gzhttps://mirror.bazel.build//aws/aws-sdk-cpp/archive/1.3.15.tar.gz。
学习struts2——常见问题与处理

学习struts2.2.1遭遇滑铁卢~~~~~好多异常~~~~~好多bug~~~~好多问题~~~~~~好多困难~~~好多肥羊~~~一、Filter mapping specifies an unknown filter name ----filter标签在web.xml 里的顺序<filter-mapping><filter-name>adminOperateLogFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><filter><filter-name>adminOperateLogFilter</filter-name><filter-class>com.berheley.exam.web.filter.AdminOperateLogFil ter</filter-class></filter>这样写启动服务器时报错 Filter mapping specifies an unknown filter nameadminOperateLogFilter将这两块换个顺序就没问题了,web.xml信息的加载是有顺序的,filter在mapping之前必须要让服务器找到其定义。
<filter><filter-name>adminOperateLogFilter</filter-name><filter-class>com.berheley.exam.web.filter.AdminOperateLogFil ter</filter-class></filter><filter-mapping><filter-name>adminOperateLogFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>二、ng.IllegalArgumentException: Filter mapping specifies an unknown filter nameStruts2答:“Struts2”?大写的?are you sure?我猜你一定是看了某struts2.0的权威指南(那是一个chm文件电子书,而且你看的可能是翻译成中文的),我不知道英文版的有没有写错,但是我检查了很久后才发现中文版存在这个大小写错误。
在ubuntu12.04下编译linux内核

在ubuntu12.04下编译linux内核写这个东西的时候,想起07年第一次编译内核,想起06年开始看内核代码,想起那段,生命中最灰暗的日子。
那时,经常在校内写读内核的心得,只因发现,你目录前言 (2)一、编译前的准备工作 (2)二、内核的配置 (2)三、内核的生成和安装 (3)四、启动新内核 (4)五、修改默认的配置文件 (4)5.1修改默认配置添加软件功能 (4)5.2修改默认配置添加pci和usb设备驱动 (5)5.3修改默认配置添加杂类设备驱动 (7)前言编译内核和编译其它软件相比,除了配置之外,没有什么特别的地方。
既然编译内核这么简单,网上也能找到很多介绍的文章,我为什么还要写呢?因为看到有些文章源自不断抄袭旧东西,导致抄了些没用的东西,而且基本都对内核配置避而不谈,这样实际上一定会有人遇到问题。
所以,写点吧,给初学者。
一、编译前的准备工作编译软件需要先安装编译环境,主要的就是工具链(toolchain)。
由于安装包需要下载的数据量较大,所以如果软件源建议还是换成国内的吧。
我用163的源,source.list文件在这里,覆盖/etc/apt/source.list就行了。
替换源后,执行如下命令:apt-get updateapt-get install build-essential p7zip-full后面的7z工具供下载了xz后缀文件的同学使用。
下载内核源码的网站是,版本随意,源码包名字是linux-3.x.x.tar.gz,有很多版本提供.xz结尾的压缩版本,压缩比较高,看自己网络情况定吧。
我这里下载的版本是3.6.6,名为linux-3.6.6.tar.gz。
接着解压源码,假设我们的编译目录为/home/sb/,解压命令为:tar xf linux-3.6.6.tar.gz-C/home/sb这样/home/sb/下出现一个linux-3.6.6的目录。
二、内核的配置内核支持很多的设备和功能,这些设备驱动和功能的开关主要通过内核的配置文件确定。
软件著作权-源代码范文示范

软件著作权-源代码范本注意事项:常见的源代码包含:C语言,VB,C++,JAVA,.NET等。
提交的代码必须是源代码的开头载入程序,第30页必须断开,第60页是软件的程序结尾,代码中不得出现与申请表内容不符合的日期,著作权人,软件名字等,不能出现开源代码,不能出现任何版权纠纷。
格式要求:一、源代码应提交前、后各连续30页,不足60页的,应当全部提交。
二、源代码页眉应标注软件的名称和版本号,应当与申请表中名称完全一致,页眉右上应标注页码,源代码每页不少于50行。
范例如下:#include <tybs/commandline.h>#include <tybs/dir.h>#include <tybs/entropy.h>#include <tybs/file.h>#include <tybs/hash.h>#include <tybs/os.h>#include <tybs/platform.h>#include <tybs/resource.h>#include <tybs/stdio.h>#include <tybs/string.h>#include <tybs/task.h>#include <tybs/timer.h>#include <tybs/util.h>#include <tybscc/result.h>#include <dns/dispatch.h>#include <dns/name.h>#include <dns/result.h>#include <dns/view.h>#include <dst/result.h>#define NS_MAIN 1#include <named/ns_smf_globals.h>#endif#ifdef DLZ#include <dlz/dlz_drivers.h>#endifstatic tybs_boolean_t want_stats = TYBS_FALSE;static char program_name[TYBS_DIR_NAMEMAX] = "named"; static char absolute_conffile[TYBS_DIR_PATHMAX];static char saved_command_line[512];static char version[512];static unsigned int maxsocks = 0;voidns_main_earlywarning(const char *format, ...) {va_list args;va_start(args, format);if (ns_g_lctx != NULL) {tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_W ARNING,format, args);} else {fprintf(stderr, "%s: ", program_name);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}va_end(args);}V oid ns_main_earlyfatal(const char *format, ...) {va_list args;va_start(args, format);if (ns_g_lctx != NULL) {tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,format, args);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to early fatal error)");} else {fprintf(stderr, "%s: ", program_name);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}va_end(args);exit(1);}static voidassertion_failed(const char *file, int line, tybs_assertiontype_t type,const char *cond){if (ns_g_lctx != NULL) {tybs_assertion_setcallback(NULL);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"%s:%d: %s(%s) failed", file, line,tybs_assertion_typetotext(type), cond);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to assertion failure)");} else {fprintf(stderr, "%s:%d: %s(%s) failed\n",file, line, tybs_assertion_typetotext(type), cond);fflush(stderr);}if (ns_g_coreok)abort();exit(1);}static voidlibrary_fatal_error(const char *file, int line, const char *format,va_list args) TYBS_FORMAT_PRINTF(3, 0);static voidlibrary_fatal_error(const char *file, int line, const char *format,va_list args){if (ns_g_lctx != NULL) {tybs_error_setfatal(NULL);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"%s:%d: fatal error:", file, line);tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,format, args);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to fatal error in library)");} else {fprintf(stderr, "%s:%d: fatal error: ", file, line);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}if (ns_g_coreok)abort();exit(1);}static voidlibrary_unexpected_error(const char *file, int line, const char *format,va_list args) TYBS_FORMAT_PRINTF(3, 0);static voidlibrary_unexpected_error(const char *file, int line, const char *format,va_list args){if (ns_g_lctx != NULL) {tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_ERROR,"%s:%d: unexpected error:", file, line);tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_ERROR,format, args);} else {fprintf(stderr, "%s:%d: fatal error: ", file, line);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}}static voidlwresd_usage(void) {fprintf(stderr,"usage: lwresd [-4|-6] [-c conffile | -C resolvconffile] ""[-d debuglevel]\n"" [-f|-g] [-n number_of_cpus] [-p port] ""[-P listen-port] [-s]\n"" [-t chrootdir] [-u username] [-i pidfile]\n"" [-m {usage|trace|record|size|mctx}]\n");}static voidusage(void) {if (ns_g_lwresdonly) {lwresd_usage();return;}fprintf(stderr,"usage: named [-4|-6] [-c conffile] [-d debuglevel] ""[-f|-g] [-n number_of_cpus]\n"" [-p port] [-s] [-t chrootdir] [-u username]\n"" [-m {usage|trace|record|size|mctx}]\n");}static voidsave_command_line(int argc, char *argv[]) {int i;char *src;char *dst;char *eob;const char truncated[] = "...";tybs_boolean_t quoted = TYBS_FALSE;dst = saved_command_line;eob = saved_command_line + sizeof(saved_command_line);for (i = 1; i < argc && dst < eob; i++) {*dst++ = ' ';src = argv[i];while (*src != '\0' && dst < eob) {if (quoted || isalnum(*src & 0xff) ||*src == '-' || *src == '_' ||*src == '.' || *src == '/') {*dst++ = *src++;quoted = TYBS_FALSE;} else {*dst++ = '\\';quoted = TYBS_TRUE;}}}INSIST(sizeof(saved_command_line) >= sizeof(truncated));if (dst == eob)strcpy(eob - sizeof(truncated), truncated);else*dst = '\0';}static intparse_int(char *arg, const char *desc) {char *endp;int tmp;long int ltmp;ltmp = strtol(arg, &endp, 10);tmp = (int) ltmp;if (*endp != '\0')ns_main_earlyfatal("%s '%s' must be numeric", desc, arg);if (tmp < 0 || tmp != ltmp)ns_main_earlyfatal("%s '%s' out of range", desc, arg);return (tmp);}static struct flag_def {const char *name;unsigned int value;} mem_debug_flags[] = {{ "trace", TYBS_MEM_DEBUGTRACE },{ "record", TYBS_MEM_DEBUGRECORD },{ "usage", TYBS_MEM_DEBUGUSAGE },{ "size", TYBS_MEM_DEBUGSIZE },{ "mctx", TYBS_MEM_DEBUGCTX },{ NULL, 0 }};static voidset_flags(const char *arg, struct flag_def *defs, unsigned int *ret) { for (;;) {const struct flag_def *def;const char *end = strchr(arg, ',');int arglen;if (end == NULL)end = arg + strlen(arg);arglen = end - arg;for (def = defs; def->name != NULL; def++) {if (arglen == (int)strlen(def->name) &&memcmp(arg, def->name, arglen) == 0) {*ret |= def->value;goto found;}}ns_main_earlyfatal("unrecognized flag '%.*s'", arglen, arg);found:if (*end == '\0')break;arg = end + 1;}}static voidparse_command_line(int argc, char *argv[]) {int ch;int port;tybs_boolean_t disable6 = TYBS_FALSE;tybs_boolean_t disable4 = TYBS_FALSE;save_command_line(argc, argv);tybs_commandline_errprint = TYBS_FALSE;while ((ch = tybs_commandline_parse(argc, argv,"46c:C:d:fgi:lm:n:N:p:P:""sS:t:T:u:vVx:")) != -1) {switch (ch) {case '4':if (disable4)ns_main_earlyfatal("cannot specify -4 and -6");if (tybs_net_probeipv4() != TYBS_R_SUCCESS)ns_main_earlyfatal("IPv4 not supported by OS");tybs_net_disableipv6();disable6 = TYBS_TRUE;break;case '6':if (disable6)ns_main_earlyfatal("cannot specify -4 and -6");if (tybs_net_probeipv6() != TYBS_R_SUCCESS)ns_main_earlyfatal("IPv6 not supported by OS");tybs_net_disableipv4();disable4 = TYBS_TRUE;break;case 'c':ns_g_conffile = tybs_commandline_argument;lwresd_g_conffile = tybs_commandline_argument;if (lwresd_g_useresolvconf)ns_main_earlyfatal("cannot specify -c and -C");ns_g_conffileset = TYBS_TRUE;break;case 'C':lwresd_g_resolvconffile = tybs_commandline_argument;if (ns_g_conffileset)ns_main_earlyfatal("cannot specify -c and -C");lwresd_g_useresolvconf = TYBS_TRUE;break;case 'd':ns_g_debuglevel = parse_int(tybs_commandline_argument,"debug level");break;case 'f':ns_g_foreground = TYBS_TRUE;break;case 'g':ns_g_foreground = TYBS_TRUE;ns_g_logstderr = TYBS_TRUE;break;/* XXXBEW -i should be removed */case 'i':lwresd_g_defaultpidfile = tybs_commandline_argument;break;case 'l':ns_g_lwresdonly = TYBS_TRUE;break;case 'm':set_flags(tybs_commandline_argument, mem_debug_flags, &tybs_mem_debugging);break;case 'N': /* Deprecated. */case 'n':ns_g_cpus = parse_int(tybs_commandline_argument,"number of cpus");if (ns_g_cpus == 0)ns_g_cpus = 1;break;case 'p':port = parse_int(tybs_commandline_argument, "port");if (port < 1 || port > 65535)ns_main_earlyfatal("port '%s' out of range",tybs_commandline_argument);ns_g_port = port;break;/* XXXBEW Should -P be removed? */case 'P':port = parse_int(tybs_commandline_argument, "port");if (port < 1 || port > 65535)ns_main_earlyfatal("port '%s' out of range",tybs_commandline_argument);lwresd_g_listenport = port;break;case 's':want_stats = TYBS_TRUE;break;case 'S':maxsocks = parse_int(tybs_commandline_argument,"max number of sockets");break;case 't':ns_g_chrootdir = tybs_commandline_argument;break;case 'T':if (strcmp(tybs_commandline_argument, "clienttest") == 0)ns_g_clienttest = TYBS_TRUE;elsefprintf(stderr, "unknown -T flag '%s\n",tybs_commandline_argument);break;case 'u':ns_g_username = tybs_commandline_argument;break;case 'v':printf("BIND %s\n", ns_g_version);exit(0);case 'V':printf("BIND %s built with %s\n", ns_g_version,ns_g_configargs);exit(0);case '?':usage();if (tybs_commandline_option == '?')exit(0);ns_main_earlyfatal("unknown option '-%c'",tybs_commandline_option);default:ns_main_earlyfatal("parsing options returned %d", ch);}}argc -= tybs_commandline_index;argv += tybs_commandline_index;if (argc > 0) {usage();ns_main_earlyfatal("extra command line arguments");}}static tybs_result_tcreate_managers(void) {tybs_result_t result;unsigned int socks;#ifdef TYBS_PLATFORM_USETHREADSunsigned int cpus_detected;#endif#ifdef TYBS_PLATFORM_USETHREADScpus_detected = tybs_os_ncpus();if (ns_g_cpus == 0)ns_g_cpus = cpus_detected;tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, TYBS_LOG_INFO, "found %u CPU%s, using %u worker thread%s",cpus_detected, cpus_detected == 1 ? "" : "s",ns_g_cpus, ns_g_cpus == 1 ? "" : "s");#elsens_g_cpus = 1;#endifresult = tybs_taskmgr_create(ns_g_mctx, ns_g_cpus, 0, &ns_g_taskmgr);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_taskmgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_timermgr_create(ns_g_mctx, &ns_g_timermgr);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_timermgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_socketmgr_create2(ns_g_mctx, &ns_g_socketmgr, maxsocks);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_socketmgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_socketmgr_getmaxsockets(ns_g_socketmgr, &socks);if (result == TYBS_R_SUCCESS) {tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_SERVER,TYBS_LOG_INFO, "using up to %u sockets", socks);}result = tybs_entropy_create(ns_g_mctx, &ns_g_entropy);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_entropy_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_hash_create(ns_g_mctx, ns_g_entropy, DNS_NAME_MAXWIRE);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_hash_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}return (TYBS_R_SUCCESS);}static voiddestroy_managers(void) {ns_lwresd_shutdown();tybs_entropy_detach(&ns_g_entropy);if (ns_g_fallbackentropy != NULL)tybs_entropy_detach(&ns_g_fallbackentropy);tybs_taskmgr_destroy(&ns_g_taskmgr);tybs_timermgr_destroy(&ns_g_timermgr);tybs_socketmgr_destroy(&ns_g_socketmgr);tybs_hash_destroy();}static voidsetup(void) {tybs_result_t result;#ifdef HA VE_LIBSCFchar *instance = NULL;#endifns_os_inituserinfo(ns_g_username);ns_os_tzset();ns_os_opendevnull();#ifdef HA VE_LIBSCFresult = ns_smf_get_instance(&instance, 0, ns_g_mctx);if (result == TYBS_R_SUCCESS)ns_smf_got_instance = 1;elsens_smf_got_instance = 0;if (instance != NULL)tybs_mem_free(ns_g_mctx, instance);#endif /* HA VE_LIBSCF */#ifdef PA TH_RANDOMDEVif (ns_g_chrootdir != NULL) {result = tybs_entropy_create(ns_g_mctx, &ns_g_fallbackentropy);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_entropy_create() failed: %s",tybs_result_totext(result));result = tybs_entropy_createfilesource(ns_g_fallbackentropy,PA TH_RANDOMDEV);if (result != TYBS_R_SUCCESS) {ns_main_earlywarning("could not open pre-chroot ""entropy source %s: %s",PA TH_RANDOMDEV,tybs_result_totext(result));tybs_entropy_detach(&ns_g_fallbackentropy);}}#endifns_os_chroot(ns_g_chrootdir);ns_os_minprivs();result = ns_log_init(TYBS_TF(ns_g_username != NULL));if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("ns_log_init() failed: %s",tybs_result_totext(result));if (!ns_g_foreground)ns_os_daemonize();result = tybs_app_start();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_app_start() failed: %s",tybs_result_totext(result));tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, "starting BIND %s%s", ns_g_version,saved_command_line);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, "built with %s", ns_g_configargs);(void)tybs_resource_getlimit(tybs_resource_stacksize,&ns_g_initstacksize);(void)tybs_resource_getlimit(tybs_resource_datasize,&ns_g_initdatasize);(void)tybs_resource_getlimit(tybs_resource_coresize,&ns_g_initcoresize);(void)tybs_resource_getlimit(tybs_resource_openfiles,&ns_g_initopenfiles);if (! tybs_file_isabsolute(ns_g_conffile)) {result = tybs_file_absolutepath(ns_g_conffile,absolute_conffile,sizeof(absolute_conffile));if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("could not construct absolute path of ""configuration file: %s",tybs_result_totext(result));ns_g_conffile = absolute_conffile;}result = tybs_time_now(&ns_g_boottime);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_time_now() failed: %s",tybs_result_totext(result));result = create_managers();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("create_managers() failed: %s",tybs_result_totext(result));ns_builtin_init();#ifdef DLZresult = dlz_drivers_init();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("dlz_drivers_init() failed: %s",tybs_result_totext(result));#endifns_server_create(ns_g_mctx, &ns_g_server);}static voidcleanup(void) {destroy_managers();ns_server_destroy(&ns_g_server);ns_builtin_deinit();#ifdef DLZdlz_drivers_clear();#endifdns_name_destroy();tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, "exiting");ns_log_shutdown();}static char *memstats = NULL;voidns_main_setmemstats(const char *filename) {if (memstats != NULL) {free(memstats);memstats = NULL;}if (filename == NULL)return;memstats = malloc(strlen(filename) + 1);if (memstats)strcpy(memstats, filename);}#ifdef HA VE_LIBSCFtybs_result_tns_smf_get_instance(char **ins_name, int debug, tybs_mem_t *mctx) {scf_handle_t *h = NULL;int namelen;char *instance;REQUIRE(ins_name != NULL && *ins_name == NULL);if ((h = scf_handle_create(SCF_VERSION)) == NULL) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_handle_create() failed: %s",scf_strerror(scf_error()));return (TYBS_R_FAILURE);}if (scf_handle_bind(h) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_handle_bind() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if ((namelen = scf_myname(h, NULL, 0)) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_myname() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if ((instance = tybs_mem_allocate(mctx, namelen + 1)) == NULL) { UNEXPECTED_ERROR(__FILE__, __LINE__,"ns_smf_get_instance memory ""allocation failed: %s",tybs_result_totext(TYBS_R_NOMEMORY));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if (scf_myname(h, instance, namelen + 1) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_myname() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);tybs_mem_free(mctx, instance);return (TYBS_R_FAILURE);}scf_handle_destroy(h);*ins_name = instance;return (TYBS_R_SUCCESS);}#endifintmain(int argc, char *argv[]) {tybs_result_t result;#ifdef HA VE_LIBSCFchar *instance = NULL;#endifstrlcat(version,#ifdef __DATE__"named version: BIND " VERSION " (" __DA TE__ ")",#else"named version: BIND " VERSION,#endifsizeof(version));result = tybs_file_progname(*argv, program_name, sizeof(program_name));if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("program name too long");if (strcmp(program_name, "lwresd") == 0)ns_g_lwresdonly = TYBS_TRUE;tybs_assertion_setcallback(assertion_failed);tybs_error_setfatal(library_fatal_error);tybs_error_setunexpected(library_unexpected_error);ns_os_init(program_name);dns_result_register();dst_result_register();tybscc_result_register();parse_command_line(argc, argv);if (ns_g_chrootdir != NULL) {int len = strlen(ns_g_chrootdir);if (strncmp(ns_g_chrootdir, ns_g_conffile, len) == 0 &&(ns_g_conffile[len] == '/' || ns_g_conffile[len] == '\\'))ns_main_earlywarning("config filename (-c %s) contains ""chroot path (-t %s)",ns_g_conffile, ns_g_chrootdir);}result = tybs_mem_create(0, 0, &ns_g_mctx);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_mem_create() failed: %s",tybs_result_totext(result));tybs_mem_setname(ns_g_mctx, "main", NULL);setup();do {result = tybs_app_run();if (result == TYBS_R_RELOAD) {ns_server_reloadwanted(ns_g_server);} else if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_app_run(): %s",tybs_result_totext(result));result = TYBS_R_SUCCESS;}} while (result != TYBS_R_SUCCESS);#ifdef HA VE_LIBSCFif (ns_smf_want_disable == 1) {result = ns_smf_get_instance(&instance, 1, ns_g_mctx);if (result == TYBS_R_SUCCESS && instance != NULL) {if (smf_disable_instance(instance, 0) != 0)UNEXPECTED_ERROR(__FILE__, __LINE__,"smf_disable_instance() ""failed for %s : %s",instance,scf_strerror(scf_error()));}if (instance != NULL)tybs_mem_free(ns_g_mctx, instance);}#endif /* HA VE_LIBSCF */cleanup();if (want_stats) {tybs_mem_stats(ns_g_mctx, stdout);tybs_mutex_stats(stdout);}if (ns_g_memstatistics && memstats != NULL) {FILE *fp = NULL;result = tybs_stdio_open(memstats, "w", &fp);if (result == TYBS_R_SUCCESS) {tybs_mem_stats(ns_g_mctx, fp);tybs_mutex_stats(fp);tybs_stdio_close(fp);}}tybs_mem_destroy(&ns_g_mctx);tybs_mem_checkdestroyed(stderr);ns_main_setmemstats(NULL);tybs_app_finish();ns_os_closedevnull();ns_os_shutdown();return (0);}#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS #include "php.h"#include <stdio.h>#include <fcntl.h>#ifdef PHP_WIN32#include "win32/time.h"#include "win32/signal.h"#include "win32/php_win32_globals.h"#include <process.h>#elif defined(NETW ARE)#include <sys/timeval.h>#ifdef USE_WINSOCK#include <novsock2.h>#endif#endif#if HA VE_SYS_TIME_H#include <sys/time.h>#endif#if HA VE_UNISTD_H#include <unistd.h>#endif#if HA VE_SIGNAL_H#include <signal.h>#endif#if HA VE_SETLOCALE#include <locale.h>#endif#include "zend.h"#include "zend_extensions.h"#include "php_ini.h"#include "php_globals.h"#include "php_main.h"#include "fopen_wrappers.h"#include "ext/standard/php_standard.h"#include "php_variables.h"#include "ext/standard/credits.h"#ifdef PHP_WIN32#include <io.h>#include "win32/php_registry.h"#include "ext/standard/flock_compat.h"#endif#include "php_syslog.h"#include "Zend/zend_exceptions.h"#if PHP_SIGCHILD#include <sys/types.h>#include <sys/wait.h>#endif#include "zend_compile.h"#include "zend_execute.h"#include "zend_highlight.h"#include "zend_indent.h"#include "zend_extensions.h"#include "zend_ini.h"#include "php_content_types.h"#include "php_ticks.h"#include "php_logos.h"#include "php_streams.h"#include "php_open_temporary_file.h"#include "SAPI.h"#include "rfc1867.h"/* }}} */#ifndef ZTSphp_core_globals core_globals;#elsePHPAPI int core_globals_id;#endif#define SAFE_FILENAME(f) ((f)?(f):"-")/* {{{ PHP_INI_MH*/static PHP_INI_MH(OnSetPrecision){int i = atoi(new_value);if (i >= 0) {EG(precision) = i;return SUCCESS;} else {return FAILURE;}}static PHP_INI_MH(OnChangeMemoryLimit){if (new_value) {PG(memory_limit) = zend_atoi(new_value, new_value_length);} else {PG(memory_limit) = 1<<30; /* effectively, no limit */ }return zend_set_memory_limit(PG(memory_limit));}static void php_disable_functions(TSRMLS_D){char *s = NULL, *e;if (!*(INI_STR("disable_functions"))) {return;}e = PG(disable_functions) = strdup(INI_STR("disable_functions"));while (*e) {switch (*e) {case ' ':case ',':if (s) {*e = '\0';zend_disable_function(s, e-s TSRMLS_CC);s = NULL;}break;default:if (!s) {s = e;}break;}e++;}if (s) {zend_disable_function(s, e-s TSRMLS_CC);}}static void php_disable_classes(TSRMLS_D){char *s = NULL, *e;if (!*(INI_STR("disable_classes"))) {return;}e = PG(disable_classes) = strdup(INI_STR("disable_classes"));while (*e) {switch (*e) {case ' ':case ',':if (s) {*e = '\0';zend_disable_class(s, e-s TSRMLS_CC);s = NULL;}break;default:if (!s) {s = e;}break;}e++;}if (s) {zend_disable_class(s, e-s TSRMLS_CC);-` }}static PHP_INI_MH(OnUpdateTimeout){EG(timeout_seconds) = atoi(new_value);if (stage==PHP_INI_STAGE_STARTUP) {/* Don't set a timeout on startup, only per-request */return SUCCESS;}zend_unset_timeout(TSRMLS_C);zend_set_timeout(EG(timeout_seconds));return SUCCESS;}static int php_get_display_errors_mode(char *value, int value_length){int mode;if (!value) {return PHP_DISPLAY_ERRORS_STDOUT;}if (value_length == 2 && !strcasecmp("on", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 3 && !strcasecmp("yes", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 4 && !strcasecmp("true", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 6 && !strcasecmp(value, "stderr")) {mode = PHP_DISPLAY_ERRORS_STDERR;} else if (value_length == 6 && !strcasecmp(value, "stdout")) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else {mode = atoi(value);if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) {mode = PHP_DISPLAY_ERRORS_STDOUT;}}return mode;}static PHP_INI_MH(OnUpdateDisplayErrors){PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value, new_value_length);return SUCCESS;}static PHP_INI_DISP(display_errors_mode){int mode, tmp_value_length, cgi_or_cli;char *tmp_value;TSRMLS_FETCH();if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );tmp_value_length = ini_entry->orig_value_length;} else if (ini_entry->value) {tmp_value = ini_entry->value;tmp_value_length = ini_entry->value_length;} else {tmp_value = NULL;tmp_value_length = 0;}mode = php_get_display_errors_mode(tmp_value, tmp_value_length);cgi_or_cli = (!strcmp(sapi_, "cli") || !strcmp(sapi_, "cgi"));switch (mode) {case PHP_DISPLAY_ERRORS_STDERR:if (cgi_or_cli ) {PUTS("STDERR");} else {PUTS("On");}break;case PHP_DISPLAY_ERRORS_STDOUT:if (cgi_or_cli ) {PUTS("STDOUT");} else {PUTS("On");}break;default:PUTS("Off");break;}}static PHP_INI_MH(OnUpdateErrorLog){/* Only do the safemode/open_basedir check at runtime */if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && strcmp(new_value, "syslog")) {if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {return FAILURE;}if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {return FAILURE;}}OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);return SUCCESS;}static PHP_INI_MH(OnChangeMailForceExtra){/* Don't allow changing it in htaccess */if (stage == PHP_INI_STAGE_HTACCESS) {return FAILURE;}return SUCCESS;}。
idea组件项目步骤

idea组件项目步骤Idea是一种非常流行的Java开发工具。
它由Jetbrains公司开发,具有强大的功能,能够提高开发效率。
在使用Idea进行项目开发时,组件是一个非常重要的概念。
在本文中,将介绍如何在Idea中创建和使用组件。
第一步:创建组件在Idea中创建组件非常简单。
首先,打开Idea并创建一个新项目。
然后,右键单击项目并选择“New”>“Module”。
在弹出的窗口中,选择“Java Module”并点击“Next”。
在下一个页面中,输入您的组件名称和父目录。
选择一个合适的目录,单击“Finish”即可创建组件。
第二步:编辑组件代码创建组件后,接下来要编辑它的代码。
在Idea中,打开新创建的组件并编辑代码。
组件通常由以下几个部分组成:1. 接口接口定义组件公开的方法,以便它们可以在其他代码中使用。
如果您的组件需要在其他项目中使用,接口是非常重要的。
确保您的接口具有清晰简洁的方法,让其他开发人员更容易调用您的组件。
2. 实现类实现类是接口的具体实现,其中包含方法的具体实现。
在创建实现类时,请确保您的代码清晰简洁,并注意代码质量。
3. 测试类测试类用于测试您的组件是否按照预期工作。
在测试类中编写基本的单元测试,确保您的组件按照预期工作。
第三步:使用组件创建并测试组件后,你需要在你的项目中使用它。
为此,请按照以下步骤操作:1. 将组件添加到项目依赖项中在Idea中,您可以将组件添加到项目依赖项中。
为此,请打开您的项目并转到“Project Structure”>“Modules”>“Dependencies”。
然后,单击“+”号并选择“Module Dependency”。
选择你的组件并单击“OK”。
2. 使用组件现在,你可以在你的项目中使用组件了。
在你需要使用组件的代码中,导入组件并调用其方法即可。
在Idea中,创建和使用组件非常简单。
通过遵循以上步骤,你可以轻松创建和使用组件,提高你的开发效率。
安装管理程序在创建该注册表项时遇到错误

安装管理程序在创建该注册表项时遇到错误: UNKNOWN\Components\F1880418D346301488DBC2ED60D5E802\670F66C4BA3D8C94584 DAB6A8DF2AC2E。
与技术支持部联系。
内部错误:该产品组件的Windows Installer 没按预期运行: InstallExecute。
与技术支持部联系。
没有删除干净,请按我以下步骤都试一遍,再重装。
一定行。
1、删除注册表中关于SolidWorks的项(在下面两个位置查找)HKEY_CURRENT_USER\Software\HKEY_LOCAL_MACHINE\SOFTWARE\2、删除硬盘中关于SolidWorks的文件夹(在下面文件位置找)2.1 X:\Program Files\SolidWorks Corp 安装位置2.2 C:\Documents and Settings\【登录用户名】\Application Data\【所有相关SolidWorks 的文件夹】2.3 C:\Documents and Settings\【登录用户名】\Local Settings\Application Data\【所有相关SolidWorks的文件夹】2.5 C:\SolidWorks Data (这是toolbox文件,如果有定制内容,请不要删除,安装时根据选项使用现有数据)2.6 C:\Documents and Settings\Administrator\Local Settings\Temp 该目录清空3.在32位系统的机器上找到如下的两个注册表位置HKLM\SOFTWARE\Microsoft\VSTAHOST 和HKLM\SOFTWARE\Microsoft\VSTAHostConfig,对其进行重新命名(任意命名就可以,比如将VSTAHOST改成VSTAHOST1)。
HKLM多见于注册表就是HKEY_LOCAL_MACHINE的简省写法HKCU就是多见注册表HKEY_CURRENT_USER 简省写法HKCR多见于注册表HKEY_CLASSES_ROOT简省写法.4.在64位系统的机器上找到如下两个注册表regedit位置,HKLM\SOFTWARE\Wow6432Node\Microsoft\VSTAHostConfig,对其进行重新命名(方法同上)。
用ATL创建COM组件详细解说
用ATL创建COM组件详细解说用ATL创建COM组件详细解说用ATL创建COM组件一、创建一个模型(工程) MyProj。
二、给模型(工程)增加一个组件 MyCom。
三、给组件增加方法(函数) MyF1、MyF2、MyF3、MyF4。
一、创建模型(工程) MyProj在VC++6.0工作平台中,点击菜单 File 下的 New 菜单项,在出现的New 对话框中选中Projects 卡片,在列表框中选中ATL COM AppWizard(活动模板库组件导航)。
在Project Name 编辑框中输入项目名如MyProj ,并选择合适的Location 后,按确认按钮进入下一个对话框:ATL COM Appwizard - step 1 of 1,在Server Type 中选择Dynamic Link Library [ DLL ],即进程内服务器,这是最快的组件。
选中 Support MFC 选择项。
在按下 Finish 和 Ok 按钮后,一个组件的框架已经建立。
二、给模型增加组件MyCom在VC++ 菜单Insert 中选中New ATL Object…菜单项,出现ATL Object Wizard 对话框。
在左边的Category 中选择Objects,右边的Objects 中选中Simple Object 项。
按 Next 按钮。
在出现的 ATL Object Wizard 属性对话框中 Names 卡片中的八个编辑框中左上方的 Short Name 编辑框中输入短名如 MyCom ,其他七个编辑框的内容会自动生成。
然后按确认按钮退出。
三、给组件增加方法(函数) MyF1、MyF2、MyF3、MyF4在 VC++工作平台的左边的 Workspace 的 ClassView 卡片中找到接口IMyCom 项,按右键,在出现的快捷菜单中选择Add Method …,出现 Add Method to Interface 对话框,在对话框中输入要增加的函数的函数名、参数和返回值类型。
CATIAV5装配设计说明书
CATIA V5 Training
<2>装配设计选项: 打开Tools>Option选项后,选中Mechanical<机械设计>下的Assembly Design<装配设计>选项.
在此状态设置下,打开一个装配文件,目录树上都呈卸载状态,单击该命令图标弹出Product
Load Management 对话ቤተ መጻሕፍቲ ባይዱ,在目录树上选择要加载的组件,单击对话框中的
按钮加载
CATIA V5 Training
9、管理表达<Manage Representations> 此命令的功能是对当前装配产品中的组件进行显示的管理与修改、替换.
入到当前装配的产品中.
在对话框仍打开时,通过Apply<应用> 按扭可多次执行此命令.
<2>快束多实例化<Fast Multi Instantiation> 如果"定义单行阵列"命令中各参数已设置好,并且在Multi Instantiation对话框中选中了 Define As Default复选框,则定义单行阵列中定义的参数可以在快束多实例化<Fast Multi Instantiation>命令中重复使用.
这个产品的相关数据存储在独立的新文件件内.
CATIA V5 Training
3、插入新零件<Part> 此命令用于在当前的装配体中插入一个新的零件,这个零件的数据保存在独立的CATPart文件中,
使用ATL创建COM组件
ATL COM 工程的产物
ATL COM AppWizrd 最终产生了什么?
下面的表格描述了一切:
文件
描述
.CPP
包含有进程内组件需要的 5 个导出函数
.DEF
.IDL
.RC Resource.h StdAfx.cpp StdAfx.h
DllMain,DllGetClassObjecDllRegisterServer,DllUnre gisterServer, DllCanUnloadNow。对于进程外组件则 实现了 WinMain()函数。 包含有 DLL 到处函数列表,这个文件只有在进程 内组件的工程中才有。 包含有描述接口的接口定义语言,这个文件需要使 用微软的 MIDL 编译器进行编译。 含有工程的资源信息。 资源文件的头文件。 包含有 StdAfx.h 和 Atlimpl.cpp 含有 ATL 需要的头文件。
基于CCORE的工具集用户手册_metrowerks
苏州国芯科技有限公司基于C*Core的开发工具集用户手册本文档仅限于苏州国芯科技有限公司授权的用户使用。
国芯公司保留在无任何通知的情况下对本文档进行修正的权利。
国芯公司不保证其产品适用于任何特殊目的,并拒绝对使用其产品所带来的任何后果承担责任。
国芯公司不转让任何专利的许可。
国芯公司不授权其产品使用于外科移植、生命保障及其它可能导致任何人身伤害的产品当中。
如用户在无任何授权的情况下,将国芯公司的产品应用于以上目的,用户将承担一切责任。
C*Core TM是苏州国芯科技有限公司的注册商标。
目录第一章 METROWERKS CODEWARRIOR 集成开发环境IDE (1)1.1 概述 (1)1.1.1. CodeWarrior IDE 的特点 (1)1.1.2. 系统需求 (2)1.2 工程管理器 (3)1.2.1. 创建新工程 (3)1.2.1.1. 选择一个工程模板 (3)1.2.1.2. 命名新工程 (4)1.2.1.3. 选择开发板类型、DEBUG 接口和程序设计语言 (5)1.2.2. 工程窗口 (5)1.2.2.1. 工程窗口 (6)1.2.2.2. 工程窗口工具栏 (6)1.2.2.3. Files 视图 (6)1.2.2.4. Link Order 视图 (11)1.2.2.5. Targets 视图 (11)1.2.3. 打开存在工程 (11)1.2.4. 保存工程 (12)1.2.5. 关闭工程 (13)1.2.6. 管理工程文件 (13)1.2.6.1. 展开和折叠组 (14)1.2.6.2. 选择文件和组 (14)1.2.6.3. 添加文件 (14)1.2.6.4. 移动文件和组 (16)1.2.6.5. 创建组 (17)1.2.6.6. 删除文件或组 (17)1.3 源码编辑器 (18)1.3.1. 编辑工程文件 (18)1.3.1.1. 建立新文件 (19)1.3.1.2. 打开存在文件 (19)1.3.1.3. 保存文件 (21)1.3.1.4. 关闭文件 (22)1.3.2. 编辑源代码 (23)1.3.2.1. 编辑器窗口使用 (23)1.4 编译和连接 (28)1.4.1. 编译和连接工程 (28)1.4.1.1. 编译文件1.4.1.2.设置连接顺序1.4.1.3. 更新工程1.4.1.4. Make 工程 (30)1.4.1.5. 使能调试1.4.1.6. 运行工程1.4.1.7. 调试工程1.4.1.8. 产生连接图(Link Map )文件 (31)1.4.1.9. 同步修改日期 (32)1.4.1.10. 处理目标代码 (32)1.4.2. 使用预编译或预处理头文件1.4.2.1. 建立预编译头文件1.4.2.2. 预编译命令1.4.2.3. 自动更新 (34)1.4.2.4. 定义C/C++符号 (35)1.4.3. 预处理源代码 (37)1.4.4.反汇编源代码 (37)1.4.5.消息窗口 (37)1.4.6.使用消息窗口 (39)1.4.6.1.查阅错误与警告 (39)1.4.6.2.查看消息 (40)1.4.6.3.纠正编译器错误与警告 (40)1.4.6.4.纠正连接器错误 (40)1.5调试源代码 (41)1.5.1.调试准备 (41)1.5.1.1.为调试设置构建目标 (42)1.5.1.2.为调试设置文件 (42)1.5.1.3.主机与目标板的连接 (43)1.5.2.使用调试器 (43)1.5.3.调试器的使用 (43)1.5.3.1.线程窗口 (44)1.5.3.2.源代码弹出式菜单 (47)1.5.3.3.函数弹出式菜单 (49)1.5.3.4.符号窗口 (49)1.5.3.5.符号提示 (50)1.5.3.6.调试器快捷菜单 (51)1.5.3.7.进程窗口 (51)1.5.3.8.表达式窗口 (53)1.5.3.9.全局变量窗口 (54)1.5.3.10.断点窗口 (54)1.5.3.11.观察点窗口 (55)1.5.3.12.寄存器窗口 (55)1.5.3.13.变量窗口 (57)1.5.3.14.内存窗口 (57)1.5.4.基本的调试 (58)1.5.4.1.运行、步进和暂停代码 (58)1.5.4.2.断点 (63)1.6IDE选项配置 (65)1.6.1.参数面板 (65)1.6.2.目标选项配置 (68)1.6.2.1.Target Settings (68)1.6.2.2.Code-Generation Settings (70)1.6.2.3.调试器设置 (70)第二章EBDI (72)2.1.EBDI的特点 (72)2.2.EBDI配套设备 (72)2.3.EBDI指示灯 (72)2.4.EBDI的连接 (73)2.5.引脚定义和信号说明 (73)2.6.EBDI自检 (75)第三章常用工具软件 (76)3.1.S YS DS下载器的用法 (76)3.2.GNU开发工具包 (78)3.2.1.GNU汇编器和预汇编器 (79)3.2.2.GNU C/C++编译器和C预编译器 (81)3.2.3.GNU连接器 (82)3.3.S记录文件格式 (84)图表目录图1- 1 选择C*CORE 工程模板图1- 2 选择开发板类型、DEBUG接口和程序设计语言图1- 3 用户工程文件窗口图1- 4 工程对象设置对话框图1- 5 工程窗口中排序操作 (9)图1- 6 在工程窗口中产生快捷菜单 (10)图1- 7 工程窗口中的Targets 视图 (11)图1- 8 在工程窗口展开和折叠组图1- 9 向工程(窗口)中添加文件图1- 10 打开对话框(Windows 平台)图1- 11 工程窗口中的接口弹出式菜单 (21)图1- 12 保存文件对话框 (22)图1- 13 编辑器窗口 (23)图1- 14 接口弹出式菜单 (24)图1- 15 函数弹出式菜单 (25)图1- 16 Marker 弹出式菜单 (25)图1- 17 文档设置弹出式菜单 (26)图1- 18 VCS 弹出式菜单 (26)图1- 19 文件路径标题 (26)图1- 20 带多个小窗口的编辑器窗口 (27)图1- 21 构建进度窗口 (29)图1- 22 清除目标代码对话框 (32)图1- 23 CodeWarrior 消息窗口 (38)图1- 24 语句箭头指向错误代码行 (41)图1- 25 在工程窗口中设置调试 (42)图1- 26 线程窗口 (44)图1- 27 调试器工具栏 (45)图1- 28 堆栈窗口 (45)图1- 29 变量窗口 (46)图1- 30 线程窗口中的源代码窗口 (47)图1- 31 源代码视图 (48)图1- 32 汇编程序 视图 (48)图1- 33 程序语言和汇编语言混和视图 (48)图1- 34 函数弹出式菜单 (49)图1- 35 符号窗口 (50)图1- 36 符号提示 (50)图1- 37 调试器快捷菜单 (51)图1- 38 进程窗口 (51)图1- 39 进程窗口中的工具栏 (52)图1- 40 进程窗口 (52)图1- 41 任务窗口 (53)图1- 42 表达式窗口 (53)图1- 43 全局变量窗口 (54)图1- 44 断点窗口 (55)图1- 45 观察点窗口 (55)图1- 46 通用寄存器窗口 (Windows 平台) (56)图1- 47特定寄存器窗口(Windows 平台) (56)图1- 48 变量窗口 (57)图1- 49 内存窗口图1- 50 调试器工具栏图1- 51 当前语句箭头图标图1- 52 Run 命令 (59)图1- 53 开始执行程序图1- 54 Step Over 命令图1- 55 Step Into 命令图1- 56 Step Out 命令 (61)图1- 57 拖动当前语句箭头 (62)图1- 58 设置临时断点 (62)图1- 59 Change Program Counter 对话框 (62)图1- 60 break 命令 (63)图1- 61 Kill 命令 (63)图1- 62 设置断点 (64)图1- 63 设置参数选择面板 (65)图1- 64 Build Settings 参数选择面板 (66)图1- 65 IDE Extras 参数选择面板(Windows ) (67)图1- 66 选择一个设置面板 (69)图2- 1 OnCE 接口连接器 图2- 2 BDM 接口连接器 (74)图3- 1 SysDS 下载器 (76)图3- 2 上载对话框 (77)图3- 3 FLASH/SRAM 内容显示窗口 (78)图3- 4 S 记录组成结构 (85)图3- 5 S 记录传送数据流 (86)表1- 1 脏文件标记状态与图标 (27)表1- 2 变量窗口列表类型 (46)表2- 1 EBDI 状态灯含义 (73)表2- 2 OnCE 接口信号定义 (74)表2- 3 BDM 接口引脚信号定义 (74)表3- 1 GNU 开发工具包主要程序软件 (79)表3- 2 S 记录各字段长度 (85)表3- 3 S 记录类型 (85)第一章Metrowerks CodeWarrior集成开发环境IDE CodeWarrior集成开发环境(IDE)是一个软件开发工具集,集成了源程序编辑器、源程序浏览器、编译器、连接器、汇编器、调试跟踪器,用户可以通过图形用户接口(GUI)方便地使用该系统来进行程序编辑、浏览、检查、修改、编译、连接和调试。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Creating a Core Component Summary Tutorial TU0123 (v2.0) March 04, 2008
This tutorial is designed to give you an overview of how to create a core component, synthesize the EDIF and generate a schematic symbol of the core. It covers creating the core project, synthesizing, publishing and generating the symbol in the Schematic Library Editor.
Creating a core component offers the advantages of design reuse and design security. The design of the core component can be captured in schematic and VHDL and then synthesized to create the EDIF model. EDIF stands for Electronic Design Interchange Format and EDIF models store electronic netlists.
From the core project, you can also generate a new schematic symbol of the core component. By adding different configurations to the core project, the core component can then be used with different FPGA devices.
Creating a Core Project and Schematic This tutorial is based around the creation of a core component for decoding the keypad on the NanoBoard-NB1. 1. Create a new core project by selecting File » New » Project » Core Project. Save the core project as KeyPadScanner.PrjCor, making sure the project name has no spaces in it.
2. Create or add the schematic that you wish to use as the core to the core project, e.g. KeyPadScanner.SchDoc, shown below in Figure 1. This schematic is available from the \Examples\NB1 Examples\Processor Examples\I2C DAC
and ADC - TSK165B folder of the installation. Note that the top sheet of the core design must be the same as the core
project name. To add this schematic to your core project, right-click on the project name in the Projects panel and select Add Existing to Project. Choose the schematic file, KeyPadScanner.SchDoc, and click Open. The schematic document is added to the project and appears in the Projects panel under Source Documents. Save the project.
Figure 1. KeyPadScanner.SchDoc TU0123 (v2.0) March 04, 2008 1 Creating a core component 3. Now we need to set up the project options. Select Project » Project Options and click on the Options tab of the Options for Core Project dialog.
Make sure the Include models in published archive option is selected. This will bundle all EDIF files generated for the
core component together in a zip file when you ‘publish’ the core later. Click OK.
4. For these EDIF files to be generated, a User EDIF models folder must be created. In Microsoft Windows, create a folder, for example MyCores, which will hold your EDIF models. Whenever you synthesize any design, this folder is searched for
models, along with the standard system EDIF folders (\Library\EDIF).
5. Now we need to specify this new folder name in the FPGA - Synthesis page of the Preferences dialog (Tools » FPGA
Preferences) so the system knows where to look for your published EDIF files during synthesis.
Click on the folder icon next to the Use presynthesized model folder option to browse to the folder’s location, as shown in the dialog below. Click OK.
Creating Configurations and Constraints The next setup required is the creation of configuration and constraint files targeting the devices you want your core component to be used on. A constraint file will set the target FPGA device. Note that you need to create one configuration for each device family that you want the core to target. The core component can then be used in any device in that device family. We will set up two configurations so the core component can be used with two different target FPGA device families.
To create a new constraint file: 1. Right-click on the core project name in the Projects panel and select Add New to Project » Constraint File. A Constraint
file will appear in the Settings\Constraint Files folder in the Projects panel and a new file, Constraint1.Constraint, opens in the Constraint editor.
2 TU0123 (v2.0) March 04, 2008 Creating a core component 2. From the Constraint editor menus, select Design » Add/Modify Constraint » Part. The Choose Physical Device dialog appears.
3. We will set up a constraint file to target the Xilinx SpartanIIE chip first. Click on Xilinx in the Vendors list and select
Spartan2E. The SpartanIIE included with the NanoBoard-NB1 is a 208 pin Quad Flat Pack package, with 300,000 equivalent gates. Click on the cell that represents this device, i.e. the 146 at the junction of XC2S300E and PQ208 for a
XC2S300E-6PQ208. Click OK and a new device specification constraint is added into the Constraint file.