Can we construct a function with (almost) arbitrary compact support? This question contains topological concept. Let $X$ be an arbitrary topological space. Suppose that $K\subset X$ is compact and such that it is the closure of some open set $U\subset X$. Does there exist some continuous function $f \colon X \to \Bbb R$ such that $supp(f) = K$?
 A: No, not necessarily. 
Let $X=\omega_1+1=[0,\omega_1]$ with the order (i.e. 
open interval) topology, where $\omega_1+1$ is the set of all countable ordinals together with the first uncountable ordinal. 
Take any unbounded in $\omega_1$ open set $U$ such that if $K=\overline U$ is its closure (in X), then $X\setminus K$ is also unbounded in $\omega_1$ (more precisely, $\omega_1\setminus K$ is unbounded in $\omega_1$). To be specific, 
let for example $U=\{\lambda+1: \lambda$ is a countable limit ordinal$\}$. Note that the set $V=\{\lambda+2: \lambda$ is a countable limit ordinal$\}$ is open, unbounded in $\omega_1$ and disjoint from $U$, hence $V$ is disjoint from $K$ too. (Note also that $K$ is compact, since it is closed in the compact $X$.) 
Finally use that any real-valued continuous function $g$ on $\omega_1 =[0,\omega_1)$ is constant on a tail, i.e. there is a set $T=[\delta,\omega_1)= \{\alpha:\delta\le\alpha<\omega_1\}$ for some $\delta<\omega_1$ and there is $r\in\Bbb R$ such that $g(\alpha)=r$ for every $\alpha\in T$. 
(As a consequence, any such function can be extended to a continuous function on $\omega_1+1$, and $\omega_1+1$ is well-known to be the Stone-Cech compactification of $\omega_1$: I would think that the proof of this could be found in Engelking's, and in Willard's general topology books, perhaps others too, Munkres, Dugundji). 
Any continuous function $f \colon X \to \Bbb R$ with $f(\alpha)\not=0$ for every $\alpha\in K$ would have to take a constant non-zero value on a tail, and therefore its support would contain a tail $T=[\delta,\omega_1]$ for some $\delta<\omega_1$. But $K$ does not contain a tail (for example $K$ is disjoint from the set $V$, as above). 
