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

make出错 #292

Open
qazwsxedckll opened this issue Sep 28, 2022 · 6 comments
Open

make出错 #292

qazwsxedckll opened this issue Sep 28, 2022 · 6 comments

Comments

@qazwsxedckll
Copy link
Contributor

make[1]: Entering directory '/workspaces/acl-3.5.3-22/app/master/tools/master_ctl'
rm -f master_ctl
g++ -c -g -W -Wall -Wcast-qual -Wcast-align -Wno-long-long -Wpointer-arith -Werror -Wshadow -O3 -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO -DLINUX2 -D_REENTRANT -I. -I../../daemon/json -I../../../../lib_acl/include -I../../../../lib_acl_cpp/include -I../../../../lib_protocol/include stdafx.cpp -o debug/stdafx.o
g++ -c -g -W -Wall -Wcast-qual -Wcast-align -Wno-long-long -Wpointer-arith -Werror -Wshadow -O3 -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO -DLINUX2 -D_REENTRANT -I. -I../../daemon/json -I../../../../lib_acl/include -I../../../../lib_acl_cpp/include -I../../../../lib_protocol/include main.cpp -o debug/main.o
g++ -c -g -W -Wall -Wcast-qual -Wcast-align -Wno-long-long -Wpointer-arith -Werror -Wshadow -O3 -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO -DLINUX2 -D_REENTRANT -I. -I../../daemon/json -I../../../../lib_acl/include -I../../../../lib_acl_cpp/include -I../../../../lib_protocol/include ../../daemon/json/struct.gson.cpp -o debug/struct.gson.o
g++  ./debug/stdafx.o  ./debug/main.o  ./debug/struct.gson.o -L../../../../lib_acl_cpp/lib -lacl_cpp -L../../../../lib_protocol/lib -lprotocol -L../../../../lib_acl/lib -lacl -lpthread -lz -liconv -lcrypt -ldl -lz -o master_ctl
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -liconv
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile.in:172: all] Error 1
make[1]: Leaving directory '/workspaces/acl-3.5.3-22/app/master/tools/master_ctl'
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Entering directory '/workspaces/acl-3.5.3-22/app/master/tools/master_ctl'
cp master_ctl ../../../../dist/master/bin/linux64/
cp: cannot stat ‘master_ctl’: No such file or directory
make[1]: *** [Makefile.in:184: install] Error 1
make[1]: Leaving directory '/workspaces/acl-3.5.3-22/app/master/tools/master_ctl'
make: *** [Makefile:158: acl_master] Error 2

windows docker环境,centos7.9镜像

$uname -a
Linux 0c15f8482e48 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

acl-3.5.3-22/app/master/tools/master_ctl/Makefile.in

OS_ENV=$(shell uname -a)
ifeq ($(findstring WSL, $(OS_ENV)), WSL)
	SYSLIB += -liconv
endif

虽然内核有WSL字样,但是还是centos的镜像,不应该加上liconv吧。

@zhengshuxin
Copy link
Member

可以自行在连接时加上。

@qazwsxedckll
Copy link
Contributor Author

qazwsxedckll commented Sep 28, 2022

我的意思是,应该不需要这个判断,docker容器和wsl,uname -a出来是一样的,但是不知道docker用的是什么镜像。

就像这里没有加-liconv的理由一样

#Path for Linux
ifeq ($(findstring Linux, $(OSNAME)), Linux)
	ifeq ($(findstring i686, $(OSNAME)), i686)
		RPATH = linux32
	endif
	ifeq ($(findstring x86_64, $(OSNAME)), x86_64)
		RPATH = linux64
	endif
#	CFLAGS += -DLINUX2
	SYSLIB += -rdynamic
endif

@zhengshuxin
Copy link
Member

OS_ENV=$(shell uname -a)
ifeq ($(findstring WSL, $(OS_ENV)), WSL)
SYSLIB += -liconv
endif

这个是针对WSL的环境的编译选项。

@qazwsxedckll
Copy link
Contributor Author

windows的docker desktop,启动任何一个镜像,uname -a出来,也会带有WSL的字样,但是不代表有iconv,会导致编译不过。并不是只有wsl才会uname -a出来WSL。

@zhengshuxin
Copy link
Member

有的Linux上的 glibc 包含有 iconv,有的不包含,需要单独引入,目前还没有更好的办法在 Makefile 中探测到底属于哪种情形,所以只能是粗略地通过 uname -a 来加以区分。

@babA409866
Copy link

babA409866 commented May 2, 2023

可以直接安装个iconv就好了。apt-get install libiconv-dev。

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