haslinux headers是什么()是什么意思

EXCEL =MonthHeaders 是什么意思_百度知道
EXCEL =MonthHeaders 是什么意思
MonthHeaders是名称。公式-名称管理器,就可看见这个名称所定义的内容。
来自团队:
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁From Crypto++ Wiki
iOS is Apple's mobile operating system and used by the iPhone, iPad, and iTouch. Apple's mobile devices are popular in many markets, and this wiki article will demonstrate building the Crypto++ library for iOS 4.2 using Xcode 3.2.5 and GCC 4.2. Though iOS supplies and uses dynamic libraries (*.dynlib), developers can only build a static library on iOS. If you are interested in a dynamic library for MAC OS X, please see Uri's mailing list post at .
is Apple's free development environment. Apple's mobile development framework is
and language of choice is . Cocoa Touch is Apple's equivalent of frameworks such as QT and MFC. While Cocoa and Objective C can be a surprise for GUI programmers with a background in MFC, QT, or GTK++, the language causes no hardships for the Crypto++ library.
iOS targets the ARM processor (v6, v7, v7s and 64-bit version), so Crypto++'s CRYPTOPP_DISABLE_ASM should be defined. The macros can be defined in the Xcode environment or the Crypto++ library's config.h. This article will define the macros in the environment (see ).
A wiki page is available for cross-compiling Crypto++ from the command line at . The
page includes instructions and a patch for the makefile.
Finally, Dr. Ugo Chirico offers an iPhone port of Crypto++ 5.5.2 at . In addition, a GitHub project script is available
. Note, however, that this will not compile under Xcode 4.5.2.
Download Crypto++ from the website, or fetch the library from Sourceforge. Below, a terminal was used and the project was retrieved from Sourceforge. A terminal can be found from the Dock Bar in Applications → Utilities.
$ svn checkout https://cryptopp.svn.sourceforge.net/svnroot/cryptopp/trunk/c5 cryptopp
cryptopp/winpipes.cpp
cryptopp/safer.cpp
cryptopp/adler32.h
cryptopp/dlltest.vcproj
cryptopp/rijndael.h
Checked out revision 521.
Figure 1: Xcode Cocoa Touch Library
Figure 2: Cocoa Touch Library Project
In Xcode, select a new Cocoa Touch Static Library as shown in Figure 1. When prompted, name the project cryptopp.
The project files should look similar to Figure 2. By Xcode convention, Objective-C class files are added to the Classes folder, and non-Objective-C files are added to Other Sources. In Figure 2, two folders were added under Other Sources: Header Files and Source Files. Crypto++ header and source files will be added to the new folders
Note that libcryptopp.a is in red under the Products group since the library is not yet built - Xcode deems the library missing.
Move the Crypto++ directory into the Xcode project directory. Below, a terminal was used to perform the move.
Downloads Movies
Pictures Sites
Documents Library
$ mv cryptopp/ Documents/cryptopp/
$ ls Documents/cryptopp/
cryptopp.xcodeproj
cryptopp_Prefix.pch
Add the Crypto++ header files to the Header Files folder, and the source files to the Source Files folder. There is no need to check 'Copy items into destination group's folder.' adhoc.cpp.proto or dlltest.cpp can also be removed since the files are used on Windows. In addition, source files such as datatest.cpp, regtest.cpp and validat{1|2|3}.cpp are not needed.
Figure 4: Add Crypto++ files to Project
For those who did not copy the Crypto++ sources into the project's directory, please take some time to research Xcode paths and xconfig files. See
in the Xcode Build System Guide and .
With cryptopp highlighted under Groups & Files (the left tree view in Figure 5), click the large blue info button to bring up the project's build settings.
Figure 5: Crypto++ Xcode Project
Figure 6: Crypto++ Xcode Build Settings
Ensure All Configurations is selected as shown in Figure 6. Add CRYPTOPP_DISABLE_ASM and CRYPTOPP_DISABLE_SSE2 to Preprocessor Macros as shown in Figure 7 below. Xcode does not appear to reliably define DEBUG and NDEBUG, so take time to define the symbols also. See GCC_PREPROCESSOR_DEFINITIONS at .
Figure 7: Preprocessor Macros Build Settings
For completeness, the iPhone simulator runs locally using a 32 bit i386 binary, and not an x86_64 binary. Disabling assembly instructions and SSE2 for all available targets keeps things simple.
Another setting which is useful, but not required, is -Wall -Wno-unused -Wno-unknown-pragmas under GCC 4.2 Warnings, Other Warning Flags. Be careful of -Wextra since GCC 4.2 will flag signed/unsigned comparisons due to C++ templates. -Wno-type-limits will suppress the spurious template warnings, but the option is only available in GCC 4.3 and above. See .
config.h needs to be modified as follows. You can apply the patch manually from mobile.diff (in the ZIP), manually patch the config file (discussed next) or replace the config.h with the updated one (in the ZIP).
To patch it manually, first add the following to the top of config.h.
// For TARGET_OS_IPHONE and TARGET_IPHONE_SIMULATOR
#if defined(__APPLE__)
# include &TargetConditionals.h&
# if defined(TARGET_IPHONE_SIMULATOR) && (TARGET_IPHONE_SIMULATOR != 0)
define CRYPTOPP_IPHONE_SIMULATOR 1
# elif defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0)
define CRYPTOPP_IPHONE 1
# elif defined(TARGET_OS_MAC) && (TARGET_OS_MAC != 0)
define CRYPTOPP_MAC_OSX 1
error Unknown Apple platform
Second, around line 250, disable X86 and X64 assembly. Add the code before the config file uses the CRYPTOPP_DISABLE_* macros.
// For cross-compiles, just ignore host settings that bleed through for Xcode/iOS
// We will accidentally catch some device builds that use x86 on Android.
#if defined(__ANDROID__) || defined(CRYPTOPP_IPHONE) || defined(CRYPTOPP_IPHONE_SIMULATOR)
# define CRYPTOPP_DISABLE_ASM 1
# define CRYPTOPP_DISABLE_SSE2 1
# define CRYPTOPP_DISABLE_SSE3 1
Finally, around line 350, ensure CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS is undefined. Unaligned data access is a problem on older ARM devices, and will result in a SIGBUS or EXCEPTION_DATATYPE_MISALIGNMENT (newer ARM CPUs behave like x86/x64). Also set CRYPTOPP_BOOL_X86 and CRYPTOPP_BOOL_X64 to 0 since they are host (and not target) settings.
// For cross-compiles, just ignore host settings that bleed through for Xcode/iOS
// We will accidentally catch some device builds that use x86 on Android.
#if defined(__ANDROID__) || defined(CRYPTOPP_IPHONE) || defined(CRYPTOPP_IPHONE_SIMULATOR)
# undef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
# undef CRYPTOPP_BOOL_X86
# define CRYPTOPP_BOOL_X86 0
# undef CRYPTOPP_BOOL_X64
# define CRYPTOPP_BOOL_X64 0
After building, libcryptopp.a will be displayed in black instead of red since the library is available (contrast to Figure 2).
Figure 9: Successful build of the library
Figure 10: Library Dependencies and Linked Libraries
After building the Crypto++ library, the libcryptopp.a can be added as a Direct Dependency of an executable (meaning the executable is dependent upon the library), and then as a Linked Library (meaning the executable will link against the library). See Figure 10.
Xcode precompiled headerXcode includes extensive support for precompiled headers. Precompiled header support was added when the Crypto++ library project was created by Xcode.
To take advantage of Xcode's precompiled headers, add Crypto++'s pch.h to Xcode's cryptoppp_Prefix.pch. Then define Crypto++'s USE_PRECOMPILED_HEADERS under Xcode's Preprocessor Macros build settings. Crypto++'s pch.h will pick up the USE_PRECOMPILED_HEADERS define and include additional headers for precompilation.
Apple/Xcode offers three defines of interest for those who are mindful of cross platform source code. __APPLE__ will defined on the platform, and __OBJC__ will be defined when Objective C is available. When using a BSD based kernel, __MACH__ will also be defined.
Apple provides some guidance in preprocessor macros in . A number of predefined macros are available from Availability.h and TargetConditionals.h. The former is more fine grained and allows you to differentiate between OS X and iOS (but not Simulator) and version numbers of each. The later is coarse grained and allows you to differentiate between OS X, iOS, Simulator and CPU types.
TargetConditionals.h is used prodigiously in . There is a TargetConditionals.h in the base system's /usr/include, and in each of the SDKs located at /Applications/Xcode.app/.../&platform&/.../usr/include. The trick to using them correctly is treating them as a compiler Boolean, and not using them as defined conditionals like #if defined(TARGET_OS_IPHONE).
According to comments in the header files regarding TARGET_OS_*:
These conditionals specify in which Operating System the generated code will
run. The MAC/WIN32/UNIX conditionals are mutually exclusive.
The EMBEDDED/IPHONE
conditionals are variants of TARGET_OS_MAC.
TARGET_OS_MAC
- Generate code will run under Mac OS
TARGET_OS_WIN32
- Generate code will run under 32-bit Windows
TARGET_OS_UNIX
- Generate code will run under some non Mac OS X unix
TARGET_OS_EMBEDDED
- Generate code will run under an embedded OS variant
of TARGET_OS_MAC
TARGET_OS_IPHONE
- Generate code will run under iPhone OS which
is a variant of TARGET_OS_MAC.
TARGET_IPHONE_SIMULATOR
- Generate code for running under iPhone Simulator
Here is how the various Apple defines are translated into CRYPTOPP_IPHONE CRYPTOPP_MAC_OSX and CRYPTOPP_IPHONE_SIMULATOR for targeting Apple platforms during cross compiles:
#if defined(__APPLE__)
# include &TargetConditionals.h&
# if defined(TARGET_IPHONE_SIMULATOR) && (TARGET_IPHONE_SIMULATOR != 0)
define CRYPTOPP_APPLE_SIMULATOR 1
# elif defined(TARGET_APPLE_IPHONE) && (TARGET_OS_IPHONE != 0)
define CRYPTOPP_IPHONE 1
# elif defined(TARGET_OS_WATCH) && (TARGET_OS_WATCH != 0)
define CRYPTOPP_APPLE_WATCH 1
# elif defined(TARGET_OS_MAC) && (TARGET_OS_MAC != 0)
define CRYPTOPP_APPLE_OSX 1
error Unknown Apple platform
#endif /* Apple */
cdefs.h includes a few interesting symbols: PRODUCT_AppleTV, PRODUCT_iPhone and PRODUCT_MacOSX. Unfortunately, PRODUCT_iPhone never seems to be defined, and cdefs.h should not be relied upon.
If all you need is to differentiate between OS X and iOS, then the following from Availability.h should work fine:
#if defined(__APPLE__)
# include &Availability.h&
# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
define CRYPTOPP_MAC_OSX 1
# elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
define CRYPTOPP_IPHONE 1
error Unknown Apple platform
#endif /* Apple */
The OS X base system uses path /usr/include. The defines of interest from TargetConditionals.h are:
#define TARGET_OS_MAC
#define TARGET_OS_WIN32
#define TARGET_OS_UNIX
#define TARGET_OS_EMBEDDED
#define TARGET_OS_IPHONE
#define TARGET_IPHONE_SIMULATOR
The iPhone Simulator's SDK uses /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/include. The defines of interest from TargetConditionals.h are:
#define TARGET_OS_MAC
#define TARGET_OS_WIN32
#define TARGET_OS_UNIX
#define TARGET_OS_EMBEDDED
#define TARGET_OS_IPHONE
#define TARGET_IPHONE_SIMULATOR
The iPhone's SDK uses /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/include. The defines of interest from TargetConditionals.h are:
#define TARGET_OS_MAC
#define TARGET_OS_WIN32
#define TARGET_OS_UNIX
#define TARGET_OS_EMBEDDED
#define TARGET_OS_IPHONE
#define TARGET_IPHONE_SIMULATOR
The OS X SDK uses /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include. The defines of interest from TargetConditionals.h are:
#define TARGET_OS_MAC
#define TARGET_OS_WIN32
#define TARGET_OS_UNIX
#define TARGET_OS_EMBEDDED
#define TARGET_OS_IPHONE
#define TARGET_IPHONE_SIMULATOR
In addition to providing platforms, TargetConditionals.h also provides CPU architectures by way of TARGET_CPU_*:
These conditionals specify which microprocessor instruction set is being
generated.
At most one of these is true, the rest are false.
TARGET_CPU_PPC
- Compiler is generating PowerPC instructions for 32-bit mode
TARGET_CPU_PPC64
- Compiler is generating PowerPC instructions for 64-bit mode
TARGET_CPU_68K
- Compiler is generating 680x0 instructions
TARGET_CPU_X86
- Compiler is generating x86 instructions
TARGET_CPU_X86_64
- Compiler is generating x86_64 instructions
TARGET_CPU_ARM
- Compiler is generating ARM instructions
TARGET_CPU_ARM64
- Compiler is generating ARM64 instructions
TARGET_CPU_MIPS
- Compiler is generating MIPS instructions
TARGET_CPU_SPARC
- Compiler is generating Sparc instructions
TARGET_CPU_ALPHA
- Compiler is generating Dec Alpha instructions
After building the project, expanding a compile results in the following for the Build Results window. The command line below is for integer.cpp, but is representative of all Crypto++ source files. Formatting was applied to two commands to reduce horizontal scrolling.
CompileC build/cryptopp.build/Debug-iphonesimulator/cryptopp.build/Objects-normal/i386/integer.o cryptopp-r521/integer.cpp ?
normal i386 c++ pilers.gcc.4_2
cd /Users/jeffrey/Documents/cryptopp
setenv LANG en_US.US-ASCII
setenv PATH &/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin&
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -x c++ -arch i386 -fmessage-length=0 -pipe ?
-Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable ?
-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -fexceptions -mfix-and-continue ?
-mmacosx-version-min=10.6 -gdwarf-2 -D__IPHONE_OS_VERSION_MIN_REQUIRED=40200 ?
-iquote /Users/jeffrey/Documents/cryptopp/build/cryptopp.build/Debug-iphonesimulator/cryptopp.build/cryptopp-generated-files.hmap ?
-I/Users/jeffrey/Documents/cryptopp/build/cryptopp.build/Debug-iphonesimulator/cryptopp.build/cryptopp-own-target-headers.hmap ?
-I/Users/jeffrey/Documents/cryptopp/build/cryptopp.build/Debug-iphonesimulator/cryptopp.build/cryptopp-all-target-headers.hma ?
-iquote /Users/jeffrey/Documents/cryptopp/build/cryptopp.build/Debug-iphonesimulator/cryptopp.build/cryptopp-project-headers.hmap ?
-F/Users/jeffrey/Documents/cryptopp/build/Debug-iphonesimulator -I/Users/jeffrey/Documents/cryptopp/build/Debug-iphonesimulator/include ?
-I/Users/jeffrey/Documents/cryptopp/build/cryptopp.build/Debug-iphonesimulator/cryptopp.build/DerivedSources/i386 ?
-I/Users/jeffrey/Documents/cryptopp/build/cryptopp.build/Debug-iphonesimulator/cryptopp.build/DerivedSources ?
-include /var/folders/dC/dCfs8ij4HeWN-ZqbDcAWyU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/ ?
cryptopp_Prefix-glftuiuqopisxmehyamygkzfneex/cryptopp_Prefix.pch ?
-c /Users/jeffrey/Documents/cryptopp/cryptopp-r521/integer.cpp ?
-o /Users/jeffrey/Documents/cryptopp/build/cryptopp.build/Debug-iphonesimulator/cryptopp.build/Objects-normal/i386/integer.o
In addition to the environment's settings, iOS has predefined macros available. To determine the predefined vendor macros in play, first locate cpp:
$ find /Developer/ -wholename &*/cpp&
Xcode run scriptNext, create a Run Script which runs as a pre-build step using the iOS version of cpp.
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp -dM & /dev/null | sort
Results will be similar to below. We see that at least two addition macros of interest exist for the platform: __APPLE_CC__ and OBJEC_NEW_PROPERTIES.
Figure 11: cpp output for the iOS preprocessor
If you receive four errors with a message similar to, Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1, you probably did not add CRYPTOPP_DISABLE_ASM and CRYPTOPP_DISABLE_SSE2 to all configurations under Preprocessor Macros.
Expanding the compiler output in the Build Results windows will show similar to the following.
/Users/jeffrey/cryptopp/cryptopp-r521/integer.cpp:4232:
instantiated from here
/Users/jeffrey/cryptopp/cryptopp-r521/algparam.h:322: warning: unused variable 'p'
{standard input}:13639:suffix or operands invalid for `call'
{standard input}:13639:suffix or operands invalid for `call'
{standard input}:13639:suffix or operands invalid for `call'
{standard input}:13639:suffix or operands invalid for `call'
{standard input}:13639:suffix or operands invalid for `call'
{standard input}:13639:suffix or operands invalid for `call'
{standard input}:13639:suffix or operands invalid for `call'
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
If you receive a number of errors which culminate in Symbol(s) not found, ensure Crypto++ is a linked library (see ), or add -lcryptopp to Other Linker Flags under the executable's Build Settings.
Error: &CryptoPP::BufferedTransformation::ChannelCreatePutSpace(std::basic_string&char, std::char_traits&char&, ?
std::allocator&char& & const&, unsigned long&)&, referenced from:
vtable for CryptoPP::Bufferless&CryptoPP::Sink&in cryptotest.o
vtable for CryptoPP::Sinkin cryptotest.o
vtable for CryptoPP::StringSourcein cryptotest.o
vtable for CryptoPP::SourceTemplate&CryptoPP::StringStore&in cryptotest.o
vtable for CryptoPP::AutoSignaling&CryptoPP::InputRejecting&CryptoPP::BufferedTransformation& &in cryptotest.o
vtable for CryptoPP::InputRejecting&CryptoPP::BufferedTransformation&in cryptotest.o
vtable for CryptoPP::InputRejecting&CryptoPP::Filter&in cryptotest.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
- Xcode 3.2.5 project with Crypto++ 5.6.1 (revision 521) for iOS 4.2 targets
This will compile under Xcode 4.5.2 and llvm 4.1, but, with the default optimization settings AES encryption, at a minimum, will NOT function properly. Compilation with no optimization does work.
- Makefile for cross-compiling the library
- Updated GNUmakefile-cross and three scripts to set the environment for Android, ARM embedded and iOS when cross-compiling the library. This is a rollup of the mobile and embedded downloads.
Navigation menu
This page was last modified on 7 December 2015, at 16:56.

我要回帖

更多关于 rehasol是什么意思 的文章

 

随机推荐