Re: Libc functions undefined when linking

2022-01-05 Thread Tejas via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 16:14:02 UTC, Ben Jones wrote: On Wednesday, 5 January 2022 at 03:38:54 UTC, Tejas wrote: On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote: The tricky part is that the lab machines that the students will be using don't have a D compiler installed (the

Re: Libc functions undefined when linking

2022-01-05 Thread Ben Jones via Digitalmars-d-learn
On Wednesday, 5 January 2022 at 03:38:54 UTC, Tejas wrote: On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote: 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

Re: Libc functions undefined when linking

2022-01-04 Thread Tejas via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote: 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).

Re: Libc functions undefined when linking

2022-01-04 Thread Ben Jones via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 21:34:46 UTC, Adam D Ruppe wrote: On Tuesday, 4 January 2022 at 21:22:26 UTC, Ben Jones wrote: * frame #0: 0x That's null, meaning the library wasn't loaded. simpledisplay actually doesn't need -lX11 since it always dynamic loads the libraries.

Re: Libc functions undefined when linking

2022-01-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 21:22:26 UTC, Ben Jones wrote: * frame #0: 0x That's null, meaning the library wasn't loaded. simpledisplay actually doesn't need -lX11 since it always dynamic loads the libraries. Normally it throws when this fails though instead of keeping nu

Re: Libc functions undefined when linking

2022-01-04 Thread Ben Jones via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 20:28:00 UTC, Ben Jones wrote: On Tuesday, 4 January 2022 at 19:14:04 UTC, Adam D Ruppe wrote: [...] Crashes on `display = XOpenDisplay(displayName);` : ``` * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) * fra

Re: Libc functions undefined when linking

2022-01-04 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote: 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). Just for the record, while the official Fedora repos don't have dmd

Re: Libc functions undefined when linking

2022-01-04 Thread Ben Jones via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 19:14:04 UTC, Adam D Ruppe wrote: On Tuesday, 4 January 2022 at 19:10:25 UTC, Ben Jones wrote: All good, except now simpledisplay is segfaulting on XDisplayConnection.get again run it in the debugger; do a -g build and run it in gdb or lldb and do check the exact

Re: Libc functions undefined when linking

2022-01-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 19:10:25 UTC, Ben Jones wrote: All good, except now simpledisplay is segfaulting on XDisplayConnection.get again run it in the debugger; do a -g build and run it in gdb or lldb and do check the exact line it is on. could be that the Xlib things didn't dynamicall

Re: Libc functions undefined when linking

2022-01-04 Thread Ben Jones via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 18:45:37 UTC, Ben Jones wrote: On Tuesday, 4 January 2022 at 18:37:25 UTC, Adam D Ruppe wrote: On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote: clang -c -o source/assignment1.o source/assignment1.c you might have better luck just telling clang to link

Re: Libc functions undefined when linking

2022-01-04 Thread Ben Jones via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 18:37:25 UTC, Adam D Ruppe wrote: On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote: clang -c -o source/assignment1.o source/assignment1.c you might have better luck just telling clang to link it too like clang source/assignment1.o -lphobos2 build/*.o

Re: Libc functions undefined when linking

2022-01-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote: clang -c -o source/assignment1.o source/assignment1.c you might have better luck just telling clang to link it too like clang source/assignment1.o -lphobos2 build/*.o # etc since there's a bunch of default search paths and libs etc

Re: Libc functions undefined when linking

2022-01-04 Thread Ali Çehreli via Digitalmars-d-learn
On 1/4/22 10:13 AM, Ben Jones wrote: > So I think I need to specify that I want to explicitly include libc when > I link it. `-lc` didn't seem to work. Did you add -lc and -lpthread on the linker line? > ld build/*.o -L. -lphobos2 -o build/executable Ali

Re: Libc functions undefined when linking

2022-01-04 Thread Ben Jones via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 18:26:41 UTC, Ali Çehreli wrote: On 1/4/22 10:13 AM, Ben Jones wrote: > So I think I need to specify that I want to explicitly include libc when > I link it. `-lc` didn't seem to work. Did you add -lc and -lpthread on the linker line? > ld build/*.o -L. -lphobos2

Libc functions undefined when linking

2022-01-04 Thread Ben Jones via Digitalmars-d-learn
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