HuoLanguage / huo

interpreted language written in C
MIT License
213 stars 21 forks source link

Make not finding pthread #6

Closed TheLoneWolfling closed 8 years ago

TheLoneWolfling commented 8 years ago

Simple git clone and make:

twotothe@Beryllium:~/afl/huo$ make clean
rm -f -- .*.mk *.o & rm -f & rm -f ./execution_functions/*.o
twotothe@Beryllium:~/afl/huo$ make
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .huo.mk -MP -MD -MF huo.o -MP  -c -o huo.o huo.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .constants.mk -MP -MD -MF constants.o -MP  -c -o constants.o constants.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .base_util.mk -MP -MD -MF base_util.o -MP  -c -o base_util.o base_util.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .core_functions.mk -MP -MD -MF core_functions.o -MP  -c -o core_functions.o core_functions.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .apply_core_function.mk -MP -MD -MF apply_core_function.o -MP  -c -o apply_core_function.o apply_core_function.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/populate_each_function.mk -MP -MD -MF .populate_each_function.mk -MP  -c -o execution_functions/populate_each_function.o execution_functions/populate_each_function.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/populate_reduce_function.mk -MP -MD -MF .populate_reduce_function.mk -MP  -c -o execution_functions/populate_reduce_function.o execution_functions/populate_reduce_function.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/parallel_execution.mk -MP -MD -MF .parallel_execution.mk -MP  -c -o execution_functions/parallel_execution.o execution_functions/parallel_execution.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/for_each.mk -MP -MD -MF .for_each.mk -MP  -c -o execution_functions/for_each.o execution_functions/for_each.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/for_loop.mk -MP -MD -MF .for_loop.mk -MP  -c -o execution_functions/for_loop.o execution_functions/for_loop.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/map_array.mk -MP -MD -MF .map_array.mk -MP  -c -o execution_functions/map_array.o execution_functions/map_array.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/reduce.mk -MP -MD -MF .reduce.mk -MP  -c -o execution_functions/reduce.o execution_functions/reduce.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/read_file.mk -MP -MD -MF .read_file.mk -MP  -c -o execution_functions/read_file.o execution_functions/read_file.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/let_binding.mk -MP -MD -MF .let_binding.mk -MP  -c -o execution_functions/let_binding.o execution_functions/let_binding.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/reduce_ast.mk -MP -MD -MF .reduce_ast.mk -MP  -c -o execution_functions/reduce_ast.o execution_functions/reduce_ast.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execution_functions/if_block.mk -MP -MD -MF .if_block.mk -MP  -c -o execution_functions/if_block.o execution_functions/if_block.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .build_array.mk -MP -MD -MF build_array.o -MP  -c -o build_array.o build_array.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .tokenizer.mk -MP -MD -MF tokenizer.o -MP  -c -o tokenizer.o tokenizer.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .process_defs.mk -MP -MD -MF process_defs.o -MP  -c -o process_defs.o process_defs.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .store_defs.mk -MP -MD -MF store_defs.o -MP  -c -o store_defs.o store_defs.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .parser.mk -MP -MD -MF parser.o -MP  -c -o parser.o parser.c
cc -g -std=c99 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .execute.mk -MP -MD -MF execute.o -MP  -c -o execute.o execute.c
cc   huo.o constants.o base_util.o core_functions.o apply_core_function.o execution_functions/populate_each_function.o execution_functions/populate_reduce_function.o execution_functions/parallel_execution.o execution_functions/for_each.o execution_functions/for_loop.o execution_functions/map_array.o execution_functions/reduce.o execution_functions/read_file.o execution_functions/let_binding.o execution_functions/reduce_ast.o execution_functions/if_block.o build_array.o tokenizer.o process_defs.o store_defs.o parser.o execute.o   -o huo
execution_functions/parallel_execution.o: In function `parallel_execution':
/home/twotothe/afl/huo/execution_functions/parallel_execution.c:22: undefined reference to `pthread_create'
/home/twotothe/afl/huo/execution_functions/parallel_execution.c:25: undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'huo' failed
make: *** [huo] Error 1

Manually rerunning the failing command with '-lpthread' added works, however:

twotothe@Beryllium:~/afl/huo$ cc   huo.o constants.o base_util.o core_functions.o apply_core_function.o execution_functions/populate_each_function.o execution_functions/populate_reduce_function.o execution_functions/parallel_execution.o execution_functions/for_each.o execution_functions/for_loop.o execution_functions/map_array.o execution_functions/reduce.o execution_functions/read_file.o execution_functions/let_binding.o execution_functions/reduce_ast.o execution_functions/if_block.o build_array.o tokenizer.o process_defs.o store_defs.o parser.o execute.o -lpthread -o huo
twotothe@Beryllium:~/afl/huo$
incrediblesound commented 8 years ago

Hmm, I was worried about this because it "just worked" on my computer. I will try to add the proper lines to the makefile to link pthread.

TheLoneWolfling commented 8 years ago

Thank you!

incrediblesound commented 8 years ago

OK, Makefile updated.

TheLoneWolfling commented 8 years ago

Fixed, thank you!