Tried some solutions I found online. The issue got fixed after using entitlements file during code signing process. The entitlements used were to disable the library validation.
I tried looking system logs in console.app, tried 'log show' to look for error with my app name, tried using dynamic linker (dyld) but I am completely new to these things so I have no idea from where to start.
How can I find the exact error? How can I figure out which library is causing the error?