winlin

fix #485, error when arm glibc 2.15+ or not i386/x86_64/amd64. 2.0.192

@@ -335,6 +335,7 @@ Remark: @@ -335,6 +335,7 @@ Remark:
335 335
336 ## History 336 ## History
337 337
  338 +* v2.0, 2015-09-23, for [#485][bug #485] error when arm glibc 2.15+ or not i386/x86_64/amd64. 2.0.192
338 * v2.0, 2015-09-23, for [#485][bug #485] srs for respberrypi and cubieboard. 2.0.191 339 * v2.0, 2015-09-23, for [#485][bug #485] srs for respberrypi and cubieboard. 2.0.191
339 * v2.0, 2015-09-21, fix [#484][bug #484] hotfix the openssl build script 2.0.190 340 * v2.0, 2015-09-21, fix [#484][bug #484] hotfix the openssl build script 2.0.190
340 * <strong>v2.0, 2015-09-14, [2.0 alpha1(2.0.189)][r2.0a1] released. 89269 lines.</strong> 341 * <strong>v2.0, 2015-09-14, [2.0 alpha1(2.0.189)][r2.0a1] released. 89269 lines.</strong>
@@ -38,7 +38,11 @@ function Ubuntu_prepare() @@ -38,7 +38,11 @@ function Ubuntu_prepare()
38 else 38 else
39 uname -v|grep Ubuntu >/dev/null 2>&1 39 uname -v|grep Ubuntu >/dev/null 2>&1
40 ret=$?; if [[ 0 -ne $ret ]]; then 40 ret=$?; if [[ 0 -ne $ret ]]; then
41 - return 0; 41 + # for debian, we think it's ubuntu also.
  42 + # for example, the wheezy/sid which is debian armv7 linux, can not identified by uname -v.
  43 + if [[ ! -f /etc/debian_version ]]; then
  44 + return 0;
  45 + fi
42 fi 46 fi
43 fi 47 fi
44 48
@@ -378,7 +382,7 @@ fi @@ -378,7 +382,7 @@ fi
378 ##################################################################################### 382 #####################################################################################
379 if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then 383 if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
380 # check the cross build flag file, if flag changed, need to rebuild the st. 384 # check the cross build flag file, if flag changed, need to rebuild the st.
381 - _ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="EXTRA_CFLAGS=-DMD_HAVE_EPOLL" 385 + _ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_EPOLL"
382 # for osx, use darwin for st, donot use epoll. 386 # for osx, use darwin for st, donot use epoll.
383 if [ $OS_IS_OSX = YES ]; then 387 if [ $OS_IS_OSX = YES ]; then
384 _ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="EXTRA_CFLAGS=-DMD_HAVE_KQUEUE" 388 _ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="EXTRA_CFLAGS=-DMD_HAVE_KQUEUE"
@@ -399,7 +403,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then @@ -399,7 +403,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
399 patch -p0 < ../../3rdparty/patches/1.st.arm.patch && 403 patch -p0 < ../../3rdparty/patches/1.st.arm.patch &&
400 patch -p0 < ../../3rdparty/patches/3.st.osx.kqueue.patch && 404 patch -p0 < ../../3rdparty/patches/3.st.osx.kqueue.patch &&
401 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch && 405 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch &&
402 - make ${_ST_MAKE} CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} ${_ST_EXTRA_CFLAGS} && 406 + make ${_ST_MAKE} CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" &&
403 cd .. && rm -rf st && ln -sf st-1.9/obj st && 407 cd .. && rm -rf st && ln -sf st-1.9/obj st &&
404 cd .. && touch ${SRS_OBJS}/_flag.st.cross.build.tmp 408 cd .. && touch ${SRS_OBJS}/_flag.st.cross.build.tmp
405 ) 409 )
@@ -416,7 +420,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then @@ -416,7 +420,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
416 patch -p0 < ../../3rdparty/patches/1.st.arm.patch && 420 patch -p0 < ../../3rdparty/patches/1.st.arm.patch &&
417 patch -p0 < ../../3rdparty/patches/3.st.osx.kqueue.patch && 421 patch -p0 < ../../3rdparty/patches/3.st.osx.kqueue.patch &&
418 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch && 422 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch &&
419 - make ${_ST_MAKE} ${_ST_EXTRA_CFLAGS} && 423 + make ${_ST_MAKE} EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" &&
420 cd .. && rm -rf st && ln -sf st-1.9/obj st && 424 cd .. && rm -rf st && ln -sf st-1.9/obj st &&
421 cd .. && rm -f ${SRS_OBJS}/_flag.st.cross.build.tmp 425 cd .. && rm -f ${SRS_OBJS}/_flag.st.cross.build.tmp
422 ) 426 )
@@ -99,6 +99,7 @@ @@ -99,6 +99,7 @@
99 3C689F9F1AB6AAC800C9CEEE /* sched.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C689F9B1AB6AAC800C9CEEE /* sched.c */; }; 99 3C689F9F1AB6AAC800C9CEEE /* sched.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C689F9B1AB6AAC800C9CEEE /* sched.c */; };
100 3C689FA01AB6AAC800C9CEEE /* stk.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C689F9C1AB6AAC800C9CEEE /* stk.c */; }; 100 3C689FA01AB6AAC800C9CEEE /* stk.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C689F9C1AB6AAC800C9CEEE /* stk.c */; };
101 3C689FA11AB6AAC800C9CEEE /* sync.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C689F9D1AB6AAC800C9CEEE /* sync.c */; }; 101 3C689FA11AB6AAC800C9CEEE /* sync.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C689F9D1AB6AAC800C9CEEE /* sync.c */; };
  102 + 3CB25C2A1BB269FD00C97A63 /* jmp_sp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CB25C291BB269FD00C97A63 /* jmp_sp.cpp */; };
