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

failed to build in ubuntu18.04 #15

Open
wnpllrzodiac opened this issue Apr 11, 2019 · 4 comments
Open

failed to build in ubuntu18.04 #15

wnpllrzodiac opened this issue Apr 11, 2019 · 4 comments

Comments

@wnpllrzodiac
Copy link

g++  -o objs/sb_http_load objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/htl_app_rtmp_protocol.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o objs/st-1.9/obj/libst.a objs/http-parser-2.1/libhttp_parser.a -ldl
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
objs/src/core/htl_core_uri.o: In function `ProtocolUrl::Initialize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
objs/src/core/htl_core_uri.o: In function `RtmpUrl::Initialize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:199: undefined reference to `context'
objs/src/core/htl_core_uri.o:/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:199: more undefined references to `context' follow
collect2: error: ld returned 1 exit status
objs/Makefile:79: recipe for target 'objs/sb_http_load' failed
make[1]: *** [objs/sb_http_load] Error 1
make[1]: Leaving directory '/home/suhui/work/git/srs-bench'
Makefile:31: recipe for target 'all' failed
make: *** [all] Error 2
@alphonsetai
Copy link

g++  -o objs/sb_http_load objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/htl_app_rtmp_protocol.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o objs/st-1.9/obj/libst.a objs/http-parser-2.1/libhttp_parser.a -ldl
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
objs/src/core/htl_core_uri.o: In function `ProtocolUrl::Initialize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
objs/src/core/htl_core_uri.o: In function `RtmpUrl::Initialize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:199: undefined reference to `context'
objs/src/core/htl_core_uri.o:/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:199: more undefined references to `context' follow
collect2: error: ld returned 1 exit status
objs/Makefile:79: recipe for target 'objs/sb_http_load' failed
make[1]: *** [objs/sb_http_load] Error 1
make[1]: Leaving directory '/home/suhui/work/git/srs-bench'
Makefile:31: recipe for target 'all' failed
make: *** [all] Error 2

configure生成Makefile不严谨,新版本lld检查问题。

在每个target(action)中把含有main函数的目标目标文件加上就好了。

比如"objs/sb_http_load: 后面紧接着加上"objs/src/main/htl_main_http_load.o ",这个target就能编译通过了。

其他部分如法炮制即可

@wnpllrzodiac
Copy link
Author

怎么改?
没效果啊。

$(MAKE) -f objs/Makefile sb_http_load objs/src/main/htl_main_http_load.o

