How to set environment variables for cross-compile in ubuntu?

i want to cross compile c programs for my soc, how to set environment variables and write a makefile?

If you're talking about OpenWrt, https://openwrt.org/docs/guide-developer/build-system/start

If not, you would be better off on a forum that supports the hardware itself.

1 Like

in openwrt only. i dont want as package , i want an executable file which can be transfered through scp command

You need to either use the full OpenWrt build environment or the SDK as you need to link against the proper libraries and kernel ABIs. Any effort on your own to create your own cross-compile environment would effectively need to replicate what is already available in those build chains.

3 Likes

https://openwrt.org/docs/guide-developer/crosscompile

2 Likes

can u explain it step by step, i didnt understand the document?

What error are you getting?

In ubuntu, cross compiler gcc not showing