error: ‘to_string’ is not a member of ‘std’———已解决

现象¶

cocos2d-x 2.2.6 项目的源码中使用了 std::to_string() 方法,使用 NDK r9d 编译的时候,报如下错误:

error: 'to_string' is not a member of 'std'

Application.mk 文件的部分内容如下:

APP_STL := gnustl_static
NDK_TOOLCHAIN_VERSION := 4.8
APP_CPPFLAGS := -frtti -std=c++11 -fexceptions -Wno-error=format-security -Wno-literal-suffix -Wno-deprecated-declarations -fsigned-char -Os $(CPPFLAGS)

换用 NDK 10e ,错误依然。

快速解决¶

想快速解决这个问题,可以自己写一个 std::to_string() 替换标准库中的。

首先写一个 stdtostring.h 文件:

#ifndef STDTOSTRING_H
#define STDTOSTRING_H
#include <string>
#include <sstream>

using namespace std;
namespace std
{
    template < typename T > std::string to_string( const T& n )
    {
        std::ostringstream stm ;
        stm << n ;
        return stm.str() ;
    }
}
#endif

然后在需要使用 std::to_stirng() 方法的源文件中包含它:

#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#include "stdtostring.h"
#endif

追根溯源¶

Why gnustl_static 中介绍了采用 c++_static 和 clang 编译器来实现std::to_string() 支持,于是我尝试了下:

# APP_STL := gnustl_static
# NDK_TOOLCHAIN_VERSION := 4.8
APP_STL := c++_static
NDK_TOOLCHAIN_VERSION := clang

根据 C++ Library Support 的说明, c++_static 对应的是 The LLVM libc++ runtime (static) ,因此应该采用 clang 的工具链进行编译。

结果是: std::to_string() 编译正常,但出现下面的错误:

In file included from src/Utilities.cpp:1:0:
android-ndk-r9d/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:1498:46: error: expected unqualified-id before 'float'
inline _LIBCPP_INLINE_VISIBILITY float       remainder(float __x, float __y) _NOEXCEPT             {return remainderf(__x, __y);}
                                             ^
android-ndk-r9d/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:1498:46: error: expected ')' before 'float'
android-ndk-r9d/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:1499:46: error: expected unqualified-id before 'long'
inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) _NOEXCEPT {return remainderl(__x, __y);}
                                             ^
android-ndk-r9d/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:1499:46: error: expected ')' before 'long'
android-ndk-r9d/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:1509:1: error: expected ')' before '__x'
remainder(_A1 __x, _A2 __y) _NOEXCEPT
^
android-ndk-r9d/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:1559:46: error: expected unqualified-id before 'float'
inline _LIBCPP_INLINE_VISIBILITY float       round(float __x) _NOEXCEPT       {return roundf(__x);}
                                             ^
android-ndk-r9d/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:1559:46: error: expected ')' before 'float'
android-ndk-r9d/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:1560:46: error: expected unqualified-id before 'long'
inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) _NOEXCEPT {return roundl(__x);}
                                             ^
android-ndk-r9d/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:1560:46: error: expected ')' before 'long'
android-ndk-r9d/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:1565:1: error: expected ')' before '__x'
round(_A1 __x) _NOEXCEPT {return round((double)__x);}

minggo 在 Cocos can’t compile Android with APP_STL := c++_static 中提到:

A prebuilt version can only support one type of c++ lib. Did you mean we should provide two kinds of prebuilt libcocos2d that using two different c++ libs?

I don’t know if cocos2d can compile with c++_static or not. I don’t remember if there is a good reason to choose one instead of other one. But cocos2d-x uses gnustl_static from very early version, so we know it works well. You can replace it with c++_static if you like, but it is not fully tested.

因此我怀疑在 cocos2d-x 的旧版本中, c++_static 是没有经过完整测试的。

也有人说 在新版本(>3.7)中, gnustl_static 会导致 lambda 和std::to_string 不能使用,已经切换到使用 c++_static 和 clange 组合。

I never made it to work with gnustl_static and gcc with all the c++11 features. I was getting crashes in simple lambdas, as mentioned std::to_string was missing and much more, so i’ve switched to c++_static and clang long time ago.

本文转自:http://www.tuicool.com/articles/RBBjMz