aaa@bbb:~/work/git/srs-bench$ make http
mkdir -p objs/src/core
mkdir -p objs/src/os
mkdir -p objs/src/app
mkdir -p objs/src/main
build the http load test tool over st(state-threads)
make -f objs/Makefile sb_http_load objs/src/main/htl_main_http_load.o
make[1]: Entering directory '/aaa/work/git/srs-bench'
g++  -o objs/sb_http_load objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/htl_app_rtmp_protocol.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o objs/st-1.9/obj/libst.a objs/http-parser-2.1/libhttp_parser.a -ldl
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
objs/src/core/htl_core_uri.o: In function `ProtocolUrl::Initialize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/aaa/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
/aaa/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
/aaa/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
/aaa/work/git/srs-bench/src/core/htl_core_uri.cpp:59: undefined reference to `context'
objs/src/core/htl_core_uri.o: In function `RtmpUrl::Initialize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/aaa/work/git/srs-bench/src/core/htl_core_uri.cpp:199: undefined reference to `context'
objs/src/core/htl_core_uri.o:/home/suhui/work/git/srs-bench/src/core/htl_core_uri.cpp:199: more undefined references to `context' follow
collect2: error: ld returned 1 exit status
objs/Makefile:79: recipe for target 'objs/sb_http_load' failed
make[1]: *** [objs/sb_http_load] Error 1
make[1]: Leaving directory '/home/suhui/work/git/srs-bench'
Makefile:17: recipe for target 'http' failed
make: *** [http] Error 2

@wnpllrzodiac
Copy link
Author

又尝试了下,发现改错文件了。
应该是修改 objs/Makefile 按照你的建议修改,可以编译通过了。感谢帮助!

sb_hls_load: objs/sb_hls_load
objs/sb_hls_load: objs/src/main/htl_main_hls_load.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/htl_app_rtmp_protocol.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o
    $(LINK)  -o objs/sb_hls_load objs/src/main/htl_main_hls_load.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/htl_app_rtmp_protocol.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o objs/st-1.9/obj/libst.a objs/http-parser-2.1/libhttp_parser.a -ldl

@dqw91
Copy link

dqw91 commented Sep 29, 2020

Thanks. Here are the full modification for the file objs/Makefile

CXXFLAGS = -std=c++98 -Wall -Wextra -g -O0 -DSRS_HIJACK_IO -DSRS_DISABLE_LOG
GCC = g++
LINK = $(GCC)
AR = ar

......

build objs/sb_http_load

sb_http_load: objs/sb_http_load
objs/sb_http_load: objs/src/main/htl_main_http_load.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/srs_librtmp.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o
$(LINK) -o objs/sb_http_load objs/src/main/htl_main_http_load.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/srs_librtmp.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o objs/st-1.9/obj/libst.a objs/http-parser-2.1/libhttp_parser.a -ldl

build objs/sb_rtmp_load

sb_rtmp_load: objs/sb_rtmp_load
objs/sb_rtmp_load: objs/src/main/htl_main_rtmp_load.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/srs_librtmp.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o
$(LINK) -o objs/sb_rtmp_load objs/src/main/htl_main_rtmp_load.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/srs_librtmp.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o objs/st-1.9/obj/libst.a objs/http-parser-2.1/libhttp_parser.a -ldl

build objs/sb_rtmp_load_fast

sb_rtmp_load_fast: objs/sb_rtmp_load_fast
objs/sb_rtmp_load_fast: objs/src/main/htl_main_rtmp_load_fast.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/srs_librtmp.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o
$(LINK) -o objs/sb_rtmp_load_fast objs/src/main/htl_main_rtmp_load_fast.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/srs_librtmp.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o objs/st-1.9/obj/libst.a objs/http-parser-2.1/libhttp_parser.a -ldl

build objs/sb_rtmp_publish

sb_rtmp_publish: objs/sb_rtmp_publish
objs/sb_rtmp_publish: objs/src/main/htl_main_rtmp_publish.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/srs_librtmp.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o
$(LINK) -o objs/sb_rtmp_publish objs/src/main/htl_main_rtmp_publish.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/srs_librtmp.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o objs/st-1.9/obj/libst.a objs/http-parser-2.1/libhttp_parser.a -ldl

build objs/sb_hls_load

sb_hls_load: objs/sb_hls_load
objs/sb_hls_load: objs/src/main/htl_main_hls_load.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/srs_librtmp.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o
$(LINK) -o objs/sb_hls_load objs/src/main/htl_main_hls_load.o objs/src/core/htl_core_log.o objs/src/core/htl_core_error.o objs/src/core/htl_core_uri.o objs/src/core/htl_core_aggregate_ret.o objs/src/os/htl_os_st.o objs/src/app/htl_app_hls_load.o objs/src/app/htl_app_http_load.o objs/src/app/htl_app_http_client.o objs/src/app/htl_app_rtmp_play.o objs/src/app/htl_app_m3u8_parser.o objs/src/app/htl_app_task_base.o objs/src/app/htl_app_rtmp_load.o objs/src/app/srs_librtmp.o objs/src/app/htl_app_rtmp_publish.o objs/src/app/htl_app_srs_hijack.o objs/st-1.9/obj/libst.a objs/http-parser-2.1/libhttp_parser.a -ldl

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

3 participants