Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross Compile Error #62

Open
lystormenvoy opened this issue May 21, 2021 · 3 comments
Open

Cross Compile Error #62

lystormenvoy opened this issue May 21, 2021 · 3 comments

Comments

@lystormenvoy
Copy link

lystormenvoy commented May 21, 2021

objs/addon/mpegts/ngx_mpegts_http_module.o \
objs/ngx_modules.o \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -ldl -lrt -lcrypt ../pcre-8.44/.libs/libpcre.a ../openssl-1.1.1k/.openssl/lib/libssl.a ../openssl-1.1.1k/.openssl/lib/libcrypto.a -ldl ../zlib-1.2.11/libz.a \
-Wl,-E
objs/addon/nginx-rtmp-module/ngx_rtmp_handler.o: In function `ngx_rtmp_recv':
ngx_rtmp_handler.c:(.text+0x1644): undefined reference to `ngx_log_debug'
collect2: error: ld return 1
make[1]: *** [objs/Makefile:329:objs/nginx] error 1

Cross compile for hi3536d
Cross-compile-prefix: arm-hisiv400-linux-
Configure:

./configure --user=root --group=root \
--sbin-path=/usr/local/nginx/sbin/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--pid-path=/usr/local/nginx/logs/nginx.pid \
--error-log-path=/usr/local/nginx/logs/error.log \
--with-http_ssl_module \
--with-cc=arm-hisiv400-linux-gcc \
--with-cpp=arm-hisiv400-linux-cpp \
--with-pcre=../pcre-8.44 \
--with-openssl=../openssl-1.1.1k \
--add-module=../nginx-client-module \
--add-module=../nginx-multiport-module \
--add-module=../nginx-toolkit-module \
--add-module=../nginx-rtmp-module \
--with-http_flv_module \
--with-http_mp4_module \
--with-debug \
--with-zlib=../zlib-1.2.11 \
--with-http_stub_status_module \
--with-cc-opt='-D_FILE_OFFSET_BITS=64 -D_LARGE_FILE' \
--with-ld-opt='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE'
@lystormenvoy
Copy link
Author

lystormenvoy commented May 21, 2021

after comment the ngx_log_debug line then I compile success.
But thereis segment fault.

(gdb) info stack
#0  ngx_strlow (dst=0x2137a18 "", src=0x0, n=<optimized out>) at src/core/ngx_string.c:26
#1  0x0011da1c in ngx_rtmp_add_variable (cf=cf@entry=0xbe98c9f0, name=name@entry=0x369f64 <in_elts.36763>, flags=3)
    at ../nginx-rtmp-module/ngx_rtmp_variables.c:973
#2  0x0010078c in ngx_rtmp_codec_add_variables (cf=0xbe98c9f0) at ../nginx-rtmp-module/ngx_rtmp_codec_module.c:1490
#3  0x000f4b74 in ngx_rtmp_block (cf=0xbe98c9f0, cmd=<optimized out>, conf=<optimized out>) at ../nginx-rtmp-module/ngx_rtmp.c:213
#4  0x00069fcc in ngx_conf_handler (last=0, cf=0xbe98c9f0) at src/core/ngx_conf_file.c:463
#5  ngx_conf_parse (cf=0xbe98c9f0, cf@entry=0xbe98c9e8, filename=0x0, filename@entry=0x2129434) at src/core/ngx_conf_file.c:319
#6  0x00067a0c in ngx_init_cycle (old_cycle=0xbe98ca5c, old_cycle@entry=0xbe98ca54) at src/core/ngx_cycle.c:284
#7  0x000558bc in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:292

