in main.c, you have this code
if (IS_ENABLED(CONFIG_BT_NUS_SECURITY_ENABLED)) {
err = bt_conn_auth_cb_register(&conn_auth_callbacks);
if (err) {
printk("Failed to register authorization callbacks.\n");
return;
}
err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks);
if (err) {
printk("Failed to register authorization info callbacks.\n");
return;
}
}but if you set CONFIG_BT_NUS_SECURITY_ENABLED=n in the prj.conf file, then there are #defines that will prevent the definition of the function conn_auth_info_callbacks(). This section of the code uses the runtime macro IS_ENABLED() which still compiles the code but just doesn't run it. As conn_auth_info_callbacks() is no longer defined, this code can no longer be compiled and fails (if CONFIG_BT_NUS_SECURITY_ENABLED=n).
To fix, jus change them to #defines
#ifdef CONFIG_BT_NUS_SECURITY_ENABLED
err = bt_conn_auth_cb_register(&conn_auth_callbacks);
if (err) {
printk("Failed to register authorization callbacks.\n");
return;
}
err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks);
if (err) {
printk("Failed to register authorization info callbacks.\n");
return;
}
#endif