102 3CC52DD81ACE4023006FEB01 /* srs_utest_amf0.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DCA1ACE4023006FEB01 /* srs_utest_amf0.cpp */; }; 103 3CC52DD81ACE4023006FEB01 /* srs_utest_amf0.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DCA1ACE4023006FEB01 /* srs_utest_amf0.cpp */; };
103 3CC52DD91ACE4023006FEB01 /* srs_utest_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DCC1ACE4023006FEB01 /* srs_utest_config.cpp */; }; 104 3CC52DD91ACE4023006FEB01 /* srs_utest_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DCC1ACE4023006FEB01 /* srs_utest_config.cpp */; };
104 3CC52DDA1ACE4023006FEB01 /* srs_utest_core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DCE1ACE4023006FEB01 /* srs_utest_core.cpp */; }; 105 3CC52DDA1ACE4023006FEB01 /* srs_utest_core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DCE1ACE4023006FEB01 /* srs_utest_core.cpp */; };
@@ -353,6 +354,7 @@ @@ -353,6 +354,7 @@
353 3C689F9C1AB6AAC800C9CEEE /* stk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stk.c; path = "../../objs/st-1.9/stk.c"; sourceTree = "<group>"; }; 354 3C689F9C1AB6AAC800C9CEEE /* stk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stk.c; path = "../../objs/st-1.9/stk.c"; sourceTree = "<group>"; };
354 3C689F9D1AB6AAC800C9CEEE /* sync.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sync.c; path = "../../objs/st-1.9/sync.c"; sourceTree = "<group>"; }; 355 3C689F9D1AB6AAC800C9CEEE /* sync.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sync.c; path = "../../objs/st-1.9/sync.c"; sourceTree = "<group>"; };
355 3CB25C281BB2596300C97A63 /* setup_variables.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = setup_variables.sh; path = ../../../auto/setup_variables.sh; sourceTree = "<group>"; }; 356 3CB25C281BB2596300C97A63 /* setup_variables.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = setup_variables.sh; path = ../../../auto/setup_variables.sh; sourceTree = "<group>"; };
  357 + 3CB25C291BB269FD00C97A63 /* jmp_sp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jmp_sp.cpp; path = ../../../research/arm/jmp_sp.cpp; sourceTree = "<group>"; };
356 3CC52DCA1ACE4023006FEB01 /* srs_utest_amf0.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_utest_amf0.cpp; path = ../../src/utest/srs_utest_amf0.cpp; sourceTree = "<group>"; }; 358 3CC52DCA1ACE4023006FEB01 /* srs_utest_amf0.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_utest_amf0.cpp; path = ../../src/utest/srs_utest_amf0.cpp; sourceTree = "<group>"; };
357 3CC52DCB1ACE4023006FEB01 /* srs_utest_amf0.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_utest_amf0.hpp; path = ../../src/utest/srs_utest_amf0.hpp; sourceTree = "<group>"; }; 359 3CC52DCB1ACE4023006FEB01 /* srs_utest_amf0.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_utest_amf0.hpp; path = ../../src/utest/srs_utest_amf0.hpp; sourceTree = "<group>"; };
358 3CC52DCC1ACE4023006FEB01 /* srs_utest_config.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_utest_config.cpp; path = ../../src/utest/srs_utest_config.cpp; sourceTree = "<group>"; }; 360 3CC52DCC1ACE4023006FEB01 /* srs_utest_config.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_utest_config.cpp; path = ../../src/utest/srs_utest_config.cpp; sourceTree = "<group>"; };
@@ -738,6 +740,7 @@ @@ -738,6 +740,7 @@
738 3C663F001AB014B500286D8B /* research */ = { 740 3C663F001AB014B500286D8B /* research */ = {
739 isa = PBXGroup; 741 isa = PBXGroup;
740 children = ( 742 children = (
  743 + 3CB25C291BB269FD00C97A63 /* jmp_sp.cpp */,
741 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */, 744 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */,
742 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */, 745 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */,
743 3C663F041AB0155100286D8B /* srs_bandwidth_check.c */, 746 3C663F041AB0155100286D8B /* srs_bandwidth_check.c */,
@@ -925,6 +928,7 @@ @@ -925,6 +928,7 @@
925 3C28EDDF1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp in Sources */, 928 3C28EDDF1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp in Sources */,
926 3C1232241AAE814D00CE8F6C /* srs_kernel_error.cpp in Sources */, 929 3C1232241AAE814D00CE8F6C /* srs_kernel_error.cpp in Sources */,
927 3C036B561B2D0AC10078E2E0 /* srs_app_http_stream.cpp in Sources */, 930 3C036B561B2D0AC10078E2E0 /* srs_app_http_stream.cpp in Sources */,
  931 + 3CB25C2A1BB269FD00C97A63 /* jmp_sp.cpp in Sources */,
928 3C068D6D1B10175500AA722C /* srs_protocol_buffer.cpp in Sources */, 932 3C068D6D1B10175500AA722C /* srs_protocol_buffer.cpp in Sources */,
929 3C1232441AAE81A400CE8F6C /* srs_rtmp_handshake.cpp in Sources */, 933 3C1232441AAE81A400CE8F6C /* srs_rtmp_handshake.cpp in Sources */,
930 3C1232291AAE814D00CE8F6C /* srs_kernel_stream.cpp in Sources */, 934 3C1232291AAE814D00CE8F6C /* srs_kernel_stream.cpp in Sources */,
@@ -11,22 +11,7 @@ @@ -11,22 +11,7 @@
11 11
12 jmp_buf context; 12 jmp_buf context;
13 13
14 -void func1()  
15 -{  
16 -#if defined(__amd64__) || defined(__x86_64__)  
17 - register long int rsp0 asm("rsp");  
18 -  
19 - int ret = setjmp(context);  
20 - printf("setjmp func1 ret=%d, rsp=%#lx\n", ret, rsp0);  
21 - // enter by longjmp  
22 - if (ret != 0) {  
23 - printf("call by longjmp.\n");  
24 - exit(0);  
25 - }  
26 -#endif  
27 -}  
28 -  
29 -void func0() 14 +void do_longjmp()
30 { 15 {
31 /** 16 /**
32 the definition of jmp_buf: 17 the definition of jmp_buf:
@@ -78,8 +63,6 @@ void func0() @@ -78,8 +63,6 @@ void func0()
78 printf("env[%d]=%#x, ", i, (int)context[0].__jmpbuf[i]); 63 printf("env[%d]=%#x, ", i, (int)context[0].__jmpbuf[i]);
79 } 64 }
80 printf("\n"); 65 printf("\n");
81 -  
82 - func1();  
83 #endif 66 #endif
84 67
85 #if defined(__arm__) 68 #if defined(__arm__)
@@ -105,7 +88,7 @@ void func0() @@ -105,7 +88,7 @@ void func0()
105 */ 88 */
106 /** 89 /**
107 For example, on raspberry-pi, armv6 cpu: 90 For example, on raspberry-pi, armv6 cpu:
108 - (gdb) x /64 context[0].__jmpbuf 91 + (gdb) x /64xb (char*)context[0].__jmpbuf
109 v1, 0: 0x00 0x00 0x00 0x00 92 v1, 0: 0x00 0x00 0x00 0x00
110 v2, 1: 0x00 0x00 0x00 0x00 93 v2, 1: 0x00 0x00 0x00 0x00
111 v3, 2: 0x2c 0x84 0x00 0x00 94 v3, 2: 0x2c 0x84 0x00 0x00
@@ -147,8 +130,7 @@ int main(int argc, char** argv) @@ -147,8 +130,7 @@ int main(int argc, char** argv)
147 (int)__GLIBC__, (int)__GLIBC_MINOR__); 130 (int)__GLIBC__, (int)__GLIBC_MINOR__);
148 #endif 131 #endif
149 132
150 - func0();  
151 - longjmp(context, 1); 133 + do_longjmp();
152 134
153 printf("terminated\n"); 135 printf("terminated\n");
154 136
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 191 34 +#define VERSION_REVISION 192
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -119,5 +119,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -119,5 +119,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
119 className(const className&); \ 119 className(const className&); \
120 className& operator= (const className&) 120 className& operator= (const className&)
121 121
  122 +/**
  123 + * important check for st(state-threads),
  124 + * only support the following cpus:
  125 + * 1. i386/amd64/x86_64
  126 + * 2. arm, glibc <= 2.15
  127 + */
  128 +#if !defined(__amd64__) && !defined(__x86_64__) && !defined(__i386__) && !defined(__arm__)
  129 + #error "only support i386/amd64/x86_64/arm cpu"
  130 +#endif
  131 +#if defined(__arm__) && __GLIBC__ != 2 || __GLIBC_MINOR__ > 15
  132 + #error "for arm, only support glibc <= 2.15"
122 #endif 133 #endif
123 134
  135 +#endif