Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile does not detect new toolchain #6219

Closed
kassane opened this issue May 8, 2022 · 4 comments
Closed

Makefile does not detect new toolchain #6219

kassane opened this issue May 8, 2022 · 4 comments

Comments

@kassane
Copy link
Contributor

kassane commented May 8, 2022

Ref: #5732

When trying last to commit the proposal above there was an issue during the make build running the toolchain that its initialization was not listed in the makefile log. I expected at least some compilation error but it doesn't even return. Except when replacing the CC and CXX with ZCC and ZCXX there are some compilation errors on Config.mk file.

Would any further changes be required to add a new toolchain or did I forget some reference point?

output:

# [...]
CC:  signal/sig_ppoll.c
make[3]: Entrando no diretório '/home/kassane/Code/nuttxspace/apps/examples/hello_zig'

CC:  driver/fs_closeblockdriver.c
CC:  signal/sig_fillset.c
CC:  signal/sig_hold.c
CC:  signal/sig_pselect.c
CC:  driver/fs_blockpartition.c
CC:  signal/sig_ignore.c
CC:  task/task_create.c
CC:  signal/sig_ismember.c
CC:  driver/fs_findmtddriver.c
CC:  signal/sig_pause.c
CC:  task/task_init.c
CC:  driver/fs_blockproxy.c
CC:  signal/sig_psignal.c
CC:  task/task_setup.c
CC:  dirent/fs_closedir.c
CC:  signal/sig_raise.c
AR (add): libapps.a           
# Missing ZIG: examples/hello_zig/hello_zig_main.zig
make[3]: Saindo do diretório '/home/kassane/Code/nuttxspace/apps/examples/hello_zig'
# [...]
/usr/bin/ld: nuttx.rel:(.data.rel.ro.g_builtins+0x28): reference not defined for "hello_zig_main"
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:323: nuttx] Error 1
make: *** [tools/Unix.mk:509: nuttx] Error 2
@xiaoxiang781216
Copy link
Contributor

Does the new toolchain on your search path?

@kassane
Copy link
Contributor Author

kassane commented May 12, 2022

Right, the example of this is zcc and zcxx worked even though they generated a flags error. Only zig build did not return any information in the output.
I will review the application.mk file again.

The strange thing is that when did an external test manually everything works.
But only note in question is the condition to always link the object generated by zig to libc.

What do you mean?

zig code doesn't need libc (only ffi) and the other toolchains can't find to call it.

e.g.:

$> zig build-obj src.zig
...
$> xtoolchain-gcc src.o -o myfile
# error, need to call libc
....
$> zig build-obj src.zig -lc #link to libc
...
$> xtoolchain-gcc src.o -o myfile
# done

@kassane
Copy link
Contributor Author

kassane commented May 25, 2022

@lupyuen
Copy link
Member

lupyuen commented May 25, 2022

Thanks! I'm totally new to Zig, but it looks super exciting :-)

@kassane kassane closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants