I am building my C++ program, at linking stage I am getting this warning message:
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libasan.so.6: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libasan.so.6: warning: the use of `tempnam' is dangerous, better use `mkstemp'
Actually huge number of the above duplicated messages. I saw posting discussing the mechanism of this warning. My questions is how do I fix this warning from a programmer point of view, or as a sysadmin. There are many similar postings. My OS is Ubuntu 22.04.2 LTS, 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux.
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
No where in my code I used the tempnam or tmpnam_r function. Must be one of the included code indirectly used the two functions.
My warning messages were gong after the following operations:
My problem may be related to my system update. Another possibility might be related to some my dependency package used -fsanitize=address option during configuration. Now all of my dependencies were rebuild without this gcc compiler option. Still my answer does not nail the exact source of the problem. Hope can be some help to people in my situation.