  We prove -under certain conditions (local-global compatibility and vanishing
of integral cohomology), a generalization of a theorem of Galatius and
Venkatesh. We consider the case of GL(N) over a CM field and we relate the
localization of penultimate non vanishing cuspidal cohomology group for a
locally symmetric space to the Selmer group of the Tate dual of the adjoint
representation. More precisely we construct a Hecke-equivariant injection from
the divisible group associated to the first fundamental group of a derived
deformation ring to the Selmer group of the twisted dual adjoint motive with
divisible coefficients and we identify its cokernel as its first
Tate-Shafarevich group. Actually, we also construct similar maps for higher
homotopy groups with values in exterior powers of Selmer groups, although with
less precise control on their kernel and cokernel. We generalize this to Hida
families as well.
