ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<andrewrk> develonepi3, did you get it working?
<develonepi3> andrewrk, The cmake ../ went okay then make I got zig in the build folder. I then did a sudo make install and I got a bin & lib folders. I set PATH to /home/vidal/testbuilds/ultibozig/zig-0.3.0+98869edb/build/bin
<develonepi3> andrewrk, How do you if the binary download works?
adrusi has quit [Ping timeout: 272 seconds]
adrusi_ has joined #zig
scientes has quit [Read error: Connection reset by peer]
scientes has joined #zig
_whitelogger has joined #zig
<andrewrk> the sudo is not needed
<andrewrk> I just tested your workflow and it worked for me
<develonepi3> andrewrk, this zig build-obj -isystem ../../include/ -isystem /usr/lib/arm-none-eabi zigmain.zig creates zigmain.o. Then objdump -d zigmain.o > zigmain.txt. zigmain.o: file format elf64-x86-64
<andrewrk> develonepi3, you need --target-arch armv8 and --target-os freestanding
scientes has quit [Remote host closed the connection]
scientes has joined #zig
<develonepi3> andrewrk, zig build-obj -isystem ../../include/ -isystem /usr/include/x86_64-linux-gnu/ -isystem /usr/lib/arm-none-eabi --target-arch armv8 --target-os freestanding zigmain.zig, Both --target-arch armv7 & --target-arch armv8 note: 'gnu/stubs-32.h' file not found. I believe ultibo is armv7
scientes has quit [Ping timeout: 245 seconds]
companion_cube has quit [Remote host closed the connection]
andrewrk has quit [Ping timeout: 250 seconds]
andrewrk has joined #zig
_whitelogger has joined #zig
schme245 has joined #zig
schme245 has quit [Remote host closed the connection]
schme245 has joined #zig
schme245 has quit [Read error: Connection reset by peer]
scientes has joined #zig
kristate_ has joined #zig
kristate has quit [Ping timeout: 264 seconds]
kristate_ has quit [Remote host closed the connection]
scientes has quit [Ping timeout: 255 seconds]
kristate has joined #zig
marmotini_ has joined #zig
kristate has quit [Remote host closed the connection]
kristate has joined #zig
return0e has joined #zig
return0e_ has quit [Ping timeout: 244 seconds]
Zaab1t has joined #zig
Zaab1t has quit [Remote host closed the connection]
_whitelogger has joined #zig
kristate has quit [Remote host closed the connection]
marmotini_ has quit [Ping timeout: 245 seconds]
companion_cube has joined #zig
tgschultz has quit [Ping timeout: 264 seconds]
hgst has joined #zig
dewf has joined #zig
tgschultz has joined #zig
companion_cube has quit [Quit: WeeChat 2.3]
gamester has joined #zig
return0e has quit [Ping timeout: 245 seconds]
return0e has joined #zig
<gamester> Andrew, I'm excited for your pull request "first class support for compiling C code". I can use that!
darithorn has joined #zig
Akuli has joined #zig
return0e has quit [Read error: Connection reset by peer]
<andrewrk> gamester, oh yes you can. I don't think people realize yet how important this is going to be
return0e has joined #zig
<andrewrk> I just finished testing on Windows, just going to polish up the branch a bit and then I'll merge it
<hgst> sounds awesome
<andrewrk> once we are able to build libc from source for the various targets (https://github.com/ziglang/zig/issues/514) zig will be able to build any C library from source, with no system dependencies, *for any target*
<hgst> that'd be epic
<andrewrk> the zig package manager will double as a cross compilation environment
<hgst> oooh
<dec05eba> how would it work with runtime library dependency libnss or whatever it's called which is used for dns resolving? gcc at least opens it at runtime with dlopen
<andrewrk> dec05eba, you'll be able to target glibc if you want. the default will be targeting a static libc
<andrewrk> in which case libnss or whatever just won't work. if you don't need it, that's a great option
<andrewrk> IMO it was pretty unfortunate design to make it work that way, but here we are
<andrewrk> zig will have the startup code for all the libc's that are available to target
<nbjoerg> nothing about gcc
<nbjoerg> nss and the dlopen hack is pure glibc
<dec05eba> ah nice
<andrewrk> I figured out how to make @cImport work with --cache on
<andrewrk> that feature itself isn't super important; but it's the same mechanism that the self hosted compiler will be using to watch for changes
<andrewrk> gamester, merged
<andrewrk> you can build from source or wait ~2 hours for CI to make the new build available on ziglang.org/download
fsateler_ has joined #zig
forgot-password has joined #zig
<forgot-password> Is it correct that a union with only one member will not have a tag at runtime?
fsateler has quit [Ping timeout: 250 seconds]
<forgot-password> Even if the union has a tag type declared
wootehfoot has joined #zig
<andrewrk> forgot-password, for non-extern, non-packed unions, that is not guaranteed. zig reserves the right to put extra data there for safety checking purposes
fsateler_ has quit [Quit: ZNC 1.7.2+deb1 - https://znc.in]
<andrewrk> in release-fast builds that is correct, zig will not put a tag in a union(enum)
<andrewrk> likewise an enum with only 1 field is a 0-bit type
fsateler has joined #zig
<develonepi3> andrewrk, Some of the options cause errors using the x86_64 zig binaries. --target-environ gnueabihf --target-os freestanding --target-arch armv7 --target-arch armv8 https://github.com/develone/Ultibo_Projects/blob/master/ultibo_zig/notesforzig.txt lines 24-43 for the errors I get using the zig binaries on a Ubuntu 16. x86_64 This cmd does create a zigmain.o zig build-obj -isystem ../../include/ -isystem /usr/include/x86_64-linux-gnu/ -isystem
<develonepi3> /usr/lib/arm-none-eabi zigmain.zig
<andrewrk> develonepi3, I should perhaps change to mimic clang's `-target` option. Currently you have to give all 3 target options
forgot-password has quit [Ping timeout: 246 seconds]
<andrewrk> what are you trying to do?
schme245 has joined #zig
Zaab1t has joined #zig
forgot-password has joined #zig
<forgot-password> Thanks, andrewrk
forgot-password has quit [Client Quit]
darithorn has quit [Remote host closed the connection]
hgst is now known as hg
Zaab1t has quit [Quit: bye bye friends]
dewf has quit [Quit: Leaving]
Akuli has quit [Quit: Leaving]
<gamester> andrewrk: Excellent, it's working well.
<andrewrk> gamester, beautiful
<andrewrk> if you're using the zig build system, you can take advantage of it as well
<andrewrk> here's an example of building a pure C library with zig build: https://github.com/andrewrk/liblaxjson/blob/zig-build/build.zig
<gamester> yeah I'm using build.zig
<gamester> I'm using some header-only/single file C libs, which I now compile with zig
dewf has joined #zig
<mouldysammich> hey, im trying to run a helloworld_c.zig from the docs section importing a c header file, but its failing as libgcc_s.so.1 isnt found, im on opensuse anyone had similar issues?
<andrewrk> hi mouldysammich
<andrewrk> can you link a paste with the command you're running and the full output? and what zig version?
<mouldysammich> sure thing, its the latest build on the site from master, and the output and command are here: https://paste.redbrick.dcu.ie/udebunogal.rb
<andrewrk> mouldysammich, can I see the output of `zig libc` ?
<andrewrk> this is an example of a problem that https://github.com/ziglang/zig/issues/514 will fix
<andrewrk> but we're not there yet, so let's see if I can help you work around this :)
<mouldysammich> http://paste.debian.net/1070124/ here is the zig libc output
<mouldysammich> oh wow, thats an exciting issue
<andrewrk> mouldysammich, hmm I'm going to have to boot up an opensuse docker image and poke around
<andrewrk> what version of opensuse is this?
hg has quit [Quit: WeeChat 2.4]
<mouldysammich> im running it on tumbleweed theres a docker image here https://hub.docker.com/r/opensuse/tumbleweed/
<andrewrk> mouldysammich, here's an issue you can subscribe to if you wish: https://github.com/ziglang/zig/issues/2011
<mouldysammich> cool, thanks for your time!
<dec05eba> what do you get when you run ls /usr/lib/libgcc* ?
<dec05eba> what do you get when you run ls /usr/lib/libgcc*
<andrewrk> no problem. until that's fixed, your options are: * use a different linux distro or windows or macos, or * avoid using --library c
wink_ has joined #zig
<andrewrk> if you are so inclined as to try to build from source and contribute a fix, I would be happy to guide you
<mouldysammich> dec05eba: nothing in /usr/lib and in /usr/lib64 its libgccpp.so.1.3.1
<mouldysammich> andrewrk: id be interested in at least making an attempt at a fix, what do you think needs to be changed in link.cpp ?
<andrewrk> dec05eba, if I were troubleshooting it, I would start with `strace cc hello_world.c` and find the part where it invokes the linker and see what args it uses
<andrewrk> mouldysammich, if you try that zig command again and use `--verbose-link` you can see the linker command it tried to run
<andrewrk> you can replace `lld` with `ld` which is your system linker and it should give a similar error
<andrewrk> if you can find the correct arguments to pass to `ld` then you have found the fix
<andrewrk> you can use that strace thing I just mentioned above for a hint
<dec05eba> I remember having issues on opensuse when compiling regular c program as well (using my build system). opensuse seems to use different paths to compiler library files than many other distros
<dec05eba> didn't have any issue on arch, ubuntu, debian or nixos
schme245 has quit [Remote host closed the connection]
wootehfoot has quit [Read error: Connection reset by peer]
<mouldysammich> andrewrk: hey, i found a working collection of flags, although i have no idea how to edit link.cpp to fix it. /usr/lib64/gcc/x86_64-suse-linux/8/collect2 -plugin /usr/lib64/gcc/x86_64-suse-linux/8/liblto_plugin.so -plugin-opt=/usr/lib64/gcc/x86_64-suse-linux/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccSOfwZ9.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
<mouldysammich> -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib64/gcc/x86_64-suse-linux/8/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/8/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/8/crtbegin.o -L/usr/lib64/gcc/x86_64-suse-linux/8 -L/usr/lib64/gcc/x86_64-suse-linux/8/../../../../lib64
<mouldysammich> -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/8/../../.. /tmp/ccwSYMjA.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib64/gcc/x86_64-suse-linux/8/crtend.o /usr/lib64/gcc/x86_64-suse-linux/8/../../../../lib64/crtn.o
<mouldysammich> whoops sorry
<andrewrk> mouldysammich, can I see that as a link to a paste? in case anything got cut off
<mouldysammich> yeah that is an old paste, im having weird problems with stuff right now im gonna reboot and ill brb
<andrewrk> I have a feeling it might be as simple as the -L arguments, which means we could actually try using `--library-path foo` with the zig you downloaded from ziglang.org to test the fix
<mouldysammich> yeah, i found the -L args that fixed it, http://paste.debian.net/1070131/ that command worked on my hello world file
gamester has quit [Remote host closed the connection]
<andrewrk> can you try narrowing it down to only 1?
<mouldysammich> sure, one sec
<andrewrk> if we can fix this in a satisfying way, `zig libc` will show either a different path for one of them, or we'll need another key/value pair that matters on open suse. then everything will "just work" and no `--library-path` workaround will be needed anymore
<mouldysammich> it seems to just need one of these '-L /lib/../lib64'
<andrewrk> what files are in that directory?
<mouldysammich> the libgcc_s.so.1 is in there, also http://paste.debian.net/plain/1070132 thats the list of all the files
<andrewrk> thanks
<andrewrk> mouldysammich, so the issue is that on other linuxes, libgcc_s.so is in the same place as crt1.o
<andrewrk> which for you is: lib_dir=/usr/lib64/gcc/x86_64-suse-linux/8/../../../../lib64
<andrewrk> which is just /usr/lib64
<andrewrk> so I know how to fix this now. thanks! looks like "lib_dir" will get renamed to "crt_dir", and the new "lib_dir" will be found with cc -print-file-name=libgcc_s.so
<andrewrk> mouldysammich, can you confirm that `cc -print-file-name=libgcc_s.so` finds the correct directory?
<mouldysammich> yeah it finds the correct directory for both libgcc_s.so and libgcc_s.so.1
<andrewrk> thanks
<andrewrk> I'll take it from here