compiler: use -lpthread during building v itself.

pull/4987/head
Delyan Angelov 2020-05-22 08:36:56 +03:00
parent 27644333a8
commit 7a4f26ac4f
4 changed files with 9 additions and 2 deletions

View File

@ -292,7 +292,7 @@ jobs:
- name: v.c can be compiled and run - name: v.c can be compiled and run
run: | run: |
./v -os cross -o /tmp/v.c cmd/v ./v -os cross -o /tmp/v.c cmd/v
gcc -g -std=gnu11 -w -o v_from_vc /tmp/v.c -lm gcc -g -std=gnu11 -w -o v_from_vc /tmp/v.c -lm -lpthread
ls -lart v_from_vc ls -lart v_from_vc
./v_from_vc version ./v_from_vc version
- name: v_win.c can be compiled and run - name: v_win.c can be compiled and run

View File

@ -48,7 +48,7 @@ ifdef WIN32
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o v.exe $(TMPVC)/$(VCFILE) $(LDFLAGS) $(CC) $(CFLAGS) -g -std=c99 -municode -w -o v.exe $(TMPVC)/$(VCFILE) $(LDFLAGS)
./v.exe self ./v.exe self
else else
$(CC) $(CFLAGS) -g -std=gnu11 -w -o v $(TMPVC)/$(VCFILE) $(LDFLAGS) -lm $(CC) $(CFLAGS) -g -std=gnu11 -w -o v $(TMPVC)/$(VCFILE) $(LDFLAGS) -lm -lpthread
ifdef ANDROID ifdef ANDROID
chmod 755 v chmod 755 v
endif endif

View File

@ -3,6 +3,8 @@
// that can be found in the LICENSE file. // that can be found in the LICENSE file.
module sync module sync
#flag -lpthread
// [init_with=new_mutex] // TODO: implement support for this struct attribute, and disallow Mutex{} from outside the sync.new_mutex() function. // [init_with=new_mutex] // TODO: implement support for this struct attribute, and disallow Mutex{} from outside the sync.new_mutex() function.
[ref_only] [ref_only]
pub struct Mutex { pub struct Mutex {

View File

@ -192,6 +192,11 @@ pub fn parse_files(paths []string, table &table.Table, pref &pref.Preferences, g
return q.parsed_ast_files return q.parsed_ast_files
} }
} }
if false {
// TODO: remove this; it just prevents warnings about unused time and runtime
time.sleep_ms(1)
println(runtime.nr_cpus())
}
// /////////////// // ///////////////
mut files := []ast.File{} mut files := []ast.File{}
for path in paths { for path in paths {