Astersik code customization

Few months back I installed freepbx on one of my office servers and since then pbx is working great. Now there is a requirement to make a minor change in App_AMD.c file of Asterisk. When I compile asterisk with my changes and overwrite which came with freepbx then it gives me following error-
“Module ‘’ was not compiled with the same compile-time options as this version of Asterisk.”

Freepbx installed asterisk 10.12.0 and I am compiling code from same branch.

What is recommended way to make customization in asterisk code when asterisk was originally installed by freepbx?

Thanks in advanced.

You need to rebuild all of Asterisk, not just that module. Once you do this you need to be careful not to run and of the update scripts.

If you need to customize sometimes it is easier not to use the distro and to bare metal install.

Thanks for response.

If I rebuild everything then those modules which are not included in asterisk code but were installed by freepbx would start complaining same thing.
Or there is no module which freepbx installs but which is not present in asterisk code.

FreePBX does not install any custom Asterisk modules.

Isn’t a custom module?

Its a module we submitted back to Asterisk last year.