Breakpoint 2, ngx_strlow (dst=0x1cb5a0b "", src=0x2e8f40 "metadata", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a0c "", src=0x2e8f41 "etadata", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a0d "", src=0x2e8f42 "tadata", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a0e "", src=0x2e8f43 "adata", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a0f "", src=0x2e8f44 "data", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a10 "", src=0x2e8f45 "ata", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a11 "", src=0x2e8f46 "ta", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a12 "", src=0x2e8f47 "a", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a13 "", src=0x2e475c "metadata_", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a14 "", src=0x2e475d "etadata_", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a15 "", src=0x2e475e "tadata_", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a16 "", src=0x2e475f "adata_", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a17 "", src=0x2e4760 "data_", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a18 "", src=0x2e4761 "ata_", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a19 "", src=0x2e4762 "ta_", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a1a "", src=0x2e4763 "a_", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a1b "", src=0x2e4764 "_", n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 2, ngx_strlow (dst=0x1cb5a38 "", src=0x0, n=<optimized out>) at src/core/ngx_string.c:26
26	in src/core/ngx_string.c
(gdb) 
Continuing.
Breakpoint 1, ngx_rtmp_add_variable (cf=cf@entry=0xbefff9b0, name=name@entry=0x36c7f4 <ngx_rtmp_core_variables+1260>, flags=2)
    at ../nginx-rtmp-module/ngx_rtmp_variables.c:973
973	in ../nginx-rtmp-module/ngx_rtmp_variables.c
(gdb) print name->data
$71 = (u_char *) 0x2d6ee4 "time_iso8601"
(gdb) c
Continuing.

Breakpoint 1, ngx_rtmp_add_variable (cf=cf@entry=0xbefff9b0, name=name@entry=0x36c810 <ngx_rtmp_core_variables+1288>, flags=2)
    at ../nginx-rtmp-module/ngx_rtmp_variables.c:973
973	in ../nginx-rtmp-module/ngx_rtmp_variables.c
(gdb) print name->data
$72 = (u_char *) 0x2d6ed8 "time_local"
(gdb) c               
Continuing.

Breakpoint 1, ngx_rtmp_add_variable (cf=cf@entry=0xbefff9b0, name=name@entry=0x36c82c <ngx_rtmp_core_variables+1316>, flags=0)
    at ../nginx-rtmp-module/ngx_rtmp_variables.c:973
973	in ../nginx-rtmp-module/ngx_rtmp_variables.c
(gdb) print name->data
$73 = (u_char *) 0x2e91e0 "ngx_worker"
(gdb) print name->data
$74 = (u_char *) 0x2e91e0 "ngx_worker"
(gdb) c
Continuing.

Breakpoint 1, ngx_rtmp_add_variable (cf=cf@entry=0xbefff9b0, name=name@entry=0x369f64 <in_elts.36763>, flags=3)
    at ../nginx-rtmp-module/ngx_rtmp_variables.c:973
973	in ../nginx-rtmp-module/ngx_rtmp_variables.c
(gdb) print name->data
$75 = (u_char *) 0x0
(gdb) p/c name->data  
$76 = 0 '\000'
(gdb) c
Continuing.

@lystormenvoy
Copy link
Author

ngx_rtmp_codec_module.c:101

static ngx_rtmp_variable_t  ngx_rtmp_codec_variabes[] = {
    { ngx_string("metadata"), NULL, ngx_rtmp_codec_variable_metadata,
      0, NGX_RTMP_VAR_NOCACHEABLE|NGX_RTMP_VAR_PREFIX, 0 },
    { ngx_string("metadata_"), NULL, ngx_rtmp_codec_variable_metadata_arg,
      0, NGX_RTMP_VAR_NOCACHEABLE|NGX_RTMP_VAR_PREFIX, 0 }
};

ngx_rtmp_codec_module.c:1490

static ngx_int_t
ngx_rtmp_codec_add_variables(ngx_conf_t *cf)
{
    ngx_rtmp_variable_t  *var, *v;

    for (v = ngx_rtmp_codec_variabes; v->name.len; v++) {
        **var = ngx_rtmp_add_variable(cf, &v->name, v->flags);**
        if (var == NULL) {
            return NGX_ERROR;
        }

        var->get_handler = v->get_handler;
        var->data = v->data;
    }

    return NGX_OK;
}

ngx_rtmp_variables.c:927

ngx_rtmp_variable_t *
ngx_rtmp_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags)
{
    ngx_int_t                   rc;
    ngx_uint_t                  i;
    ngx_hash_key_t             *key;
    ngx_rtmp_variable_t        *v;
    ngx_rtmp_core_main_conf_t  *cmcf;

   **//name->len is 2 when segment fault  but name->data is "0x0"**
    if (name->len == 0) {
        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
                           "invalid variable name \"$\"");
        return NULL;
    }

@lystormenvoy
Copy link
Author

lystormenvoy commented May 22, 2021

add { ngx_null_string, NULL, NULL, 0, 0, 0 } to

static ngx_rtmp_variable_t  ngx_rtmp_codec_variabes[] = {
    { ngx_string("metadata"), NULL, ngx_rtmp_codec_variable_metadata,
      0, NGX_RTMP_VAR_NOCACHEABLE|NGX_RTMP_VAR_PREFIX, 0 },
    { ngx_string("metadata_"), NULL, ngx_rtmp_codec_variable_metadata_arg,
      0, NGX_RTMP_VAR_NOCACHEABLE|NGX_RTMP_VAR_PREFIX, 0 }
};

in ngx_rtmp_codec_module.c at line 104.

Then it would be

static ngx_rtmp_variable_t  ngx_rtmp_codec_variabes[] = {
    { ngx_string("metadata"), NULL, ngx_rtmp_codec_variable_metadata,
      0, NGX_RTMP_VAR_NOCACHEABLE|NGX_RTMP_VAR_PREFIX, 0 },
    { ngx_string("metadata_"), NULL, ngx_rtmp_codec_variable_metadata_arg,
      0, NGX_RTMP_VAR_NOCACHEABLE|NGX_RTMP_VAR_PREFIX, 0 },
    { ngx_null_string, NULL, NULL, 0, 0, 0 }
};

can solve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant