[LTP] 答复: [PATCH] open_posix_testsuite: Fix compilation issues

Zouwei (Samuel) zou_wei@huawei.com
Thu Mar 19 02:26:13 CET 2020


Hi Cyril,

So we need to add -pthread to both CFLAGS and LDFLAGS to avoid the compilation and linking problem?

Best Regards
Zou Wei

-----邮件原件-----
发件人: Cyril Hrubis [mailto:chrubis@suse.cz] 
发送时间: 2020年3月18日 4:52
收件人: Zouwei (Samuel) <zou_wei@huawei.com>
抄送: ltp@lists.linux.it
主题: Re: [LTP] [PATCH] open_posix_testsuite: Fix compilation issues

Hi!
> Fix compilation issues:
> 1. Add the '-lpthread -lrt -lm' config into LDFLAGS

Just linking with -lpthread is not correct way how to compile pthread programs on Linux, we have to add -pthread to both CLFAGS and LDFLAGS.

I guess that we should also default to the output of getconf for pthread CFLAGS and LDFLAGS if available[1]. Unfortunately it looks like this is not implemented on Linux yet.

So if getconf fails we will have to probably fallback to per-OS table of CFLAGS and LDFLAGS.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html#tagtcjh_25

--
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list