--- a/SConstruct
+++ b/SConstruct
@@ -37,6 +37,7 @@ import glob
 import imp         # for imp.find_module('gps'), imp deprecated in 3.4
 import operator
 import os
+import pickle
 import platform
 import re
 # replacement for functions from the commands module, which is deprecated.
@@ -158,6 +159,10 @@ def filtered_spawn(sh, escape, cmd, args
 # source changes.
 Decider('timestamp-match')
 
+# support building with various Python versions.
+sconsign_file = '.sconsign.{}.dblite'.format(pickle.HIGHEST_PROTOCOL)
+SConsignFile(sconsign_file)
+
 # Start by reading configuration variables from the cache
 opts = Variables('.scons-option-cache')
 
@@ -386,7 +391,6 @@ if env['isync']:
     env['ublox'] = True
 
 opts.Save('.scons-option-cache', env)
-env.SConsignFile(".sconsign.dblite")
 
 for (name, default, help) in pathopts:
     env[name] = env.subst(env[name])
