00:49
<
daurnimator >
oats: looks like you're compiling for freestanding.... but a library you're linking against assumes libc exists.
00:50
<
oats >
yeah, it's supposed to be freestanding, but I guess I need libc
00:51
<
daurnimator >
oats: If you're freestanding.... then there is no OS to provide the functions like `puts`.
00:53
<
daurnimator >
oats: which is to say, those libraries you're linking.... they seem to not be providing things you're using?
00:53
<
oats >
the stdio.s I'm using has a __io_putchar implementation
00:53
<
oats >
and also sets stdout_ptr
00:54
<
daurnimator >
oats: are those concepts from your libc?
00:55
<
oats >
I
*believe* so
00:55
<
oats >
this is the libc I have installed
00:56
<
daurnimator >
oats: how are you linking to that?
00:56
<
daurnimator >
(I don't see it in your zig build line? or I'm blind...)
00:57
<
oats >
I formatted the command nicely
00:57
<
daurnimator >
oats: ah. the libc.a wasn't in the one you pasted previously
00:59
<
daurnimator >
oats: I'm not sure if you should use `--libc` argument..... this isn't an area I've used yet.
00:59
<
oats >
ah, my apologies :<
00:59
<
oats >
I've fiddled with the flags a few times
01:00
<
daurnimator >
oats: every time I've seen andrewrk talk about it he seems to say `--library c`.
01:00
<
oats >
--libc [file] Provide a file which specifies libc paths
01:00
<
oats >
how would I go about finding/making this file
01:00
<
daurnimator >
so I'd add that. and then assume it figures it out from your --library-path
01:00
* daurnimator
is guessing here.
01:00
<
oats >
I'll try stuff \o/
01:02
<
oats >
Cannot link against libc for non-native OS 'freestanding' without providing a libc installation file.
01:02
<
oats >
zig libc --help
01:04
<
daurnimator >
oats: ah. I guess try writing up a libc file for your target using output of `zig libc` as a template?
01:16
<
oats >
the only directory I can find for sure is include_dir
01:17
<
oats >
no dice on crt_dir, lib_dir, static_lib_dir, or dynamic_linker_path
01:17
<
oats >
like having a dynamic linker is useful here :P
01:18
<
oats >
actually, maybe crtbegin.o
01:18
<
oats >
uh, for static_lib_dir
01:25
mnoronha has joined #zig
01:34
redj has quit [Ping timeout: 255 seconds]
01:45
redj has joined #zig
01:50
scientes has joined #zig
03:19
<
daurnimator >
Is this meant to work?? error: expected type '[*c]const u8', found '(null)'
03:21
<
daurnimator >
How do I pass a null pointer to a C library that takes a [*c]const u8?
03:22
<
daurnimator >
just `0` I guess? seems to compile. that's sorta scary.....
03:37
mnoronha has quit [Ping timeout: 244 seconds]
03:50
mnoronha has joined #zig
03:59
noonien has quit [Quit: Connection closed for inactivity]
04:32
a_chou has joined #zig
04:34
a_chou has quit [Client Quit]
05:01
scientes has quit [Remote host closed the connection]
05:24
mnoronha has quit [Ping timeout: 240 seconds]
05:25
mnoronha has joined #zig
05:31
scientes has joined #zig
05:40
mnoronha has quit [Ping timeout: 245 seconds]
06:07
mikdusan has joined #zig
06:10
mikdusan has quit [Client Quit]
06:18
Zaab1t has joined #zig
06:19
mnoronha has joined #zig
06:28
mnoronha has quit [Ping timeout: 255 seconds]
06:28
mnoronha has joined #zig
06:32
scientes has quit [Ping timeout: 255 seconds]
07:21
brakmic has joined #zig
07:22
mnoronha has quit [Ping timeout: 245 seconds]
07:22
mnoronha has joined #zig
07:26
brakmic has quit [Ping timeout: 250 seconds]
07:28
mnoronha has quit [Ping timeout: 240 seconds]
07:47
fsateler_ has joined #zig
07:50
fsateler has quit [Ping timeout: 250 seconds]
07:51
Zaab1t has quit [Quit: bye bye friends]
07:53
walac has quit [Ping timeout: 264 seconds]
07:54
walac has joined #zig
08:04
marmotini_ has joined #zig
08:15
brakmic has joined #zig
08:49
brakmic has quit [Remote host closed the connection]
08:52
brakmic has joined #zig
08:56
brakmic has quit [Ping timeout: 255 seconds]
09:01
brakmic has joined #zig
09:08
very-mediocre has joined #zig
09:10
brakmic_ has joined #zig
09:14
brakmic has quit [Ping timeout: 268 seconds]
09:25
brakmic_ has quit []
11:31
kristate has quit [Remote host closed the connection]
12:18
slugmatt_ has joined #zig
12:33
dch has joined #zig
12:35
porky11 has joined #zig
12:46
porky11 has quit [Quit: Leaving]
13:17
Zaab1t has joined #zig
13:20
<
andrewrk >
daurnimator, a function call is not a valid top level declaration
13:20
<
andrewrk >
a comptime block is, however
13:32
Zaab1t has quit [Quit: bye bye friends]
13:49
noonien has joined #zig
13:58
develonepi3 has joined #zig
14:00
kristate has joined #zig
14:04
kristate has quit [Ping timeout: 240 seconds]
14:18
tgschultz has quit [Ping timeout: 252 seconds]
14:19
<
andrewrk >
huh, turns out you can link multiple objects into one object
14:30
__Myst__ has quit [Read error: Connection reset by peer]
14:35
MajorLag has joined #zig
14:40
MajorLag has quit [Ping timeout: 259 seconds]
14:50
<
oats >
andrewrk: good morning. are you able to read over my question from yesterday evening?
14:51
<
andrewrk >
can you repeat it? where did you leave off?
14:51
__Myst__ has joined #zig
14:51
<
oats >
ok, lemme try to condense
14:52
<
oats >
I'm trying to build a binary for my stm32f0discovery arm board
14:52
<
oats >
I'm using the libopencm3 firmware library
14:53
<
oats >
there's the zig file
14:53
<
oats >
there's the build command I'm using
14:53
<
andrewrk >
looks goodf
14:55
<
oats >
when I try to to build, I get these errors
14:55
<
oats >
I don't know where to find those symbols, and I don't think manually trying to lasso in libc is the best path here
14:56
<
oats >
daurnimator pointed me in the direction of `--library c` and `--libc` yesterday, but I was unable to find all the directories I needed to set in the libc paths file
14:56
<
andrewrk >
--library c and --libc are not relevant for freestanding
14:57
<
andrewrk >
your libc.a file seems to depend on other .a files or .o files
14:57
Guest62170 has joined #zig
14:57
Guest62170 is now known as hg
14:58
<
andrewrk >
you might have to define those yourself
14:58
<
oats >
hg: good morning, didn't know you hung out in here :)
14:58
<
andrewrk >
I don't know how newlib works
14:58
<
andrewrk >
but libc on freestanding doesn't make a lot of sense, since it's operating-system abstractions
14:58
<
hg >
oats: indeed :)
14:59
<
hg >
trying to absorb knowledge from those more knowledgeable than I
14:59
<
oats >
newlib is designed for embedded systems
14:59
marmotini_ has quit [Ping timeout: 240 seconds]
14:59
<
oats >
the main thing I want is string printing/formatting :P
14:59
<
andrewrk >
oats, I'm pretty sure you'd have the same question if you were using C
14:59
<
oats >
the stdio.s file I'm using provides an implementation of __io_putchar that uses the serial port
14:59
<
andrewrk >
might be a question for #osdev ("why am I getting undefined symbol _read when using newlib?")
15:00
<
oats >
I may take it to them later then :)
15:00
<
andrewrk >
or you might need to read the newlib docs. you might be missing libs on the build command
15:01
<
andrewrk >
the __aeabi_idiv though, that's a TODO in zig. I can see if there's an implementation available in llvm's compiler_rt to port
15:01
<
andrewrk >
you can always provide it yourself as a workaround
15:02
<
oats >
what is __aeabi_idiv?
15:02
<
oats >
or, how can I found out more about it
15:02
* oats
doesn't have a great grasp of libc or the linker
15:03
<
andrewrk >
it's a function that implements signed division on armv6m for 64 bit integers
15:04
<
andrewrk >
since the architecture isn't capable of doing it in hardware
15:07
<
andrewrk >
actually appears to implement 32 bit signed integer division, not 64
15:13
<
andrewrk >
oats, I'll make you a deal - if you get it down to just the __aeabi_idiv linker error, I'll pause what I'm doing and port it for you
15:14
<
oats >
hah, you're great
15:14
<
oats >
I'm about to start a day of classes, but I'll try to peek at it later today
15:17
raoof has joined #zig
15:30
mnoronha has joined #zig
15:35
mnoronha has quit [Ping timeout: 240 seconds]
15:36
mnoronha has joined #zig
15:39
marmotini_ has joined #zig
15:40
tgschultz has joined #zig
15:56
Zaab1t has joined #zig
16:09
return0e has quit [Remote host closed the connection]
16:10
raoof has quit [Quit: Page closed]
16:12
mnoronha has quit [Ping timeout: 245 seconds]
16:13
return0e has joined #zig
16:17
brakmic has joined #zig
16:21
mnoronha has joined #zig
16:25
brakmic_ has joined #zig
16:26
mnoronha has quit [Ping timeout: 240 seconds]
16:28
brakmic has quit [Ping timeout: 255 seconds]
16:31
Akuli has joined #zig
16:40
Avila has joined #zig
16:51
MajorLag has joined #zig
16:54
tgschultz has quit [Ping timeout: 240 seconds]
16:54
MajorLag is now known as tgschultz
17:06
marmotini_ has quit [Ping timeout: 255 seconds]
17:09
MajorLag has joined #zig
17:11
tgschultz has quit [Ping timeout: 250 seconds]
17:11
MajorLag is now known as tgschultz
17:22
<
daurnimator >
andrewrk: is passing `0` to a function expecting a `[*c]const u8` the intended way to pass null?
17:27
mnoronha has joined #zig
17:27
kristate has joined #zig
17:32
mnoronha has quit [Ping timeout: 245 seconds]
17:32
kristate has quit [Ping timeout: 264 seconds]
17:44
<
andrewrk >
Akuli, the problem is result.allocator = &result.arena.allocator;
17:44
<
Akuli >
i kinda know what the problem is
17:44
<
Akuli >
result.arena is allocated in the stack, so that's an address of a stack variable
17:44
<
Akuli >
but i don't know what's the idiomatic way to write this instead
17:44
<
Akuli >
i guess it's not two init methods?
17:45
<
andrewrk >
after copy elision + an associated issue is resolved, this will either be a compile error or it will work, with "result" being the memory allocated at the callsite
17:45
<
andrewrk >
in the meantime, you'll have to make your init method take a pointer to Thing
17:45
<
Akuli >
how do i call it then?
17:46
<
Akuli >
oo nevermind
17:46
<
Akuli >
var thing: Thing = undefined
17:46
<
Akuli >
makes sense, thanks :)
18:02
mnoronha has joined #zig
18:05
Ichorio has joined #zig
18:21
marmotini_ has joined #zig
18:24
brakmic_ has quit []
18:25
brakmic has joined #zig
18:39
scientes has joined #zig
18:57
mnoronha has quit [Ping timeout: 240 seconds]
19:02
wootehfoot has joined #zig
20:02
bheads has quit [Quit: Konversation terminated!]
20:03
bheads has joined #zig
20:10
very-mediocre has quit [Ping timeout: 256 seconds]
20:32
mnoronha has joined #zig
20:34
wootehfoot has quit [Read error: Connection reset by peer]
20:36
mnoronha has quit [Ping timeout: 268 seconds]
20:46
gunnarahlberg has joined #zig
21:05
Avila has quit [Quit: Leaving]
21:16
Akuli has quit [Quit: Leaving]
21:21
Zaab1t has quit [Quit: bye bye friends]
21:29
kristate has joined #zig
21:33
kristate has quit [Ping timeout: 240 seconds]
21:39
mnoronha has joined #zig
21:44
mnoronha has quit [Ping timeout: 255 seconds]
21:46
hg has quit [Quit: WeeChat 2.4]
21:46
mnoronha has joined #zig
21:51
aiwakura has quit [Quit: Ping timeout (120 seconds)]
21:52
aiwakura has joined #zig
21:55
brakmic has quit [Remote host closed the connection]
21:56
brakmic has joined #zig
21:58
brakmic has quit [Remote host closed the connection]
21:58
brakmic has joined #zig
21:58
Ichorio has quit [Ping timeout: 255 seconds]
22:09
dewf has joined #zig
22:50
mnoronha has quit [Ping timeout: 255 seconds]
22:51
mnoronha has joined #zig
22:52
marmotini_ has quit [Remote host closed the connection]
23:02
mnoronha has quit [Ping timeout: 245 seconds]