Hi,
uname -a on box 1 gives
FreeBSD xxxxx 12.1-RELEASE-p6 FreeBSD 12.1-RELEASE-p6 GENERIC amd64
and on box 2 gives
FreeBSD xxxxx 12.1-RELEASE-p8 FreeBSD 12.1-RELEASE-p8 GENERIC amd64
When C++ code is compiled on box 1 using g++8, the resultant binary runs fine. The same code when compiled on box 2 using g++8, the resultant binary core dumps, that too upon start. Analyzing the core file using gdb points to a function in unused code - i mean no function/code calls it but is part of the library. No change to the code. But when the same code is compiled using the clang compiler, the resultant binary doesn't core dump.
So box 2 was upgraded to 12.2 and the uname -a now gives
FreeBSD xxxxx 12.2-RELEASE FreeBSD 12.2-RELEASE r366954 GENERIC amd64
The same pattern is seen, i.e works with clang compiled code and core dumps with g++8.
g++7 was also used and the result is the same - dumps core.
Another problem is, the code contains socket related system calls. When compiled with g++, the htons used to assign the port works fine. 443 is shown as 443 both in netstat and sockstat commands. But when compiled with clang, the ports are different. I understand the randomness of the ports is due to the fact that we have given permission only for 443 via sysctl.conf. The question is why the difference using clang and g++? How do i overcome the ports issue - critical to run the program.
--Thanks
uname -a on box 1 gives
FreeBSD xxxxx 12.1-RELEASE-p6 FreeBSD 12.1-RELEASE-p6 GENERIC amd64
and on box 2 gives
FreeBSD xxxxx 12.1-RELEASE-p8 FreeBSD 12.1-RELEASE-p8 GENERIC amd64
When C++ code is compiled on box 1 using g++8, the resultant binary runs fine. The same code when compiled on box 2 using g++8, the resultant binary core dumps, that too upon start. Analyzing the core file using gdb points to a function in unused code - i mean no function/code calls it but is part of the library. No change to the code. But when the same code is compiled using the clang compiler, the resultant binary doesn't core dump.
So box 2 was upgraded to 12.2 and the uname -a now gives
FreeBSD xxxxx 12.2-RELEASE FreeBSD 12.2-RELEASE r366954 GENERIC amd64
The same pattern is seen, i.e works with clang compiled code and core dumps with g++8.
g++7 was also used and the result is the same - dumps core.
Another problem is, the code contains socket related system calls. When compiled with g++, the htons used to assign the port works fine. 443 is shown as 443 both in netstat and sockstat commands. But when compiled with clang, the ports are different. I understand the randomness of the ports is due to the fact that we have given permission only for 443 via sysctl.conf. The question is why the difference using clang and g++? How do i overcome the ports issue - critical to run the program.
--Thanks