Open ghost opened 2 years ago
Hmm, I tried fresh clone on Ubuntu and it seems to work, can you please check if the file /ev/çizeylemcil/bl/bin/bl-config
exists? If not you can try to copy-paste it from bl/deps/bl-config/linux/bl-config
. You can also check if the file is allowed to execute.
it exists inside the bin directory:
ls -l /ev/çizeylemcil/bl/bin total 160308 -rwxr-xr-x 1 özcü özcü 47592 Dec 17 13:45 bl-config -rwxr-xr-x 1 özcü özcü 109382224 Dec 17 13:45 bl-lld -rwxr-xr-x 1 özcü özcü 54713192 Dec 17 13:45 blc
OK, the file is distributed as a binary, you can try to execute it manually bl/bin$ ./bl-config -h
but it seems like it would not work anyway.
Are you running x86_64
?
Btw bl-config
produces a configuration file in bl/etc/bl.conf
you can try to create it manually, this is how my current one on Ubuntu looks like:
// BL configuration file
// This file is generated by bl-config tool and used by 'blc' compiler during compilation
// process.
VERSION "1.0.0"
// Main API directory containing all modules and source files.
LIB_DIR "/home/travis/bl/lib/bl/api"
// Default linker options used for executable linking.
LINKER_OPT_EXEC "/home/travis/bl/lib/bl/rt/blrt_x86_64_linux.o -dynamic-linker /lib64/ld-linux-x86-64.so.2 -e _start -lc -lm"
// Default linker options used for shared library linking.
LINKER_OPT_SHARED "--shared -lc -lm"
// Additional linker library path.
LINKER_LIB_PATH "/usr/lib:/usr/local/lib:/lib64:/usr/lib/x86_64-linux-gnu"
I use x86_64 and /etc is symlinked. I tried ./bl-config -h and it gave the same error:
zsh: no such file or directory: ./bl-config
I will manually add the config and see if it works.
hmm, maybe symlink reading does not work properly...
this part "/lib64/ld-linux-x86-64.so.2 -e _start -lc -lm" will not work with musl libc. Musl libc has ld-musl-x86_64.so.1.
edit: I created etc folder inside the source dir, and blc asks for input file.
edit2: I have tried to compile a sample code but blc gives me this error:
test.bl:12:13: warning: Unreachable code detected in the function 'fib'. 11 |
12 | return -1; 13 | }
zsh:1: no such file or directory: /ev/çizeylemcil/bl/bin/bl-lld error(0060): Native link execution failed. Finished in 0.083 seconds.
edit3: I guess the reason I get "no such file or directory" is because bl-config and bl-lld expects glibc.
yes, I was kinda expecting this, it seems to be the same issue, bl-lld
should be in bin
directory (same as bl-config
).
It's possible! Both binaries are compiled with glibc.
You can try to use your default system linker ld
by adding LINKER_EXECUTABLE "/your/path/to/ld"
entry into the bl.conf
file.
Now I get all these undefined references:
test.bl:12:13: warning: Unreachable code detected in the function 'fib'. 11 |
12 | return -1; 13 | }
/bin/ld: /ev/çizeylemcil/bl/out.o: in function
__os_start': /ev/çizeylemcil/bl/lib/bl/api/os/_linux.bl:125: undefined reference to
malloc' /bin/ld: /ev/çizeylemcil/bl/lib/bl/api/os/_linux.bl:131: undefined reference tostrlen' /bin/ld: /ev/çizeylemcil/bl/lib/bl/api/os/_linux.bl:135: undefined reference to
free' /bin/ld: /ev/çizeylemcil/bl/out.o: in function__os_abort_default.344': /ev/çizeylemcil/bl/lib/bl/api/os/_linux.bl:114: undefined reference to
raise' /bin/ld: /ev/çizeylemcil/bl/out.o: in functiondefault_allocator_handler.560': /ev/çizeylemcil/bl/lib/bl/api/std/memory.bl:268: undefined reference to
free' /bin/ld: /ev/çizeylemcil/bl/lib/bl/api/std/memory.bl:265: undefined reference tomalloc' /bin/ld: /ev/çizeylemcil/bl/out.o: in function
__os_write.523': /ev/çizeylemcil/bl/lib/bl/api/os/_linux.bl:101: undefined reference towrite' /bin/ld: /ev/çizeylemcil/bl/out.o: in function
print_any.599': /ev/çizeylemcil/bl/lib/bl/api/std/print/print.bl:314: undefined reference tomemset' /bin/ld: /ev/çizeylemcil/bl/out.o: in function
print_f64.630': /ev/çizeylemcil/bl/lib/bl/api/std/print/print.bl:578: undefined reference topow' /bin/ld: /ev/çizeylemcil/bl/lib/bl/api/std/print/print.bl:579: undefined reference to
ceil' /bin/ld: /ev/çizeylemcil/bl/out: hidden symbol `llvm.pow.f64' isn't defined /bin/ld: final link failed: bad value error(0060): Native link execution failed. Finished in 0.089 seconds.
Hmm, this looks like a real blocker, currently, bl is dependent on some stuff from libc, and it's definitely not tested with musl :/ I work on Windows so the support of Linux is limited just to WSL or let's say Ubuntu...
Maybe adding support for musl-libc will be a feaute enhancement for future development, I guess. Thanks anyway for your help.
I'm thinking about it, btw is there any advantage over glibc
?
It produces fairly small binaries when statically linked, supposed to be more stable, less bug prone than glibc. Other than that I don,t know. Here is an introduction if you are interested: https://www.musl-libc.org/intro.html
If you want to try out musl libc in action you could use alpine linux, which is best known to be based on musl-libc. https://alpinelinux.org/
I have manually built bl from the source and added blc to the PATH env. But when I run "blc --configure", I ge this error message:
I use a custom musl-libc based linux distro with llvm version 12.0.1(I changed Cmakelists.txt to use llvm 12.0.1). Compilation finnished without any errors, but configuring blc doesn't go through.