'Issue executing after Compiling protobuf-3.6.1

am running an application which requires it to be 2byte structure padded , this application uses open-simulation-interface-3.2.0 , protobuf 3.6.1

on the windows side application works fine with libraries compiled with /zp2 option but the same does not work for Linux.

Am using the below cmake command to build protobuf

sudo cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=${Libs_folder}/output/protobuf-3.6.1/Debug -DCMAKE_PREFIX_PATH=${Libs_folder}/output/protobuf-3.6.1/Debug -DCMAKE_CXX_FLAGS="-std=c++11 -fPIC -fpack-struct=2" -Dprotobuf_BUILD_TESTS=OFF ../..

compilation of the protobuf source code will not cause issue but the ./protoc executable generated will give segmentation fault(core dumped)

please help!!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source