转载于:https://www.cnblogs.com/Anzhongliu/p/6091789.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
GreenCppC 2008-8-24 ========================================= // I 类,对象,函数重载 //-------- From C to C++ ------------ // A simple C Program! // convert a string to uppercase! #include <stdio.h> #define N 200 int main(){ char ms[N]; int i; printf("Input ms: "); gets(ms); for(i=0;ms[i];i++) if(ms[i]>='a'&&ms[i]<='z') ms[i]-='\x20'; puts(ms); return 0; } /* path d:\wingw\bin gcc abc.c -o abc.exe */ //------------------------------ // A better C Program! #include <stdio.h> #define N 200 void strUpper(char *s); void strLower(char *s); int main(){ char ms[N]; printf("Input ms: "); gets(ms); strUpper(ms); puts(ms); strLower(ms); puts(ms); return 0; } void strUpper(char *s) { for(;*s;s++) if(*s>='a'&&*s<='z')*s-='\x20'; } void strLower(char *s) { for(;*s;s++) if(*s>='A'&&*s<='Z')*s+='\x20'; } //------------------------------ // A C++ Program without class and object! #include <iostream> using namespace std; const int N=200; void strUpper(char *s); void strLower(char *s); int main(){ char ms[N]; cout<<"Input ms: "; cin.getline(ms,N); strUpper(ms); cout<<ms<<"\n"; strLower(ms); cout<<ms<<endl; return 0; } void strUpper(char *s) { for(;*s;s++) if(*s>='a'&&*s<='z')*s-='\x20'; } void strLower(char *s) { for(;*s;s++) if(*s>='A'&&*s<='Z')*s+='\x20'; } //------------------------------ // A C++ Program with class and object! #include <iostream> using namespace std; const int N=200; class Str{ char s[N]; public: void out(){cout<<s<<"\n";} void in(){cout<<"s: "; cin.getline(s,N);} void upper(); void lower(); }; void Str::upper() {char *p; for(p=s;*p;p++) if(*p>='a'&&*p<='z')*p-='\x20'; } void Str::lower() { for(char *p=s;*p;p++) if(*p>='A'&&*p<='Z')*p+='\x20'; } // - - - int main(){ Str a; cin>>a.s; //error! a.in(); a.upper(); a.out(); a.lower(); a.out(); return 0; } ========================================= // II. 构造与析构函数 #include <iostream> #include <cstring> using namespace std; class child { char name[20]; int age; public: child(); child(char *n,int a); void ask(char *n); void ask(int a); ~child(); }; // --- child::child(){ strcpy(name,"Tomme"); age=3; } // --- child::child(char *name,int age){ strcpy(this->name,name); this->age=age; // this -- address of self object } // --- void child::ask(char *n){ if(!strcmp(name,n)) cout<<"Yes, i am "<<n<<".\n"; else cout<<"No, i am not "<<n<<".\n"; } // --- void child::ask(int age){ if(this->age==age) cout<<"Yes, i am "<<age<<" years old.\n"; else cout<<"No, i am not "<<age<<" years old.\n"; } // --- child::~child(){ cout<<name<<": Bye!\n"; } //---------- int main(){ child tom,rose("Rosie",4); tom.age=4; // error! tom.ask("tom"); rose.ask("Alice"); tom.ask(2); return 0; } ========================================= // III. 继承 #include <iostream> #include <cstring> using namespace std; class child { protected: //note this change! char name[20]; int age; public: child(); child(char *n,int a); void ask(char *n); void ask(int a); }; // --- child::child(){ strcpy(name,"Tomme"); age=3; } // --- child::child(char *n,int a){ strcpy(name,n); age=a; } // --- void child::ask(char *n){ if(!strcmp(name,n)) cout<<"Yes, i am "<<n<<".\n"; else cout<<"No, i am not "<<n<<".\n"; } // --- void child::ask(int a){ if(a==age) cout<<"Yes, i am "<<a<<" years old.\n"; else cout<<"No, i am not "<<a<<" years old.\n"; } // ----------- class pupil: public child{ char book[20]; public: pupil(char *n,int a,char *b); void list(); }; // --- pupil::pupil(char *n,int a,char *b): child(n,a) { strcpy(book,b); } // --- void pupil::list() { cout<<name<<" "<<age<<" "<<book<<"\n"; } //---------- int main(){ child tom,rose("Rosie",4); tom.ask("tom"); rose.ask("Alice"); tom.ask(2); pupil green("Green",9,"Nature"); green.ask("Jack"); green.ask(10); green.list(); return 0; } ========================================= // IV. 增加与基类成员函数同名的函数; // 调用基类成员函数;内联函数(in-line) #include <iostream> #include <cstring> using namespace std; class child { protected: char name[20]; int age; public: child(); child(char *n,int a); void ask(char *n); void ask(int a); }; // --- child::child(){ strcpy(name,"Tomme"); age=3; } // --- child::child(char *n,int a){ strcpy(name,n); age=a; } // --- void child::ask(char *n){ if(!strcmp(name,n)) cout<<"Yes, i am "<<n<<".\n"; else cout<<"No, i am not "<<n<<".\n"; } // --- void child::ask(int a){ if(a==age) cout<<"Yes, i am "<<a<<" years old.\n"; else cout<<"No, i am not "<<a<<" years old.\n"; } // ----------- class pupil: public child{ char book[20]; public: pupil(char *n,int a,char *b); void ask(char *n){child::ask(n);} // in-line! void ask(int a){child::ask(a);} void ask(); }; // --- pupil::pupil(char *n,int a,char *b): child(n,a) { strcpy(book,b); } // --- void pupil::ask() { cout<<name<<" "<<age<<" "<<book<<"\n"; } //---------- int main(){ child tom,rose("Rosie",4); tom.ask("tom"); rose.ask("Alice"); tom.ask(2); pupil green("Green",9,"Nature"); green.ask("Jack"); green.ask(10); green.ask(); return 0; } ===================================== // V. 对象数组 #include <iostream> using namespace std; class C1{ int a,b; public: C1(int m,int n){a=m;b=n;} int getAdd(){return a+b;} }; int main() {C1 ob[3]={C1(1,2),C1(3,4),C1(5,6)}; int i; for(i=0;i<3;i++) cout << ob[i].getAdd() << " "; // C1 oe[2]; -- Error! means constructor is C1() // -- need reload C1::C1(){ ... } // -- eg, C1::C1(){a=b=0;} return 0; } ========================================= // VI. 指向对象的指针 C1 obA(2,3), *p; p=&obA; cout << p->getAdd(); //------------- C1 ob[3]={C1(1,2),C1(3,4),C1(5,6)}, *q; q=ob; for(int i=0;i<3;i++) {cout << q->getAdd() << " "; q++; } //------------- class C2{ public: int a; C2(int k){a=k*k;} }; // . . . C2 obB(9); int *p; p=&obB.a; // Note! a is public, p to member cout << *p; // 指向派生类的指针 class Base{ public: int a,b; Base(int m,int n){a=m;b=n;} int getAdd(){return a+b;} }; class Derived: public Base{ int c; public: Derived(int x,int y,int z): Base(x,y) {c=z;} float getAve(){return (a+b+c)/3.0F;} }; // ... Base *bp; Derived d(6,7,9); bp=&d; cout << bp->getAdd(); cout << bp->getAve(); // Error! cout << ((Derived *) bp) ->getAve(); ========================================= // VII. 动态分配:new, delete #include <iostream> #include <new> using namespace std; int main() {int *p; try{ p=new int; } catch(bad_alloc ex){ cout << "New failed!\n"; return -1; } *p=20; cout << "At "<<p<<" is "<< *p <<"\n"; delete p; return 0; } //------------- #include <iostream> #include <new> using namespace std; int main() {int *p; try{ p=new int[6]; } catch(bad_alloc ex){ cout << "New failed!\n"; return -1; } float ave=0.0F; int i; cout<<"Enter numbers: "; for(i=0;i<6;i++) {cin>>p[i]; ave+= *(p+i); cout<< *(p+i); } ave/=6.0F; cout << "Ave = "<< ave <<"\n"; delete [] p; return 0; } //------------- #include <iostream> #include <cstring> #include <new> using namespace std; class Balance{ char name[40]; double curValue; public: Balance(char *n,double v){ strcpy(name,n); curValue=v; } void getValue(char *n,double &v){ strcpy(n,name); v=curValue; } }; int main() { Balance *p; char s[40]; double bal; try{ p=new Balance("Robin Hood",3536.45); } catch(bad_alloc ex){ cout << "New failed!\n"; return -1; } p->getValue(s,bal); cout<<s<<"\'s balance is "<<bal<<"\n"; delete p; return 0; } ========================================= // VIII. 传递引用 #include <iostream> using namespace std; void neg1(int k); void neg2(int *p); void neg3(int &k); int main() { int x=20; neg1(x); neg2(&x); cout << x<< "\n"; neg3(x); cout << x<< "\n"; } // - - - void neg1(int k) { k=-k;} void neg2(int *p) { *p=-*p;} void neg3(int &k) { k=-k; } //------------- #include <iostream> using namespace std; class C1{ public: int k; void neg(C1 &o){o.k=-o.k;} // -- no temp object created }; int main() { C1 ob; ob.k=20; ob.neg(ob); cout << ob.k <<"\n"; return 0; } //----------------------------------- /* Input a sentence,reverse all the words except other chars, eg: etihw, dna kcalb! => white, and black! NOT: !black and ,white */ #include <iostream> #include <new> #include <cstdlib> #include <cctype> using namespace std; const int N=200; /* - - - - - - */ class CharStack{ const int StkLen; char *data; int top; public: CharStack(); ~CharStack(){delete []data;} int push(char x) {if(top>=StkLen-1)return -1; // it's full top++; data[top]=x; return 0; } int pop(char &x) {if(top<=-1)return -1; // empty! x= *(data+top); top--; return 0; } }; CharStack::CharStack():StkLen(40) {try{ data=new char[StkLen]; }catch(bad_alloc){cout<<"New failed!"; exit(-1);} top=-1; } // --------- class WordRev{ char ms[N]; public: void reads() { cout<<"Input str:\n"; cin.getline(ms,N); } void prints() { cout<<ms<<"\n"; } void wRev(); }; void WordRev::wRev() {CharStack stk; int i=0,wStart,wEnd; while(ms[i]) {if(!isalpha(ms[i]))i++; else {wStart=i; while(isalpha(ms[i]))stk.push(ms[i++]); wEnd=i; i=wStart; while(!stk.pop(ms[i]))i++; i=wEnd; } } } // --------- int main() { WordRev sr; sr.reads(); sr.wRev(); sr.prints(); return 0; } ========================================= // IX 函数形参使用默认值 #include <iostream> #include <cstring> using namespace std; // ----------- class pupil{ public: char name[20]; int age; char book[20]; pupil(char *n,int a,char *b); void list(); }; // --- pupil::pupil(char *n,int a,char *b){ strcpy(name,n); age=a; strcpy(book,b); } // --- void pupil::list() { cout<<name<<" "<<age<<" "<<book<<"\n"; } //---------- void nextYear(pupil &c,char *book="Math"); //---------- int main(){ pupil green("Green",9,"Chinese"); green.list(); nextYear(green); green.list(); nextYear(green,"Nature"); green.list(); return 0; } //---------- void nextYear(pupil &c,char *book="Math") { // ="Math" Should be omitted, for previous prototype c.age++; strcpy(c.book,book); return; } /* D:\green>g++ pupil.cpp -o pupil.exe pupil.cpp: In function `void nextYear(pupil&, char*)': pupil.cpp:41: error: default argument given for parameter 2 of `void nextYear(pupil&, char*)' pupil.cpp:25: error: after previous specification in `void nextYear(pupil&, char*)' */ ========================================= // X. 虚函数 virtual #include <iostream> using namespace std; class base{ public: virtual void vf(){cout<<"base's vf.\n";} }; class derived1:public base{ public: virtual void vf(){cout<<"derived1's vf.\n";} }; class derived2:public base{ public: virtual void vf(){cout<<"derived2's vf.\n";} }; void f(base &r){r.vf();} int main() {base b, *p; derived1 d1; derived2 d2; b.vf(); d1.vf(); d2.vf(); p=&b; p->vf(); p=&d1; p->vf(); // derived1's vf. p=&d2; p->vf(); // derived2's vf. f(b); f(d1); // derived1's vf. f(d2); // derived2's vf. return 0; } ========================================= // XI. 对象赋值问题 #include <iostream> #include <cstdlib> #include <new> using namespace std; class Myclass{ int *p; public: Myclass(int i); void show(){cout<< *p<<"\n";} ~Myclass(){delete p;} }; Myclass::Myclass(int i){ try{ p=new int; } catch(bad_alloc e) {cout<< "New failed!\n"; exit(-1); } *p=i; } int main() {Myclass a(20); Myclass b=a; //copy by bits b.show(); return 0; // 错误!对象中 p 所指向的内存空间将被释放 2 次! } ========================================= // XII. 拷贝构造函数 ---- 解决对象参数传递的副作用问题 #include <iostream> #include <new> using namespace std; class array{ public: int *p; int size; array( ){p=NULL;size=0; }; array(int sz); array(const array &a); ~array(){if(!p){delete [ ]p; size=0;}} void input(); }; array::array(int sz){ size=sz; try{ p=new int[size]; }catch (bad_alloc xa){ cout <<"Alloc failed!"; exit(EXIT_FAILURE); } } array::array(const array &a){ try{ p=new int[a.size]; }catch (bad_alloc xa){ cout <<"Alloc failed!"; exit(EXIT_FAILURE); } size=a.size; for(int i=0;i<size;i++)p[i]=a.p[i]; } void array::input(){ cout<<"Input "<<size<<" integers: "; for(int i=0;i<size;i++)cin>>p[i]; } void inc(array a){ int i; for(i=0;i<a.size;i++) if(a.p[i]==59)a.p[i]++; cout<<"Result is: " ; for(i=0;i<a.size;i++)cout<<a.p[i]<<' '; cout<<"\n"; } int main(){ array a(4),c; a.input(); array b(a); // 调用拷贝构造函数 inc(b); //调用拷贝构造函数(隐式) for(int i=0;i<b.size;i++)cout<<b.p[i]<<' '; return 0; } ========================================= // XIII. 运算符重载 #include <iostream> using namespace std; class loc{ int longitude,latitude; public: loc(){} //needed to construct temp objects loc(int lg,int lt){longitude=lg; latitude=lt;} void show(){cout<<longitude<<" "<<latitude<<"\n";} loc operator+(loc op2); loc operator++(); loc operator=(loc op2); loc operator+=(loc op2); }; loc loc::operator+(loc op2) {loc temp; temp.longitude=op2.longitude+longitude; temp.latitude=op2.latitude+latitude; return temp; } loc loc::operator++() //前缀形式 prefix {longitude++; latitude++; return *this; } loc loc::operator=(loc op2) { longitude=op2.longitude; latitude=op2.latitude; return *this; //为连续赋值 } loc loc::operator+=(loc op2) { longigude=op2.longitude+longitude; latitude=op2.latitude+latitude; return *this; //为连续赋值 } // operator=和operator++等都改变了对象的值 int main() {loc ob1(10,20),ob2(5,30),ob3; ob3=ob1+ob2; ++ob3; ob3.show(); ob1+=ob2; ob1=ob1+ob2; // ob1.+(ob2) like (ob1+ob2).show(); ++ob1; ob1=ob2=ob3; ... ... } ========================================= // XIV. 异常的抛出,捕获与处理 #include <iostream> using namespace std; int main() {cout <<"Start\n"; try { cout << "Inside try block\n"; throw 100; cout << "This will not execute"; } catch (int i) { cout << "Caught an exception, value is: "; cout << i <<"\n"; } cout << "End\n"; return 0; } // -------------------- #include <iostream> using namespace std; void xtest(int test) { cout << "Inside xtest!\n"; if(test) throw test; } int main() {cout <<"Start\n"; try { cout << "Inside try block\n"; xtest(0); xtest(1); xtest(2); } catch (int i) { cout << "Caught an exception, value is: "; cout << i <<"\n"; } cout << "End\n"; return 0; } // 捕获异常类 #include <iostream> #include <cstring> using namespace std; class MyException{ public: char how[80]; int what; MyException(){*how=0; what=0;} MyException(char *s, int n) {strcpy(how,s); what=n; } }; int main() {int i; try { cout <<"Enter a positive number: "; cin >> i; if(i<0) throw MyException("Not Positive",i); } catch (MyException e) { cout << e.how<<": "; cout << e.what <<"\n"; } return 0; } // 捕获派生异常类 #include <iostream> using namespace std; class B { }; class D: public B { }; int main() {D derived; try { throw derived; } catch (D d) { cout << "Caught a derived class, not the base! \n"; } catch (B b) { cout << "Caught the base class! \n"; } return 0; } // 异常的限制及捕获所有异常 #include <iostream> using namespace std; void xtest(int test) throw (int,char,double,char *) { try { if(test==0) throw test; if(test==1) throw 'a'; if(test==2) throw 12.34; if(test==3) throw "A string."; } catch (int i) { cout << "Caught an integer!"; } catch (...) { cout << "Caught Another!"; } } int main() {cout <<"Start\n"; xtest(0); xtest(1); xtest(2); xtest(3); cout << "End\n"; return 0; } // 异常的再次抛出 #include <iostream> using namespace std; void xhandler() { try { throw "Hello!"; } catch (const char *) { cout << "Caught a string inside!\n"; throw; //rethrow char * out of function } } int main() {cout <<"Start\n"; try { xhandler(); } catch (const char *) { cout << "Caught a string outside!\n"; } cout << "End\n"; return 0; } // 一个简单的程序 #include <iostream> using namespace std; int main() {int a,b; cout <<"Enter a b: "; cin >> a >> b; try { if(!b) throw b; cout << "Result: "<< a/b << endl; } catch (int i) { cout << "Can't divide by zero!\n"; } return 0; } ========================================= XV. 模板 //模板之通用函数 #include <iostream> using namespace std; template <class X> void superSwap(X &a, X &b) { X t; t=a; a=b; b=t; }; int main() { int m=10, n=20; double x=10.1, y=20.2; char a='A', b='\x42'; superSwap(m,n); superSwap(x,y); superSwap(a,b); cout<<"m="<<m<<", n="<<n<<'\n'; cout<<"x="<<x<<", y="<<y<<'\n'; cout<<"a="<<a<<", b="<<b<<'\n'; return 0; } ---------------------------------- #include <iostream> using namespace std; template <class type1,class type2> void myfunc(type1 x, type2 y) { cout<<x<<' '<<y<<'\n'; } int main() { myfunc("C++ is great!", 100); // char* , int myfunc(1234.56, 20L); // double , long int return 0; } // 模板之通用类 #include <iostream> using namespace std; const int Size=20; template <class DataType> class SuperStack{ DataType data[Size]; int top; public: SuperStack(){top= -1;} int push(DataType x); int pop(DataType &x); }; template <class DataType> int SuperStack<DataType>::push(DataType x) { if(top>=Size-1) return -1; // stack is full data[++top]=x; return 0; } template <class DataType> int SuperStack<DataType>::pop(DataType &x) { if(top<0) return -1; // stack is empty x=data[top--]; return 0; } int main() { SuperStack<char> chStack; SuperStack<double> dbStack; char s[Size]="ABC"; double a[Size]={20.1, 21.2, 22.3}; int i; for(i=0;i<3;i++) { chStack.push(s[i]); dbStack.push(a[i]); } for(i=0;i<3;i++) { chStack.pop(s[i]); dbStack.pop(a[i]); } cout << s << '\n'; for(i=0;i<3;i++) cout << a[i]<<' '; cout<<'\n'; return 0; } ========================================= XVI. 名字空间 #include <iostream> using namespace std; namespace GreenNamespace{ char Say[80]="TRUTH, Must thou Know!"; bool isUpperLetter(char ch) { if(ch>='A' &&ch<='Z')return true; return false; } class X{ public: int year; X(int y){year=y;} }; // note this semi-colon! } using namespace GreenNamespace; int main() {cout << Say <<'\n'; char *p=Say; int count=0; for(;*p;p++) if(isUpperLetter(*p))count++; cout << "count = " << count <<'\n'; X ob(2006); cout << ob.year <<"\n"; return 0; } //------------------------ ////////// OneCount.cpp//////// namespace BitsSpace{ int onePerByte(char x); int oneCount(char *buf,int bytes); // ------------------- int onePerByte(char x) {int count=0,i; for(i=0;i<8;i++) {if(x & '\x1') count++; // 'A'<=> '\x41' x>>=1; //x=x>>1; } return count; } // --- int oneCount(char *buf,int bytes) {int count=0,i; for(i=0;i<bytes;i++) count+=onePerByte(buf[i]); return count; } // --- } ---------------- ////////// testOne.cpp//////// #include <iostream> #include "OneCount.cpp" using namespace std; //using namespace BitsSpace; const int SLen=80; // ---- int main(){ char ms[SLen],*p; cout<<"Enter your words:\n> " ; cin.getline(ms,SLen); cout<< BitsSpace::oneCount(ms,strlen(ms))<<"\n"; cout<<"Size of char: "<<sizeof(char)<<"\n"; return 0; } ========================================= //////////////////////////////// // XVII. C++ file handle, 6 programs // by Hs.li 2007.4.28 //////////////////////////////// // Write text strings! #include <iostream> #include <fstream> using namespace std; #define MaxN 200 // - - - - - - int main() {fstream outF; char text[MaxN]; cout<<"Enter lines, end with empty line:\n"; outF.open("str.txt",ios::out); if(!outF.is_open()) {cout<<"File open failed!\n"; return -1; } while(1) { cin.getline(text,MaxN); if(!text[0])break; outF<<text<<"\n"; if(outF.bad()||outF.fail()) {cout<<"Write file error!\n"; outF.close(); return -2; } } cout<<"Write text file okey!\n"; outF.close(); return 0; } ========================= // Read text strings! #include <iostream> #include <fstream> using namespace std; #define MaxN 200 // - - - - - - int main() {fstream inF; char text[MaxN]; cout<<"The text lines are:\n"; inF.open("str.txt",ios::in); if(!inF.is_open()) {cout<<"File open failed!\n"; return -1; } while(1) { inF.getline(text,MaxN); if(inF.eof()|inF.fail()|inF.bad())break; cout<<text<<"\n"; } if(!inF.eof()) {cout<<"Read file error!\n"; inF.close(); return -2; } cout<<"---- End!\n"; inF.close(); return 0; } ====================== // Write text data! #include <iostream> #include <fstream> using namespace std; // - - - - - - int main() { const int MaxN=8; fstream outF; double a[MaxN]; char *fname="data.txt"; int i; cout<<"Please input 8 double: "; for(i=0;i<MaxN;i++) cin>>a[i]; outF.open(fname,ios::out); if(!outF.is_open()) {cout<<"File open failed!\n"; return -1; } outF.exceptions(fstream::failbit| fstream::badbit); try{ for(i=0;i<MaxN;i++) outF<<a[i]<<" "; } catch(std::exception &e) {cout<<"Exception caught:"<<e.what()<<endl; outF.close(); return -2; } outF.close(); cout<<"Text data file write okey!\n"; return 0; } ============================ // Read text data! #include <iostream> #include <fstream> using namespace std; // - - - - - - int main() { fstream inF; double b; char *fname="data.txt"; cout<<"Please wait for reading data:\n"; inF.open(fname,ios::in); if(!inF.is_open()) {cout<<"File open failed!\n"; return -1; } inF.exceptions(fstream::failbit| fstream::badbit|fstream::eofbit); try{ while(1) { inF>>b; cout<<b<<" "; } }catch(std::exception &e) { if(!inF.eof()) { cout<<"Exception caught:"<<e.what()<<endl; inF.close(); return -2; } } inF.close(); cout<<"\nText data file read okey!\n"; return 0; } =============================== // Write binary data! #include <iostream> #include <fstream> using namespace std; // - - - - - - int main() { const int MaxN=8; fstream outF; double a[MaxN]; char *fname="data.dat"; int i; cout<<"Please input 8 double: "; for(i=0;i<MaxN;i++) cin>>a[i]; outF.open(fname,ios::out|ios::binary); if(!outF.is_open()) {cout<<"File open failed!\n"; return -1; } outF.exceptions(fstream::failbit| fstream::badbit); try{ outF.write((char *)a,MaxN*sizeof(double)); } catch(std::exception &e) {cout<<"Exception caught:"<<e.what()<<endl; outF.close(); return -2; } outF.close(); cout<<"Binary data file write okey!\n"; return 0; } ================================ // Read binary data! #include <iostream> #include <fstream> using namespace std; // - - - - - - int main() { fstream inF; double b; char *fname="data.dat"; cout<<"Please wait for reading data:\n"; inF.open(fname,ios::in|ios::binary); if(!inF.is_open()) {cout<<"File open failed!\n"; return -1; } inF.exceptions(fstream::failbit| fstream::badbit|fstream::eofbit); try{ while(1) { inF.read((char *)&b,sizeof(double)); cout<<b<<" "; } }catch(std::exception &e) { if(!inF.eof()) { cout<<"Exception caught:"<<e.what()<<endl; inF.close(); return -2; } } inF.close(); cout<<"\nBinary data file read okey!\n"; return 0; } ////////////////////////////////////////////////
1 介绍 LuaBind 是一个帮助你绑定C++和Lua的库.她有能力暴露 C++ 函数和类到 Lua . 她也有 能力支持函数式的定义一个Lua类,而且使之继承自C++或者Lua. Lua类可以覆写从 C++ 基类 继承来的虚函数. 她的目标平台是Lua 5.0 ,不能支持Lua 4.0 . 她利用模板原编程技术实现.这意味着,你不需要额外的预处理过程去编译你的工程(编译器 会替你完成全部的工作).这还意味着,你也不需要(通常)知道你注册的每一个函数的精确的签名. 因为,LuaBind库会在编译时生成所需的代码.这样做的不利点是,编译时间会随着需要注册的 文件的数目增加而增加.因此建议你把所有的需要注册的东西放到一个cpp文件里面. LuaBind 遵循 MIT 协议 发布. 我们非常希望听说有工程使用了LuaBind, 请告诉我们,如果你的工程使用了LuaBind. 主要的反馈渠道是 LuaBind邮件列表 .在 irc.freenode.net还可以找到一个IRC频道 #luabind . 2 功能 LuaBind支持: * 重载自由函数 * C++类导入Lua * 重载成员函数 * 操作符 * 属性 * 枚举 * Lua函数导入C++ * Lua类导入C++ * Lua类(单继承) * 从Lua或C++类继承 * 覆写C++类的虚函数 * 注册类型间隐式的类型转换 * 最好匹配式签名匹配 * 返回值策略和参数策略 3 可移植性 LuaBind 已经通过下面的编译器环境的测试: Visual Studio 7.1 Visual Studio 7.0 Visual Studio 6.0 (sp 5) Intel C++ 6.0 (Windows) GCC 2.95.3 (cygwin) GCC 3.0.4 (Debian/Linux) GCC 3.1 (SunOS 5.8) GCC 3.2 (cygwin) GCC 3.3.1 (cygwin) GCC 3.3 (Apple, MacOS X) GCC 4.0 (Apple, MacOS X) LuaBind被确认不能在 GCC 2.95.2 (SunOS 5.8) 下工作. Metrowerks 8.3 (Windows) 可以编译LuaBind,但是通不过常量测试.这就意味着常量 成员函数被视同非常量成员函数. 如果你测试了LuaBind和其他未列出的编译器的兼容性,请告诉我们你的结果. 4 构建LuaBind 为了抑制LuaBind的编译时间最好是将其编译为一个库. 这意味着你要不编译并连接LuaBind 库要不就添加其所有源码到你的工程里面.你必须确保LuaBind目录在你的编译器包含目录中. LuaBind需要Boost 1.32.0 或者 1.33.0 (只需要头文件即可). LuaBind还需要Lua. 官方的构建LuaBind的方式是通过 Boost.Build V2 . 为此,你需要设置两个环境变量: BOOST_ROOT 指向你的Boost安装目录 LUA_PATH 指向你的Lua目录.编译系统将假定包含文件和库文件分别放在 $(LUA_PATH)/include/ 和 $(LUA_PATH)/lib/. 为了向后兼容性,LuaBind在根目录下还保留了一个makefile.这可以构建库和测试程序.如果 你正在使用一个UNIX系统(或者 cygwin),他们将使得构建LuaBind静态库变得很简单.如果 你正在使用 Visual Studio ,很简单的包含 src 目录下的文件到你的工程即可. 构建LuaBind的时候,你可以设定一些选项来使得库更加符合你的需求.特别重要的是,你的应用 程序也必须使用和库一样的设定.可用的选项的介绍参见 Build options 章节. 如果你希望改变缺省的设置,推荐你通过修改命令行参数的方式来实现.(在Visual Studio 的工程设置项里面). 5 基本使用 为了使用LuaBind, 你必须包含 lua.h 和 LuaBind 的主要头文件: extern "C" { #include "lua.h" } #include <luabind/luabind.hpp> 这些头文件提供了注册函数和类的功能. 如果你只是想获得函数或者类的支持,你可以分开 包含 luabind/function.hpp 和 luabind/class.hpp: #include <luabind/function.hpp> #include <luabind/class.hpp> 你需要去做的第一件事是 调用 luabind::open(lua_State*), 由此注册可以在Lua创建类 的函数并初始化 LuaBind需要使用的 状态机全局结构. 如果你不调用这个函数, 你会在后面 触发一个 断言 . 不没有一个对应的关闭函数.因为,一旦一个类被注册到Lua,真没有什么好 的方法去移除它.部分原因是任何剩余的类实例都将依赖其类. 当状态机被关闭的时候,所有 的一切都将被清理干净. LuaBind 的头文件不会直接包含 Lua.h , 而是透过 <luabind/lua_include.hpp> . 如果你 出于某种原因需要包含其他的Lua头文件,你可以修改此文件. 5.1 Hello World 新建一个控制台DLL工程, 名字是 luabind_test. #include <iostream> #include <luabind/luabind.hpp> #include <luabind/lua_include.hpp> extern "C" { #include "lua.h" #include "lauxlib.h" } void greet() { std::cout << "hello world!\n"; } extern "C" int luaopen_luabind_test(lua_State* L) { using namespace luabind; open(L); module(L) [ def("greet", &greet) ]; return 0; } 把生成的DLL和lua.exe/lua51.dll放在同一个目录下. Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio > require "luabind_test" > greet() Hello world! > 6 作用域 注册到Lua里面的所有东西要不注册于一个名空间下(Lua table)要不注册于全局作用域(lua module). 所有注册的东西必须放在一个作用域里面.为了定义一个模块, luabind::module 类必须被使用. 使用方式如下: module(L) [ // declarations ]; 这将会注册所有的函数或者类到 Lua 全局作用域. 如果你想要为你的模块设定一个名空间(类似标准模块), 你可以给构造函数设定一个名字,例如: module(L, "my_library") [ // declarations ]; 这里所有的申明都将被放置在 my_libary 表. 如果你想要嵌套名空间,你可以用 luabind::namespace_ 类. 它和 luabind::module 类似,除了构造器 没有lua_State* 输入参数.用例如下: module(L, "my_library") [ // declarations namespace_("detail") [ // library-private declarations ] ]; 你可能会想到,下面两个声明是等价的: module(L) [ namespace_("my_library") [ // declarations ] ]; module(L, "my_library") [ // declarations ]; 每一个声明必须用逗号分隔,例如: module(L) [ def("f", &f), def("g", &g), class_<A>("A") .def(constructor<int, int>), def("h", &h) ]; 更多实际的例子请参阅 绑定函数到Lua 和 绑定类到Lua 章节. 请注意, (如果你对性能有很高的需求)把你的函数放到表里面将增加查找函数的时间. 7 绑定函数到Lua 为了绑定函数到Lua,你可以使用函数 luabind::def(). 它的声明如下: template<class F, class policies> void def(const char* name, F f, const Policies&); * name 是该函数在Lua里面的名字 * F 是该函数的指针 * 策略参数是用来描述怎样处理该函数参数和返回值的.这是一个可选参数,参见 策略 章节. 下面的例子演示注册函数 float std::sin(float): module(L) [ def("sin", &std::sin) ]; 7.1 重载函数 如果你有同名函数需要注册到Lua, 你必须显示的给定函数的签名. 这可以让C++知道你指定的是哪一个函数. 例如, 如果你有两个函数, int f(const char*) 和 void f(int). module(L) [ def("f", (int(*)(const char*)) &f), def("f", (void(*)(int)) &f) ]; 7.2 签名匹配 LuaBind 将会生成代码来检查Lua栈的内容是否匹配你的函数的签名. 它会隐式的在 派生类之间进行类型转换,并且它会按照尽量少进行隐式类型转换的原则经行匹配.在 一个函数调用中,如果函数是重载过的,并且重载函数的参数匹配分不出好坏的话 (都经行同样次数的隐式类型转换),那么将产生一个二义性错误.这将生成一个运行时 错误,程序挂起在产生二义性调用的地方.一个简单的例子是,注册两个函数,一个函数 接受一个int参数,另外一个函数接受一个float参数. 因为Lua将不区别浮点数和整形数, 所以他们都是匹配的. 因为所有的重载是被测试过的,这将总是找到最好的匹配(不是第一个匹配).这样意味着, LuaBind可以处理签名的区别只是const和非const的重载函数. 例如,如果如下的函数和类被注册: struct A { void f(); void f() const; }; const A* create_a();所有权转移 为了正确处理所有权转移问题,create_a()将用来适配返回值策略. 参见 策略 章节. -Linker Lin 4/5/08 6:32 PM struct B: A {}; struct C: B {}; void g(A*); void g(B*); 执行以下 Lua 代码即结果: a1 = create_a() a1:f() -- 常量版本被调用 a2 = A() a2:f() -- 非常量版本被调用 a = A() b = B() c = C() g(a) -- calls g(A*) g(b) -- calls g(B*) g(c) -- calls g(B*) 7.3 调用Lua函数 为了调用一个Lua函数, 你可以或者用 call_function() 或者用 一个对象(object). template<class Ret> Ret call_function(lua_State* L, const char* name, ...) template<class Ret> Ret call_function(object const& obj, ...) call_function()函数有两个重载版本.一个是根据函数的名字来调用函数, 另一个是调用一个可以作为函数调用的Lua值. 使用函数名来调用的版本只能调用Lua全局函数. "..."代表传递给Lua函数的 可变个数的参数. 这使得你可以指定调用的策略.你可以通过 operator[] 来实现 这个功鞥.你可以同过方括号来指定策略,例如: int ret = call_function<int>( L , "a_lua_function" , new complex_class() )[ adopt(_1) ]; 如果你想通过引用方式传递参数,你必须用Boost.Ref来包装一下. 例如: int ret = call_function(L, "fun", boost::ref(val)); 如果你想给一个函数调用指定自己的错误捕获处理函数(error handler),可以参阅 pcall errorfunc 章节的 set_pcall_callback . 7.4 使用Lua协程 为了使用Lua协程,你必须调用 lua_resume(),这就意味着你不能用先前介绍的函数 call_function()来开始一个协程.你必须用这个: template<class Ret> Ret resume_function(lua_State* L, const char* name, ...) template<class Ret> Ret resume_function(object const& obj, ...) 和: template<class Ret> Ret resume(lua_State* L, ...) 第一次开始一个协程的时候,你必须给它一个入口函数. 当一个协程返回(yield)的时候, resume_fucntion()调用的返回值是 lua_yield()的第一个传入参数.当你想要继续一个 协程的时候,你只需要调用 resume() 在你的 lua_State() 上,因为它已经在执行一个函数 (即先前出入的入口函数),所以你不需要再次传入函数.resume()的传入参数将作为Lua侧的 yield()调用的返回值. 为了暂停(yielding)C++函数,(不支持在C++侧和Lua侧传送数据块),你可以使用 yield 策略. 接受 object 参数的resume_function()的重载版本要求对象必须是一个协程对象.(thread) lua_State* thread = lua_newthread(L); object fun = get_global(thread)["my_thread_fun"]; resume_function(fun); 8 绑定类到Lua 为了注册一个类,你可以用 class_ 类. 它的名字和C++关键字类似是为了比较直观.它有一个重载 过的成员函数 def() .这个函数被用来注册类的成员函数,操作符,构造器,枚举和属性.它将返回 this 指针,从而方便你直接注册更多的成员. 让我们开始一个简单的例子.考虑下面的C++类: class testclass { public: testclass(const std::string& s): m_string(s) {} void print_string() { std::cout << m_string << "\n"; } private: std::string m_string; }; 为了注册这个类到Lua环境,可以像下面这样写(假设你使用了名空间): module(L) [ class_<testclass>("testclass") .def(constructor<const std::string&>()) .def("print_string", &testclass::print_string) ]; 这将注册 testclass 类以及接受一个string参数的构造器以及一个成员叫print_string()的函数. Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio > a = testclass('a string') > a:print_string() a string 还可以注册自由函数作为成员函数.对这个自由函数的要求是,它必须接受该类的一个指针或常量指针或 引用或常量引用作为函数的第一个参数.该函数的剩下的参数将在Lua侧可见,而对象指针将被赋值给第一个 参数.如果我们有如下的C++代码: struct A { int a; }; int plus(A* o, int v) { return o->a + v; } 你可以注册 plus() 作为A的一个成员函数,如下: class_<A>("A") .def("plus", &plus) plus() 现在能够被作为A的一个接受一个int参数的成员函数来调用.如果对象指针(this指针)是const, 这个函数也将表现的像一个常量成员函数那样(它可以通过常量对象来调用). 8.1 重载成员函数 当绑定超过一个以上的重载过的成员函数的时候,或只是绑定其中的一个的时候,你必须消除你传递给 def() 的 成员函数指针的歧义.为此,你可以用普通C风格的类型转换来转型匹配正确的重载函数. 为此,你必须知道怎么去 描述C++成员函数的类型.这里有一个简短的教程(更多信息请查阅你的C++参考书): 成员函数指着的语法如下: return-value (class-name::*)(arg1-type, arg2-type, ...) 例如: struct A { void f(int); void f(int, int); }; class_<A>() .def("f", (void(A::*)(int))&A::f) A的第一个成员函数f(int)被绑定了,而第二个没哟被绑定. 8.2 属性 很容易注册类的全局数据成员.考虑如下的类: struct A { int a; }; 这个类可以这样注册: module(L) [ class_<A>("A") .def_readwrite("a", &A::a) ]; 这使得成员变量 A::a 获得了读写访问权. 还可以注册一个只读的属性: module(L) [ class_<A>("A") .def_readonly("a", &A::a) ]; 当绑定成员是一个非原始数据类型的时候,自动生成的 getter 函数将会返回一个它引用. 这就允许你可以链式使用 . 操作符.例如,当有一个结构体包含另外一个结构体的时候.如下: struct A { int m; }; struct B { A a; }; 当绑定B到Lua的时候,下面的表达式应该可以工作: b = B() b.a.m = 1 assert(b.a.m == 1) 这要求 a 属性必须返回一个A的引用, 而不是一个拷贝. 这样,LuaBind将会自动使用依赖策略来 确保返回值依赖于它所在的对象.所以,如果返回的引用的生命长于该对象的所有的引用(这里是b). 它将保持对象是激活的,从而避免出现悬挂指针. 你还可以注册 getter 或者 setter 函数来使得它们看上去像一个 public 的成员.考虑下面的类: class A { public: void set_a(int x) { a = x; } int get_a() const { return a; } private: int a; }; 可以这样注册成一个公共数据成员: class_<A>("A") .property("a", &A::get_a, &A::set_a) 这样 set_a() 和 get_a() 将取代简单的数据成员操作.如果你想使之只读,你只需要省略最后一个参数. 请注意, get 函数必须是 const 的,否则不能通过编译. 8.3 枚举 如果你的类包含枚举,你可以注册它们到Lua. 注意,它们不是类型安全的,所有的枚举在Lua侧都是整型的, 并且所有接受枚举参数的函数都将接受任何整型.你可以像这样注册它们: module(L) [ class_<A>("A") .enum_("constants") [ value("my_enum", 4), value("my_2nd_enum", 7), value("another_enum", 6) ] ]; 在Lua侧,他们可以像数据成员那样被操作,除了它们是只读的而且属于类本身而不是类的实例. Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio > print(A.my_enum) 4 > print(A.another_enum) 6 8.4 操作符 为了绑定操作符,你需要包含头文件 <luabind/operator.hpp>. 注册你的类的操作符的机制非常的简单.你通过一个全局名字 luabind::self 来引用类自己,然后你就 可以在def()调用里面直接用操作符表达式. 类如下: struct vec { vec operator+(int s); }; 可以这样注册: module(L) [ class_<vec>("vec") .def(self + int()) ]; 不管你的 + 操作符是定义在类里面还是自由函数都可以工作. 如果你的操作符是常量的(const)(或者,是一个自由函数, 接受一个类的常量的引用)你必须用 const_self 替代 self. 如下: module(L) [ class_<vec>("vec") .def(const_self + int()) ]; 支持如下操作符: + - * / == < <= 这意味着,没有"就地操作符"(in-place)(++ --). 相等操作符(==)有些敏锐;如果引用是相等的就不会 被调用. 这意味着, 相等操作符的效率非常好. Lua不支持操作符包括: !=,>和<=.这是为什么你只能注册上面那些操作符. 当你调用这些操作符的时候, Lua会把调用转换到支持的操作符上.(译注:例如:==和!=有逻辑非得关系) -Linker Lin 4/6/08 11:09 PM 在上面的示例中,操作数的类型是 int().如果操作数的类型是复杂类型,就不是那么简单了,你需要用 other<> 来包装下.例如: 为了注册如下的类,我们不想用一个string的实例来注册这个操作符. struct vec { vec operator+(std::string); }; 取而代之的是,我们用 other<> 包装下,如下: module(L) [ class_<vec>("vec") .def(self + other<std::string>()) ]; 注册一个应用程序操作符(函数调用): module(L) [ class_<vec>("vec") .def( self(int()) ) ]; 这里有个特殊的操作符.在Lua里,它叫做 __tostring,它不是一个真正的操作符.它是被用来转换一个对象到 string的标准Lua方法.如果你注册之,可以通过Lua的标准函数 tostring() 来转换你的对象到一个string. 为了在C++里实现这个操作符,你需要为 std::ostream 提供 operator<< .像这样: class number {}; std::ostream& operator<<(std::ostream&, number&); ... module(L) [ class_<number>("number") .def(tostring(self)) ]; 8.5 嵌套作用域和静态函数 可以添加嵌套的作用域到一个类.当你需要包装一个嵌套类或者一个静态函数的时候就会很有用. class_<foo>("foo") .def(constructor<>() .scope [ class_<inner>("nested"), def("f", &f) ]; 在上面的例子里, f 将表现的像一个类 foo 的静态函数,而 类 nested 将表现的像类 foo 的嵌套类. 还可以用同样的语法添加名空间到类里面. 8.6 继承类 如果你想要注册一个继承自其它类的类到Lua, 你可以指定一个模板参数 bases<> 给 class_ 的构造器. 如下的继承关系: struct A {}; struct B : A {}; 可以这样注册: module(L) [ class_<A>("A"), class_<B, A>("B") ]; 如果你使用了多继承,你可以指定多于一个的基类.如果 B 还继承了类 C , 它可以这样注册: module(L) [ class_<B, bases<A, C> >("B") ]; 注意,你可以省去 bases<> 当你用的是单继承的时候. 注意 如果你不指定类的继承关系, LuaBind 将不能在相关的继承类型间进行隐式类型转换. 8.7 智能指针 当你注册一个类的时候,你可以告诉 LuaBind 所有的该类的实例应该被某种智能指针持有.(例如: boost::shared_ptr) 你可通过把一个 持有器类型模板参数 给 class_ 类的构造器来实现该功能.例如: module(L) [ class_<A, boost::shared_ptr<A> >("A") ]; 你还必须为你的智能指针提供两个函数.一个返回常量版本的智能指针类型(这里是: boost:shared_ptr< const A >). 另一个函数要可以从智能指针萃取流指针(raw pointer). 之所以需要第一个函数是因为,LuaBind 允许 非常量 -> 转换在传递Lua值到C++的时候.之所以需要第二个函数是因为,当Lua调用一个被智能指针持有 的类的成员函数的时候,this 指针必须是一个流指针.还有一个原因是,从Lua转换到C++的时候,需要实现 智能指针到普通指针的转换.看上去像这样: namespace luabind { template<class T> T* get_pointer(boost::shared_ptr<T>& p) { return p.get(); } template<class A> boost::shared_ptr<const A>* get_const_holder(boost::shared_ptr<A>*) { return 0; } } 第二个函数只在编译时用于映射 boost::shared_ptr<A>到其常量版本 boost::shared_ptr<const A>. 它从来不会被调用,所以返回值是无所谓的(返回值的类型才是关键). 这个转换将这样工作(假定 B 是A的基类): 从Lua到C++ Source Target holder_type<A> A* holder_type<A> B* holder_type<A> A const* holder_type<A> B const* holder_type<A> holder_type<A> holder_type<A> holder_type<A const> holder_type<A const> A const* holder_type<A const> B const* holder_type<A const> holder_type<A const 从C++到Lua Source Target holder_type<A> holder_type<A> holder_type<A const> holder_type<A const> holder_type<A> const& holder_type<A> holder_type<A const> const& holder_type<A const> 当使用持有器类型的时候,知道指针是不是合法(例如:非空)是很有用的.例如,当使用 std::auto_ptr 的时候, 持有器通过一个参数传递给函数的时候将会变得无效. 为了这个目的,所有的对象实例都有一个成员叫: __ok. struct X {}; void f(std::auto_ptr<X>); module(L) [ class_<X, std::auto_ptr<X> >("X") .def(constructor<>()), def("f", &f) ]; Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio > a = X() > f(a) > print a.__ok false 当注册一个继承树的时候,所有的实例被智能指针持有的地方,所有的类必须包含持有器类型.例如: module(L) [ class_<base, boost::shared_ptr<base> >("base") .def(constructor<>()), class_<derived, base, boost::shared_ptr<base> >("base") .def(constructor<>()) ]; 在内部, LuaBind 将会做必要的转换于萃取自持有器的流指针之上. 8.8 拆分类注册 在某些情况下,可能需要分开注册一个类在不同的编译单元. 部分原因可能是节约重编译时间,而某些编译器的 限制可能要求不得不分开注册一个类.其实很简单.考虑下面的示例代码: void register_part1(class_<X>& x) { x.def(/*...*/); } void register_part2(class_<X>& x) { x.def(/*...*/); } void register_(lua_State* L) { class_<X> x("x"); register_part1(x); register_part2(x); module(L) [ x ]; } 这里,类X被分两步注册.两个函数 register_part 和 register_part2 可能被放到不同的编译单元里. 关于分开注册一个模块的信息请参阅: 分开注册 章节. 9 对象 因为函数必须能够接受Lua值作为参数,我们必须包装之. 这个包装被称作 luabind::object. 如果你注册的函数 接受一个对象,那它就可以匹配任何Lua值.为了使用它,你需要包含头文件: <luabind/object.hpp>. 摘要 class object { public: template<class T> object(lua_State*, T const& value); object(from_stack const&); object(object const&); object(); ~object(); lua_State* interpreter() const; void push() const; bool is_valid() const; operator safe_bool_type () const; template<class Key> implementation-defined operator[](Key const&); template<class T> object& operator=(T const&); object& operator=(object const&); bool operator==(object const&) const; bool operator<(object const&) const; bool operator<=(object const&) const; bool operator>(object const&) const; bool operator>=(object const&) const; bool operator!=(object const&) const; template <class T> implementation-defined operator[](T const& key) const void swap(object&); implementation-defined operator()(); template<class A0> implementation-defined operator()(A0 const& a0); template<class A0, class A1> implementation-defined operator()(A0 const& a0, A1 const& a1); /* ... */ }; 当你需要一个Lua对象的时候,你可以通过=操作符给它赋一个新值.当你这么做的时候,default_policy 会被用来转换C++值到Lua. 如果你的 luabind::object 是一个table,你可以通过 []操作符或者迭代器 来访问它的成员.[]操作符的返回值是一个代理对象,这个对象可以用于读写表里的值(通过=操作符). 注意,没有办法知道一个Lua对象是否可以索引化访问( lua_gettable 不会失败,要不成功,要不崩溃 ). 这意味着,如果你在一个不可以索引化访问的东西上进行索引,你就只能靠自己了.Lua将会调用它的 panic() 函数. 还有一些自由函数可以用来索引一张table,参阅 相关函数 章节. 那个接受 from_stack 对象作为参数的构造器是用来初始化一个关联Lua栈值的对象的. from_stack 类型 有如下的构造器: from_stack(lua_State* L, int index); index参数就是原始的Lua栈的索引,负值是从栈顶开始索引的.你可以这样用: object o(from_stack(L, -1)); 这将会创建一个 object的实例 o,并拷贝Lua栈顶的对象的值. interpreter() 函数返回保存object实例的Lua状态机.如果你想要直接用Lua函数操作object对象的实例,你 可以通过调用 push() 来把它压入Lua栈. ==操作符将会在操作数上调用 lua_equal()并返回它的结果. is_valid() 函数会告诉你object的实例是否已经初始化过了.通过默认构造器来初始化的实例是非法的.要使之 合法,你可以给其赋一个值.如果你想使一个 object 不合法,最简单的办法就是给它赋一个非法的 object. operator safe_bool_type() 和 to is_valid() 是等价的.这意味着,下面的代码片段是等价的: object o; // ... if (o) { // ... } ... object o; // ... if (o.is_valid()) { // ... } 应用程序操作符() 将会像对待一个函数那样来调用绑定的值. 你可以给它任何数量的参数 (目前, default_policy 将被用于转换 ).返回的对象将代表函数的返回值(当前只支持一个返回值).该操作符 可能会抛出 luabind::error ,如果函数调用失败.如果你想指定一个特殊的函数调用策略,你可以通过在函数 调用时使用 []操作符来指定策略.像这样: my_function_object( 2 , 8 , new my_complex_structure(6) ) [ adopt(_3) ]; 这告诉 LuaBind 让 Lua 接受所有权和负责传入给lua函数的指针. 重要的是当Lua状态机关闭的时候,所有的 object 的实例都会被析构.object实例会持有Lua状态机的指针,并在 自己析构的时候释放它的Lua对象. 这里有一个函数怎样使用 table 的例子: void my_function(object const& table) { if (type(table) == LUA_TTABLE) { table["time"] = std::clock(); table["name"] = std::rand() < 500 ? "unusual" : "usual"; std::cout << object_cast<std::string>(table[5]) << "\n"; } } 如果函数接受一个object作为参数,那么任何Lua值都将匹配这个参数.这就是为什么,我们必须保证入参是一个table 的原因. std::ostream& operator<<(std::ostream&, object const&); 流操作符可以把object实例借由 boost::lexical_cast 转换到string或者方便打印输出.这将会使用Lua的string 转换函数.如果你用 tostring 去转换一个C++对象,对应类型的流操作符将会被使用. 9.1 迭代器 有两种迭代器. 普通迭代器将会使用对象的原方法(如果存在)来获取值. 普通迭代器被称为 luabind::iterator. 另一个 迭代器被称为 luabind::raw_iterator ,它将忽略原方法而直接给出表里的真实内容. 它们具有相同的接口, 都实现了 ForwardIterator 概念.大部分标准迭代器都有如下的成员和构造器: class iterator { iterator(); iterator(object const&); object key() const; standard iterator members }; 接受一个 luabind::object 的构造器实际上是一个用于操作 object 的模板.通过传入一个 object 给构造器来构造出 一个指向 object 里的第一个元素的迭代器. 缺省的构造器将会初始化迭代器为一个指向最后一个元素的后面位置的迭代器.这可以用来测试是否抵达了序列的末端. 迭代器的值类型是一个支持和 luabind::object 相同的操作的代理类型.这意味着,大部分情况下你可以当它就是一个原始 的 object 实例. 它们之间的不同之处在于,任何对代理的赋值操作都会导致值被插入到表中迭代器所指的位置. key() 成员返回迭代器用于索引表的键. 一个迭代器的例子如下: for (iterator i(globals(L)["a"]), end; i != end; ++i) { *i = 1; } end 迭代器是一个缺省的指向序列末尾的迭代器.在这个例子里,我们简单的迭代了表 a 里面所有的实体,并将之赋值为 1. 9.2 相关函数 这里介绍些用于 对象 和 表 操作的函数. int type(object const&); 这个函数将会返回lua类型索引.例如: . LUA_TNIL, LUA_TNUMBER 等. template<class T, class K> void settable(object const& o, K const& key, T const& value); template<class K> object gettable(object const& o, K const& key); template<class T, class K> void rawset(object const& o, K const& key, T const& value); template<class K> object rawget(object const& o, K const& key); 这些函数是用来索引 table 用的. settable 和 gettable 函数分别翻译调用到 lua_settable 和 lua_gettable 函数. 这意味着,你可以在对象上使用索引操作符. rawset 和 rawget 将会翻译调用到 lua_rawset 和 lua_rawget. 所以他们可以绕开任何原方法而给你表里实体的 真实值. template<class T> T object_cast<T>(object const&); template<class T, class Policies> T object_cast<T>(object const&, Policies); template<class T> boost::optional<T> object_cast_nothrow<T>(object const&); template<class T, class Policies> boost::optional<T> object_cast_nothrow<T>(object const&, Policies); object_cast 函数转型对象的值到C++值.你可以给这个从lua到C++的转换提供一个转换策略.如果转型失败, cast_failed 异常将被抛出. 如果你已经定义了 LUABIND_NO_ERROR_CHECKING (参阅 编译选项)宏,就不会 进行任何检查,如果转型非法,应用程序将会彻底崩溃. 不抛出异常的版本会返回一个没有初始化的 boost::optional<T> 对象,由此来指出转型不能进行. 上面的函数的签名确实是模板化的 object 参数,但是这里你应该只传递 object 对象. object globals(lua_State*); object registry(lua_State*); 这些函数分别返回全局环境表和Lua注册表. object newtable(lua_State*); 这个函数创建一个新的 table 并以一个 object 来返回它. 10 在Lua里定义类 作为一个附加功能,LuaBind还提供了一个 Lua侧OO系统来绑定C++函数和对象. class 'lua_testclass' function lua_testclass:__init(name)-- 译注:这个风格类似Python的OO语法 self.name = name end function lua_testclass:print() print(self.name) end a = lua_testclass('example') a:print() 在Lua类之间可以使用继承: class 'derived' (lua_testclass) function derived:__init() super('derived name') end function derived:print() print('Derived:print() -> ') lua_testclass.print(self)-- 译注:注意这里 : 和 . 的区别 end 这里的 super 关键字用来初始化基类.用户必须在构造器里面第一个调用 super. 正如你在这个例子里看到的,你可以调用基类的成员函数.你可以找到所有的基类成员,但是你必须把 this指针(self) 做为函数的第一个参数. 10.1 在Lua里继承 你还可以从Lua侧继承一个C++类,并用Lua函数来覆写虚函数.为了实现这个,我们必须为C++基类创建一个封装类. 当我们实例化一个Lua类的时候,这个封装类将持有Lua对象. class base { public: base(const char* s) { std::cout << s << "\n"; } virtual void f(int a) { std::cout << "f(" << a << ")\n"; } }; struct base_wrapper : base, luabind::wrap_base { base_wrapper(const char* s) : base(s) {} virtual void f(int a) { call<void>("f", a); } static void default_f(base* ptr, int a) { return ptr->base::f(a); } }; ... module(L) [ class_<base, base_wrapper>("base") .def(constructor<const char*>()) .def("f", &base::f, &base_wrapper::default_f) ]; 重要 因为MSVC6.5不支持成员函数的显示模板参数化,作为成员函数 call()的替代, 你可以调用自由函数 call_member()并把 this指针作为第一个参数传入该函数. 注意,如果你同时绑定 base 类 和 base类封装,你必须把基类和基类的封装一起作为模板参数提供给 class_ (就像上面的例子中所做的一样).你指定它们的顺序并不重要.你必须还要从wrapper注册静态版本的和虚函数版 本的封装函数,这是让LuaBind实现动态和静态分派函数调用的必须. 重要 极其重要的是静态(缺省)函数的签名必须和虚函数一致.
centos7 tfs部署笔记.txt 环境信息: Docker version 1.8.2-fc22, build cb216be/1.8.2 Fedora release 22 (Twenty Two) Linux localhost.localdomain 4.0.4-301.fc22.x86_64 #1 SMP Thu May 21 13:10:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux docker centos:CentOS Linux release 7.2.1511 (Core) 参考: http://code.taobao.org/p/tfs/wiki/get/ http://my.oschina.net/beiyou/blog/76129?fromerr=bGluCWDI tfs版本:2.2.16 centos:7.2.1511 gcc:4.8.5 # docker run -i -t centos /bin/bash [root@2f60c4bcddfa /]# yum install make automake autoconf libtool gcc gcc-c++ libuuid-devel zlib-devel mysql-devel readline-devel gperftools-devel.x86_64 -y Libraries have been installed in: /usr/local/lib64//lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- /usr/bin/mkdir -p '/usr/local/lib64//include/tbnet' /usr/bin/install -c -m 644 channel.h channelpool.h connection.h controlpacket.h databuffer.h defaultpacketstreamer.h epollsocketevent.h httppacketstreamer.h httprequestpacket.h httpresponsepacket.h iocomponent.h ipacketfactory.h ipackethandler.h ipacketstreamer.h iserveradapter.h packet.h packetqueue.h packetqueuethread.h serversocket.h socketevent.h socket.h stats.h tbnet.h tcpacceptor.h tcpcomponent.h tcpconnection.h transport.h udpacceptor.h udpcomponent.h udpconnection.h connectionmanager.h '/usr/local/lib64//include/tbnet' [root@2f60c4bcddfa tfs_release-2.2.16]# ./configure --prefix=/usr/local/ configure ok make 问题 : serialization.h:575:27: error: conversion to 'char' from 'long int' may alter its value [-Werror=conversion] buff[3] = (v>>32) & 0xFF; ^ serialization.h:576:27: error: conversion to 'char' from 'long int' may alter its value [-Werror=conversion] buff[2] = (v>>40) & 0xFF; ^ serialization.h:577:27: error: conversion to 'char' from 'long int' may alter its value [-Werror=conversion] buff[1] = (v>>48) & 0xFF; ^ serialization.h:578:27: error: conversion to 'char' from 'long int' may alter its value [-Werror=conversion] 解决 [root@2f60c4bcddfa tfs_release-2.2.16]# find -name Makefile | xargs sed -i 's/-Werror//' 问题 : In file included from session_util.cpp:1:0: session_util.h:30:43: 错误:‘int32_t’不是一个类型名 static void gene_session_id(const int32_t app_id, const int64_t session_ip, std::string& session_id); ^ session_util.h:30:51: 错误:ISO C++ 不允许声明无类型的‘app_id’ [-fpermissive] static void gene_session_id(const int32_t app_id, const int64_t session_ip, std::string& session_id); ^ session_util.h:30:65: 错误:‘int64_t’不是一个类型名 static void gene_session_id(const int32_t app_id, const int64_t session_ip, std::string& session_id); ^ session_util.h:30:73: 错误:ISO C++ 不允许声明无类型的‘session_ip’ [-fpermissive] static void gene_session_id(const int32_t app_id, const int64_t session_ip, std::string& session_id); ^ session_util.h:31:68: 错误:‘int32_t’未声明 static int parse_session_id(const std::string& session_id, int32_t& app_id, int64_t& session_ip); ^ session_util.h:31:85: 错误:‘int64_t’未声明 static int parse_session_id(const std::string& session_id, int32_t& app_id, int64_t& session_ip); session_util.cpp:24:10: 错误:‘void tfs::common::SessionUtil::gene_session_id(int32_t, int64_t, std::string&)’的原型不匹配类‘tfs::common::SessionUtil’中的任何一个 void SessionUtil::gene_session_id(const int32_t app_id, const int64_t session_ip, string& session_id) ^ In file included from session_util.cpp:1:0: session_util.h:30:21: 错误:备选为:static void tfs::common::SessionUtil::gene_session_id(int, int, std::string&) static void gene_session_id(const int32_t app_id, const int64_t session_ip, std::string& session_id); ^ session_util.cpp:31:9: 错误:‘int tfs::common::SessionUtil::parse_session_id(const string&, int32_t&, int64_t&)’的原型不匹配类‘tfs::common::SessionUtil’中的任何一个 int SessionUtil::parse_session_id(const string& session_id, int32_t& app_id, int64_t& session_ip) ^ In file included from session_util.cpp:1:0: session_util.h:31:20: 错误:备选为:static int tfs::common::SessionUtil::parse_session_id(const string&, int&, int&) static int parse_session_id(const std::string& session_id, int32_t& app_id, int64_t& session_ip); 解决 [root@localhost tfs_release-2.2.16]# vim src/common/session_util.h 添加 #include <stdint.h> 整体代码如下 #ifndef TFS_COMMON_SESSIONUTIL_H_ #define TFS_COMMON_SESSIONUTIL_H_ #include <string> #include <stdint.h> namespace tfs { namespace common { static const char SEPARATOR_KEY = '-'; class SessionUtil { public: static std::string gene_uuid_str(); static void gene_session_id(const int32_t app_id, const int64_t session_ip, std::string& session_id); static int parse_session_id(const std::string& session_id, int32_t& app_id, int64_t& session_ip); }; } } #endif //TFS_RCSERVER_SESSIONUUID_H_ 问题: /lib64//lib/libtbsys.a -lrt -lpthread -lm -ldl -lc /usr/bin/ld: cannot find -ljemalloc collect2: error: ld returned 1 exit statu 解决 curl -O http://www.canonware.com/download/jemalloc/jemalloc-4.0.4.tar.bz2 tar -jxvf jemalloc-4.0.4.tar.bz2 cd jemalloc-4.0.4/ && ./configure && make && make install 问题: block_collect.cpp:229:17: 错误:‘abs’不是‘__gnu_cxx’的成员 if (__gnu_cxx::abs(info_.version_ - info.version_) <= VERSION_AGREED_MASK)//version agreed ^ client_request_server.cpp:167:21: error: 'abs' is not a member of '__gnu_cxx' stat[3] = __gnu_cxx::abs(out.size() - block_count); 解决:替换成cstdlib的abs 问题: meta_server_service.cpp:1584:48: error: invalid conversion from 'const char*' to 'char*' [-fpermissive] char* pos = strstr(sub_dir, parents_dir); 解决:添加编译参数-fpermissive [root@localhost tfs_release-2.2.16]# vim src/name_meta_server/Makefile CXXFLAGS = -g -D__STDC_LIMIT_MACROS -Wall -Wextra -Wunused-parameter -Wformat -Wconversion -Wdeprecated -fpermissive [root@localhost tfs_release-2.2.16]# make Making all in src make[1]: Entering directory `/usr/local/tfs_release-2.2.16/src' Making all in common make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/common' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/common' Making all in message make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/message' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/message' Making all in new_client make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/new_client' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/new_client' Making all in dataserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/dataserver' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/dataserver' Making all in nameserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/nameserver' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/nameserver' Making all in adminserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/adminserver' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/adminserver' Making all in tools make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools' Making all in util make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/util' make[3]: Nothing to be done for `all'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/util' Making all in dataserver make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/dataserver' make[3]: Nothing to be done for `all'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/dataserver' Making all in nameserver make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/nameserver' make[3]: Nothing to be done for `all'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/nameserver' Making all in adminserver make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/adminserver' make[3]: Nothing to be done for `all'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/adminserver' Making all in mock make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/mock' make[3]: Nothing to be done for `all'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/mock' Making all in transfer make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/transfer' make[3]: Nothing to be done for `all'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/transfer' Making all in cluster make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/cluster' make[3]: Nothing to be done for `all'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/cluster' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools' make[3]: Nothing to be done for `all-am'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools' Making all in rcserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/rcserver' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/rcserver' Making all in monitor make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/monitor' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/monitor' Making all in name_meta_server make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/name_meta_server' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/name_meta_server' Making all in rootserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/rootserver' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/rootserver' Making all in checkserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/checkserver' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/checkserver' make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src' make[2]: Nothing to be done for `all-am'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src' make[1]: Leaving directory `/usr/local/tfs_release-2.2.16/src' Making all in conf make[1]: Entering directory `/usr/local/tfs_release-2.2.16/conf' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/usr/local/tfs_release-2.2.16/conf' Making all in scripts make[1]: Entering directory `/usr/local/tfs_release-2.2.16/scripts' Making all in ha make[2]: Entering directory `/usr/local/tfs_release-2.2.16/scripts/ha' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/scripts/ha' make[2]: Entering directory `/usr/local/tfs_release-2.2.16/scripts' make[2]: Nothing to be done for `all-am'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/scripts' make[1]: Leaving directory `/usr/local/tfs_release-2.2.16/scripts' Making all in sql make[1]: Entering directory `/usr/local/tfs_release-2.2.16/sql' Making all in ms make[2]: Entering directory `/usr/local/tfs_release-2.2.16/sql/ms' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/sql/ms' Making all in rcs make[2]: Entering directory `/usr/local/tfs_release-2.2.16/sql/rcs' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/sql/rcs' make[2]: Entering directory `/usr/local/tfs_release-2.2.16/sql' make[2]: Nothing to be done for `all-am'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/sql' make[1]: Leaving directory `/usr/local/tfs_release-2.2.16/sql' make[1]: Entering directory `/usr/local/tfs_release-2.2.16' make[1]: Nothing to be done for `all-am'. make[1]: Leaving directory `/usr/local/tfs_release-2.2.16' [root@localhost tfs_release-2.2.16]# make install Making install in src make[1]: Entering directory `/usr/local/tfs_release-2.2.16/src' Making install in common make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/common' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/common' make[3]: Nothing to be done for `install-exec-am'. /usr/bin/mkdir -p '/usr/local/include' /usr/bin/install -c -m 644 define.h cdefine.h lock.h func.h internal.h meta_server_define.h rts_define.h error_msg.h '/usr/local/include' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/common' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/common' Making install in message make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/message' make[2]: Nothing to be done for `install'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/message' Making install in new_client make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/new_client' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/new_client' /usr/bin/mkdir -p '/usr/local/lib' /bin/sh ../../libtool --mode=install /usr/bin/install -c libtfsclient.la libtfsclient_c.la '/usr/local/lib' libtool: install: /usr/bin/install -c .libs/libtfsclient.so.0.0.0 /usr/local/lib/libtfsclient.so.0.0.0 libtool: install: (cd /usr/local/lib && { ln -s -f libtfsclient.so.0.0.0 libtfsclient.so.0 || { rm -f libtfsclient.so.0 && ln -s libtfsclient.so.0.0.0 libtfsclient.so.0; }; }) libtool: install: (cd /usr/local/lib && { ln -s -f libtfsclient.so.0.0.0 libtfsclient.so || { rm -f libtfsclient.so && ln -s libtfsclient.so.0.0.0 libtfsclient.so; }; }) libtool: install: /usr/bin/install -c .libs/libtfsclient.lai /usr/local/lib/libtfsclient.la libtool: install: /usr/bin/install -c .libs/libtfsclient_c.so.0.0.0 /usr/local/lib/libtfsclient_c.so.0.0.0 libtool: install: (cd /usr/local/lib && { ln -s -f libtfsclient_c.so.0.0.0 libtfsclient_c.so.0 || { rm -f libtfsclient_c.so.0 && ln -s libtfsclient_c.so.0.0.0 libtfsclient_c.so.0; }; }) libtool: install: (cd /usr/local/lib && { ln -s -f libtfsclient_c.so.0.0.0 libtfsclient_c.so || { rm -f libtfsclient_c.so && ln -s libtfsclient_c.so.0.0.0 libtfsclient_c.so; }; }) libtool: install: /usr/bin/install -c .libs/libtfsclient_c.lai /usr/local/lib/libtfsclient_c.la libtool: install: /usr/bin/install -c .libs/libtfsclient.a /usr/local/lib/libtfsclient.a libtool: install: chmod 644 /usr/local/lib/libtfsclient.a libtool: install: ranlib /usr/local/lib/libtfsclient.a libtool: install: /usr/bin/install -c .libs/libtfsclient_c.a /usr/local/lib/libtfsclient_c.a libtool: install: chmod 644 /usr/local/lib/libtfsclient_c.a libtool: install: ranlib /usr/local/lib/libtfsclient_c.a libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /usr/local/lib ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- make install-exec-hook make[4]: Entering directory `/usr/local/tfs_release-2.2.16/src/new_client' tmp_dir=".tfs_tmp_dir";\ for client_lib in libtfsclient.a libtfsclient_c.a; \ do \ cd /usr/local/lib;\ test -d $tmp_dir && rm -rf $tmp_dir;\ mkdir -p $tmp_dir && mv $client_lib $tmp_dir;\ cd $tmp_dir;\ ar x $client_lib;\ rm -f $client_lib;\ for i in *.a ; do\ lib_tmp_dir=".tmp_$i";\ mkdir -p $lib_tmp_dir;\ mv $i $lib_tmp_dir;\ cd $lib_tmp_dir;\ ar x $i;\ cd ../; done;\ ar cru ../$client_lib `find . -name '*.o'`;\ ranlib ../$client_lib;\ chmod 644 ../$client_lib;\ done; \ cd .. && rm -rf $tmp_dir make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/src/new_client' /usr/bin/mkdir -p '/usr/local/include' /usr/bin/install -c -m 644 tfs_client_api.h tfs_client_capi.h tfs_rc_client_api.h tfs_meta_client_api.h '/usr/local/include' make install-data-hook make[4]: Entering directory `/usr/local/tfs_release-2.2.16/src/new_client' cd /usr/local/include && \ sed -i 's#common/\(.*\.h\)#\1#g' tfs_client_api.h tfs_client_capi.h tfs_rc_client_api.h tfs_meta_client_api.h && \ sed -i -n -e '/ifdef \+WITH_UNIQUE_STORE/{h;d}' -e '/endif/{x;/ifdef \+WITH_UNIQUE_STORE/d;x;p;d}' -e 'x;/ifdef \+WITH_UNIQUE_STORE/{x;d};x;p' tfs_client_api.h tfs_client_capi.h tfs_rc_client_api.h tfs_meta_client_api.h make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/src/new_client' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/new_client' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/new_client' Making install in dataserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/dataserver' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/dataserver' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../libtool --mode=install /usr/bin/install -c dataserver '/usr/local/bin' libtool: install: /usr/bin/install -c dataserver /usr/local/bin/dataserver make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/dataserver' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/dataserver' Making install in nameserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/nameserver' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/nameserver' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../libtool --mode=install /usr/bin/install -c nameserver '/usr/local/bin' libtool: install: /usr/bin/install -c nameserver /usr/local/bin/nameserver make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/nameserver' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/nameserver' Making install in adminserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/adminserver' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/adminserver' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../libtool --mode=install /usr/bin/install -c adminserver '/usr/local/bin' libtool: install: /usr/bin/install -c adminserver /usr/local/bin/adminserver make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/adminserver' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/adminserver' Making install in tools make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools' Making install in util make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/util' make[4]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/util' make[4]: Nothing to be done for `install-exec-am'. make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/util' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/util' Making install in dataserver make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/dataserver' make[4]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/dataserver' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../../libtool --mode=install /usr/bin/install -c clear_file_system ds_client format_file_system read_super_block recover_disk_data_to_cluster recover_sync_file_queue convert_name reload_config read_index_tool read_block_prefix reverse_name modify_super_block tfsping view_local_key gen_block_prefix verify_block_to_dataserver '/usr/local/bin' libtool: install: /usr/bin/install -c clear_file_system /usr/local/bin/clear_file_system libtool: install: /usr/bin/install -c ds_client /usr/local/bin/ds_client libtool: install: /usr/bin/install -c format_file_system /usr/local/bin/format_file_system libtool: install: /usr/bin/install -c read_super_block /usr/local/bin/read_super_block libtool: install: /usr/bin/install -c recover_disk_data_to_cluster /usr/local/bin/recover_disk_data_to_cluster libtool: install: /usr/bin/install -c recover_sync_file_queue /usr/local/bin/recover_sync_file_queue libtool: install: /usr/bin/install -c convert_name /usr/local/bin/convert_name libtool: install: /usr/bin/install -c reload_config /usr/local/bin/reload_config libtool: install: /usr/bin/install -c read_index_tool /usr/local/bin/read_index_tool libtool: install: /usr/bin/install -c read_block_prefix /usr/local/bin/read_block_prefix libtool: install: /usr/bin/install -c reverse_name /usr/local/bin/reverse_name libtool: install: /usr/bin/install -c modify_super_block /usr/local/bin/modify_super_block libtool: install: /usr/bin/install -c tfsping /usr/local/bin/tfsping libtool: install: /usr/bin/install -c view_local_key /usr/local/bin/view_local_key libtool: install: /usr/bin/install -c gen_block_prefix /usr/local/bin/gen_block_prefix libtool: install: /usr/bin/install -c verify_block_to_dataserver /usr/local/bin/verify_block_to_dataserver make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/dataserver' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/dataserver' Making install in nameserver make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/nameserver' make[4]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/nameserver' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../../libtool --mode=install /usr/bin/install -c admintool showsyncoplog rmsyncoplog ssm tfstool performance syncbyfile read_syncoplog_header repair_block_info '/usr/local/bin' libtool: install: /usr/bin/install -c admintool /usr/local/bin/admintool libtool: install: /usr/bin/install -c showsyncoplog /usr/local/bin/showsyncoplog libtool: install: /usr/bin/install -c rmsyncoplog /usr/local/bin/rmsyncoplog libtool: install: /usr/bin/install -c ssm /usr/local/bin/ssm libtool: install: /usr/bin/install -c tfstool /usr/local/bin/tfstool libtool: install: /usr/bin/install -c performance /usr/local/bin/performance libtool: install: /usr/bin/install -c syncbyfile /usr/local/bin/syncbyfile libtool: install: /usr/bin/install -c read_syncoplog_header /usr/local/bin/read_syncoplog_header libtool: install: /usr/bin/install -c repair_block_info /usr/local/bin/repair_block_info make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/nameserver' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/nameserver' Making install in adminserver make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/adminserver' make[4]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/adminserver' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../../libtool --mode=install /usr/bin/install -c adminservertool '/usr/local/bin' libtool: install: /usr/bin/install -c adminservertool /usr/local/bin/adminservertool make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/adminserver' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/adminserver' Making install in mock make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/mock' make[4]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/mock' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../../libtool --mode=install /usr/bin/install -c mock_data_server '/usr/local/bin' libtool: install: /usr/bin/install -c mock_data_server /usr/local/bin/mock_data_server make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/mock' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/mock' Making install in transfer make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/transfer' make[4]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/transfer' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../../libtool --mode=install /usr/bin/install -c transfer_block split_block_tool compare_crc compare_same_cluster transfer_same_cluster_block compare_same_cluster_ext remove_block verify_file_same_cluster transfer_ge_dirs transfer_logo_tool '/usr/local/bin' libtool: install: /usr/bin/install -c transfer_block /usr/local/bin/transfer_block libtool: install: /usr/bin/install -c split_block_tool /usr/local/bin/split_block_tool libtool: install: /usr/bin/install -c compare_crc /usr/local/bin/compare_crc libtool: install: /usr/bin/install -c compare_same_cluster /usr/local/bin/compare_same_cluster libtool: install: /usr/bin/install -c transfer_same_cluster_block /usr/local/bin/transfer_same_cluster_block libtool: install: /usr/bin/install -c compare_same_cluster_ext /usr/local/bin/compare_same_cluster_ext libtool: install: /usr/bin/install -c remove_block /usr/local/bin/remove_block libtool: install: /usr/bin/install -c verify_file_same_cluster /usr/local/bin/verify_file_same_cluster libtool: install: /usr/bin/install -c transfer_ge_dirs /usr/local/bin/transfer_ge_dirs libtool: install: /usr/bin/install -c transfer_logo_tool /usr/local/bin/transfer_logo_tool make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/transfer' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/transfer' Making install in cluster make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/cluster' make[4]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools/cluster' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../../libtool --mode=install /usr/bin/install -c sync_by_blk sync_by_log sync_by_file transfer_by_file sync_analyze_tool '/usr/local/bin' libtool: install: /usr/bin/install -c sync_by_blk /usr/local/bin/sync_by_blk libtool: install: /usr/bin/install -c sync_by_log /usr/local/bin/sync_by_log libtool: install: /usr/bin/install -c sync_by_file /usr/local/bin/sync_by_file libtool: install: /usr/bin/install -c transfer_by_file /usr/local/bin/transfer_by_file libtool: install: /usr/bin/install -c sync_analyze_tool /usr/local/bin/sync_analyze_tool make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/cluster' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools/cluster' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools' make[4]: Entering directory `/usr/local/tfs_release-2.2.16/src/tools' make[4]: Nothing to be done for `install-exec-am'. make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/tools' Making install in rcserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/rcserver' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/rcserver' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../libtool --mode=install /usr/bin/install -c rcserver '/usr/local/bin' libtool: install: /usr/bin/install -c rcserver /usr/local/bin/rcserver make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/rcserver' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/rcserver' Making install in monitor make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/monitor' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/monitor' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../libtool --mode=install /usr/bin/install -c ha_monitor ns_ping '/usr/local/bin' libtool: install: /usr/bin/install -c ha_monitor /usr/local/bin/ha_monitor libtool: install: /usr/bin/install -c ns_ping /usr/local/bin/ns_ping make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/monitor' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/monitor' Making install in name_meta_server make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/name_meta_server' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/name_meta_server' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../libtool --mode=install /usr/bin/install -c metaserver '/usr/local/bin' libtool: install: /usr/bin/install -c metaserver /usr/local/bin/metaserver make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/name_meta_server' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/name_meta_server' Making install in rootserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/rootserver' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/rootserver' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../libtool --mode=install /usr/bin/install -c rootserver '/usr/local/bin' libtool: install: /usr/bin/install -c rootserver /usr/local/bin/rootserver make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/rootserver' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/rootserver' Making install in checkserver make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src/checkserver' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src/checkserver' /usr/bin/mkdir -p '/usr/local/bin' /bin/sh ../../libtool --mode=install /usr/bin/install -c checkserver '/usr/local/bin' libtool: install: /usr/bin/install -c checkserver /usr/local/bin/checkserver make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src/checkserver' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src/checkserver' make[2]: Entering directory `/usr/local/tfs_release-2.2.16/src' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/src' make[3]: Nothing to be done for `install-exec-am'. make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/src' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/src' make[1]: Leaving directory `/usr/local/tfs_release-2.2.16/src' Making install in conf make[1]: Entering directory `/usr/local/tfs_release-2.2.16/conf' make[2]: Entering directory `/usr/local/tfs_release-2.2.16/conf' make[2]: Nothing to be done for `install-exec-am'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/conf' make[1]: Leaving directory `/usr/local/tfs_release-2.2.16/conf' Making install in scripts make[1]: Entering directory `/usr/local/tfs_release-2.2.16/scripts' Making install in ha make[2]: Entering directory `/usr/local/tfs_release-2.2.16/scripts/ha' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/scripts/ha' make[3]: Nothing to be done for `install-exec-am'. /usr/bin/mkdir -p '/usr/local/scripts/ha' /usr/bin/install -c -m 644 authkeys.sh deploy.sh ha.cf NameServer RootServer rsdep.sh nsdep.sh ns.xml rs.xml '/usr/local/scripts/ha' make install-data-hook make[4]: Entering directory `/usr/local/tfs_release-2.2.16/scripts/ha' mv //usr/local/scripts/ha/authkeys.sh //usr/local/scripts/ha/authkeys mv //usr/local/scripts/ha/deploy.sh //usr/local/scripts/ha/deploy mv //usr/local/scripts/ha/nsdep.sh //usr/local/scripts/ha/nsdep mv //usr/local/scripts/ha/rsdep.sh //usr/local/scripts/ha/rsdep chmod u+x //usr/local/scripts/ha/authkeys chmod u+x //usr/local/scripts/ha/deploy chmod u+x //usr/local/scripts/ha/nsdep chmod u+x //usr/local/scripts/ha/rsdep chmod u+x //usr/local/scripts/ha/NameServer chmod u+x //usr/local/scripts/ha/RootServer make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/scripts/ha' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/scripts/ha' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/scripts/ha' make[2]: Entering directory `/usr/local/tfs_release-2.2.16/scripts' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/scripts' make[3]: Nothing to be done for `install-exec-am'. /usr/bin/mkdir -p '/usr/local/scripts' /usr/bin/install -c -m 644 stfs.sh tfs.sh start_sync_log.sh sync.sh cs_sync.sh '/usr/local/scripts' make install-data-hook make[4]: Entering directory `/usr/local/tfs_release-2.2.16/scripts' mv //usr/local/scripts/stfs.sh //usr/local/scripts/stfs mv //usr/local/scripts/tfs.sh //usr/local/scripts/tfs mv //usr/local/scripts/sync.sh //usr/local/scripts/sync mv //usr/local/scripts/start_sync_log.sh //usr/local/scripts/start_sync_log mv //usr/local/scripts/cs_sync.sh //usr/local/scripts/cs_sync chmod u+x //usr/local/scripts/stfs chmod u+x //usr/local/scripts/tfs chmod u+x //usr/local/scripts/sync chmod u+x //usr/local/scripts/start_sync_log chmod u+x //usr/local/scripts/cs_sync sed -i 's#\(TFS_HOME=\).*$#\1/usr/local#g' //usr/local/scripts/stfs //usr/local/scripts/tfs make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/scripts' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/scripts' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/scripts' make[1]: Leaving directory `/usr/local/tfs_release-2.2.16/scripts' Making install in sql make[1]: Entering directory `/usr/local/tfs_release-2.2.16/sql' Making install in ms make[2]: Entering directory `/usr/local/tfs_release-2.2.16/sql/ms' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/sql/ms' make[3]: Nothing to be done for `install-exec-am'. /usr/bin/mkdir -p '/usr/local/sql/ms' /usr/bin/install -c -m 644 create_dir.sql create_file.sql create_table.sql mv_dir.sql mv_file.sql pwrite_file.sql rm_dir.sql rm_file.sql seq_simulator.sql '/usr/local/sql/ms' make install-data-hook make[4]: Entering directory `/usr/local/tfs_release-2.2.16/sql/ms' make[4]: Nothing to be done for `install-data-hook'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/sql/ms' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/sql/ms' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/sql/ms' Making install in rcs make[2]: Entering directory `/usr/local/tfs_release-2.2.16/sql/rcs' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/sql/rcs' make[3]: Nothing to be done for `install-exec-am'. /usr/bin/mkdir -p '/usr/local/sql/rcs' /usr/bin/install -c -m 644 create_table.sql '/usr/local/sql/rcs' make install-data-hook make[4]: Entering directory `/usr/local/tfs_release-2.2.16/sql/rcs' make[4]: Nothing to be done for `install-data-hook'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/sql/rcs' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/sql/rcs' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/sql/rcs' make[2]: Entering directory `/usr/local/tfs_release-2.2.16/sql' make[3]: Entering directory `/usr/local/tfs_release-2.2.16/sql' make[3]: Nothing to be done for `install-exec-am'. make install-data-hook make[4]: Entering directory `/usr/local/tfs_release-2.2.16/sql' make[4]: Nothing to be done for `install-data-hook'. make[4]: Leaving directory `/usr/local/tfs_release-2.2.16/sql' make[3]: Leaving directory `/usr/local/tfs_release-2.2.16/sql' make[2]: Leaving directory `/usr/local/tfs_release-2.2.16/sql' make[1]: Leaving directory `/usr/local/tfs_release-2.2.16/sql' make[1]: Entering directory `/usr/local/tfs_release-2.2.16' make[2]: Entering directory `/usr/local/tfs_release-2.2.16' make[2]: Nothing to be done for `install-exec-am'. make[2]: Leaving directory `/usr/local/tfs_release-2.2.16' make[1]: Leaving directory `/usr/local/tfs_release-2.2.16'

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值