-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compute/fix sum-array-bugs/seg-fault Makefile #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @razvang0307. I made an inline suggestion, but before addressing that, please tell why this is needed. More recent GCC versions (11 and above for sure, maybe even lower) link lpthread
by default.
Does linking cause errors on your system? If so, what GCC and linker versions are you using? Run gcc --version
and ld --version
and paste the first line of the outputs here.
content/chapters/compute/lab/support/sum-array-bugs/seg-fault/Makefile
Outdated
Show resolved
Hide resolved
Hello.
gcc: Attempting to run /usr/bin/ld: sum_array_threads.o: in function `main':
/home/student/git/operating-systems/content/chapters/compute/lab/support/sum-array-bugs/seg-fault/sum_array_threads.c:97: undefined reference to `pthread_create'
/usr/bin/ld: /home/student/git/operating-systems/content/chapters/compute/lab/support/sum-array-bugs/seg-fault/sum_array_threads.c:105: undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: sum_array_threads] Error 1 The same happens if when appending The environment in which I worked/tested was the qcow2/ARM virtual machine), which was posted on Teams as an answer to the first question on the "Technical Support" channel of the Operating Systems team, emulated via I don't see any reason for the Makefile to be dependant on what |
Yup, you're right. And thanks for the info about your system, now it makes more sense. To merge this, please squash the 2 commits and then add a summary of the problem that this commit is solving to the commit description (such as "GCC 9.3 doesn't link against To do so, pull the latest commit to your local branch with |
accordingly is required Signed-off-by: Razvan Gabriel <[email protected]>
69587ec
to
a207a28
Compare
The commits have been squashed, thank you for providing the necessary commands and for guiding me through this process. |
Add
-pthread
to LDFLAGS when compiling using<pthread.h>
.