I have a somewhat unusual use case and I'm having trouble getting
everything to link properly.
I'm writing an assignment for a course I'm teaching and I've
written the skeleton code in D, and students are going to
implement one function in C, which my skeleton code will call.
The tricky part is that the lab machines that the students will
be using don't have a D compiler installed (they're Fedora
machines, and I didn't see a dmd package in their repos, or I
would have asked the admins to install it).
I plan to distribute compiled .o files for all the d modules,
along with a static libphobos. The students can compile their C
file, and then link everything together. I haven't tested it on
the linux machines yet, but developing it on my mac, I'm getting
undefined symbols for libc and pthread functions from libphobos:
```
"_thread_suspend", referenced from:
__D4core6thread8osthread7suspendFNbNiCQBjQBhQBd6ThreadZb in
libphobos2.a(osthread_8db_302.o)
(maybe you meant: _thread_suspendAll)
"_tmpfile", referenced from:
__D3std5stdio4File7tmpfileFNfZSQBcQBbQy in
libphobos2.a(stdio_d42_180.o)
"_toupper", referenced from:
__D2rt6config16rt_envvarsOptionFNbNiAyaMDFNbNiQkZQnZQq in
libphobos2.a(config_94b_6c3.o)
"_waitpid", referenced from:
__D4core8internal2gc2os8wait_pidFNbNiibZEQBmQBkQBeQBe11ChildStatus in libphobos2.a(os_610_351.o)
```
So I think I need to specify that I want to explicitly include
libc when I link it. `-lc` didn't seem to work. Anyone how the
right way to do so?
Here are the steps I'm doing. I'll compile all the D stuff
myself, and distribute the .o files with my assignment, and
they'll just be doing the C compilation and linking steps.
```
dmd -c -I=source -of=build/simpledisplay.o
source/arsd/simpledisplay.d
dmd -c -I=source -of=build/color.o source/arsd/color.d
dmd -c -I=source -of=app.o source/app.d
clang -c -o source/assignment1.o source/assignment1.c
ld build/*.o -L. -lphobos2 -o build/executable
```