Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

how I "set the BUILD_CC environment variable "?

Altera_Forum
Honored Contributor II
3,280 Views

hi all: 

 

I am porting ncurses-5.5 to nios2 uclinux now. 

 

Frist I edit configure.sub  

add " | nios2 " in the "case $basic_machine in" 

 

then I run: 

./configure --build=nios2 --with-build-cc=nios2-linux-uclibc-gcc 

 

but I check configure information and I find the message as bollow: 

 

checking whether we are cross compiling... no 

 

I checked the makefile ,I find the cc setting still use gcc, not nios2-linux-uclinbc-gcc 

 

CC = gcc 

CPP = gcc -E  

CFLAGS = -O2 

 

I read the install of ncures5.5. I got some information about crosscompile as bellow: 

 

BUILDING NCURSES WITH A CROSS-COMPILER 

Ncurses can be built with a cross-compiler. Some parts must be built 

with the host's compiler since they are used for building programs 

(e.g., ncurses/make_hash and ncurses/make_keys) that generate tables 

that are compiled into the ncurses library. The essential thing to do 

is set the BUILD_CC environment variable to your host's compiler, and 

run the configure script configuring for the cross-compiler. 

 

The configure options --with-build-cc, etc., are provided to make this 

simpler. Since make_hash and make_keys use only ANSI C features, it 

is normally not necessary to provide the other options such as 

--with-build-libs, but they are provided for completeness. 

 

Who can tell me how I "set the BUILD_CC environment variable to my host's compiler" ? 

 

Thank a lot!
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
2,167 Views

./configure --host=nios2-linux-uclibc- --with-build-cc=gcc --disable-shared ...... 

 

about config.sub, check ~/download/uClinux-dist.diff on how to add $basic_machine, eg wget 

 

Index: user/wget/config.sub =================================================================== --- user/wget/config.sub    (revision 1) +++ user/wget/config.sub    (revision 3) @@ -274,6 +274,11 @@  m88110 | m6800 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)  ;; +    nios2 | nios2-* | nios2 | nios2-*) +  basic_machine=nios2-altera +  os=-linux +    ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users.
0 Kudos
Altera_Forum
Honored Contributor II
2,167 Views

hi hippo: 

 

Thanks for you reply.  

Frist I have successed make ncurese by you guide. 

 

Then I must cross compile cdk(curses d k).It is a devlope tool for ncurses. 

 

I still edit configure.sub and use configure option as your post. 

 

but not select crosscompile option in configure process. 

 

[alex@localhost cdk-5.0-20060220]$ ./configure --host=nios2-linux-uclibc --with-build-cc=gcc --disable-shared 

loading cache ./config.cache 

checking for X... (cached) libraries /usr/X11R6/lib, headers /usr/X11R6/include 

checking host system type... nios2-altera-linux-gnu 

(cached) Configuring for linux-gnu 

checking for package version... 5.0 

checking for package patch date... 20060220 

checking for gcc... (cached) gcc 

checking whether the C compiler (gcc ) works... yes 

checking whether the C compiler (gcc ) is a cross-compiler... no 

checking whether we are using GNU C... (cached) yes 

 

I try another ./configure option, for example: 

[alex@localhost cdk-5.0-20060220]$ ./configure --build=nios2 --host--nios2-linux-uclibc --with-build-cc=gcc --disable-shared 

 

[alex@localhost cdk-5.0-20060220]$ ./configure --host--nios2-linux-uclibc --with-build-cc=nios2-linux-uclibc-gcc --disable-shared 

 

etc.... 

 

but I still fail. 

 

Please help me. 

If I make success, I will test the ncurses in my dvb. Then post porting method 

to forum.The ncurses is a very helpful terminal tool for us.It can make tab,menu, 

....in a terminal like a Kernel make menuconfig windows.
0 Kudos
Altera_Forum
Honored Contributor II
2,167 Views

take a look at the config usage in ~/buildroot/package/ncurses/ncurses.mk 

I didn't know cdk. sorry.
0 Kudos
Altera_Forum
Honored Contributor II
2,167 Views

thank you hippo. 

Can you tell me how I compile ~/buildroot/package/ncurses?
0 Kudos
Altera_Forum
Honored Contributor II
2,167 Views

change "--with-shared" to "--disable-shared" in the configure command of the ~/buildroot/package/ncurses/ncurses.mk . You will need to removed the so (shared object) building. 

 

The uClinux-dist (-test) has ncurses lib too. You'd better use this one, which is ported to uClinux. Check the library selection. 

 

As a general rule, when you need lib or apps, check the uClinux-dist first. 

 

Most lib or apps ports in buildroot are shared objects, which is not supported in current nios2. 

You have to modify the mk files to remove shared.
0 Kudos
Altera_Forum
Honored Contributor II
2,167 Views

hi: 

I don't find ncurses lib in uClinux-dist-test. 

 

I just find nessus app in /user. Can you tell where id the ncurses lib? 

 

Thank you
0 Kudos
Altera_Forum
Honored Contributor II
2,167 Views

You are right. It was missing in uClinux-dist. 

 

So try buildroot's,  

cd ~/buildroot make menuconfig 

in Package Selection for the target-->[ *] ncurses , to select the package. 

 

You have to edit mk file, in line 64, 

change "--with-shared" to "--disable-shared" of the configure command of the ~/buildroot/package/ncurses/ncurses.mk  

 

Then make. It will fail on shared object. But the static lib and header are ready, and you can try them.
0 Kudos
Altera_Forum
Honored Contributor II
2,167 Views

hi hippo: 

 

1. I make ncurses ~/buildroot/package/ncurses is oK. 

 

2.as your guide :./configure --host=nios2-linux-uclibc- --with-build-cc=gcc --disable-shared ...... 

 

in sometimes maybe not correct. 

 

sometimes must change "--host=nios2-linux-uclibc-" to "--host=nios2-linux-uclibc". 

for example in ncurses ./confing, because "-" will be added by configure again.if you still use "--host=nios2-linux-uclibc-" ,it will make mistake.
0 Kudos
Altera_Forum
Honored Contributor II
2,167 Views

Hi Alex, 

You are right. Never add the last "-", just use "nios2-linux-uclibc" for --host= or --target= . 

Thanks. 

(I am lost, because I did not use configure for a while. I'm no more young...)
0 Kudos
Reply