diff --git a/compiler/cc.v b/compiler/cc.v
index 393ec89356..37401ed3d6 100644
--- a/compiler/cc.v
+++ b/compiler/cc.v
@@ -120,7 +120,7 @@ fn (v mut V) cc() {
 	}
 	else if v.pref.is_debug {
 		vexe := os.executable()
-		builtin_o_path := '$v_modules_path/vlib/builtin.o'
+		builtin_o_path := '$v_modules_path/cache/builtin.o'
 		if os.file_exists(builtin_o_path) {
 			libs = builtin_o_path
 		} else {
@@ -132,7 +132,7 @@ fn (v mut V) cc() {
 			if imp == 'webview' { continue }
 			
 			imp_path := imp.replace('.', os.PathSeparator)
-			path := 	'$v_modules_path/vlib/${imp_path}.o'
+			path := 	'$v_modules_path/cache/${imp_path}.o'
 			println('adding ${imp_path}.o')
 			if os.file_exists(path) {
 				libs += ' ' + path
diff --git a/compiler/main.v b/compiler/main.v
index 8e1d8df41b..d323365a5a 100644
--- a/compiler/main.v
+++ b/compiler/main.v
@@ -627,7 +627,7 @@ fn (v mut V) add_v_files_to_compile() {
 	for file in v.get_user_files() {
 		mut p := v.new_parser_from_file(file)
 		// set mod so we dont have to resolve submodule
-		if v.pref.build_mode == .build_module && 
+		if v.pref.build_mode == .build_module &&
 			file.contains(v.mod.replace('.', os.PathSeparator)) {
 			p.mod = v.mod
 		}
@@ -802,6 +802,12 @@ fn (v &V) log(s string) {
 }
 
 fn new_v(args[]string) &V {
+	// Create modules dirs if they are missing
+	if !os.dir_exists(v_modules_path) {
+		os.mkdir(v_modules_path)
+		os.mkdir('$v_modules_path${os.PathSeparator}cache')
+	}
+	
 	mut vgen_buf := strings.new_builder(1000)
 	vgen_buf.writeln('module main\nimport strings')
 	
diff --git a/compiler/module_header.v b/compiler/module_header.v
index cc6fbd7f42..9899a8c819 100644
--- a/compiler/module_header.v
+++ b/compiler/module_header.v
@@ -120,8 +120,6 @@ fn (v &V) generate_vh() {
 		}
 		// os.mkdir(os.realpath(dir))
 	}
-	println(path)
-	
 	file := os.create(path) or { panic(err) }
 	// Consts
 	mod_def := if v.mod.contains('.') { v.mod.all_after('.') } else { v.mod }
diff --git a/vlib/os/os.v b/vlib/os/os.v
index fc1ee57e4f..5e5ef8fa83 100644
--- a/vlib/os/os.v
+++ b/vlib/os/os.v
@@ -858,3 +858,13 @@ pub fn print_backtrace() {
 */
 }
 
+pub fn mkdir_all(path string) {
+	mut p := ''
+	for subdir in path.split(os.PathSeparator) {
+		p += os.PathSeparator + subdir
+		if !os.dir_exists(p) {
+			os.mkdir(p)
+		}
+	}
+}	
+