I modified my code by taking just one variable in a procedure and making it global as in your example. I put the global variable in the declaration section at the top of both the specification and body and they compiled fine.

But when I attempted to set the global variable in the procedure like you did here:

begin
g_variable1 := p_var1;

and then re-compiled the spb file, I got the following error msg:

PLS-00371: at most one declaration for 'G_VARIABLE1' is permitted in the declaration section.

Since I've declared this global variable only once in the specification and once in the package body, I do not know what this error msg is referring to.