Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Weining_L_Intel
Employee
1,276 Views

Latest cross compile toolchain(glibc) for quark doesn't work

Hi, all

I met some problems when using the self-built cross compile toolchain(glibc) for Quak. Can any help? Thanks!

From this site https://downloadcenter.intel.com/download/23197/Intel-Quark-BSP Download Intel® Quark™ BSP I get Board_Support_Package_Sources_for_Intel_Quark_v1.2.0.7z and Quark_BSP_BuildGuide_329687_009.pdf.

Following the build guide, I have suceessfully built out the cross compile toolchain installer(iot-devkit-glibc-x86_64-image-full-i586-toolchain-1.7.2.sh) on my Ubuntu-12.04 machine by "bitbake image-full" and "bitbake image-full -c populate_sdk".

But, it failed when I try to compile/link some program, who call the 'fputc' or 'fgetc' methods, using this toolchain.

// test1.c

# include

int main () {

fputc('a', stdout);

printf ("hello world! \n");

return 0;

 

}

In a new terminal window, source the environment setup script and compile test1.c. A link error occurs like this:

shaka@shaka-VirtualBox:~/test$ source /opt/iot-devkit/1.7.2/environment-setup-i586-poky-linux

shaka@shaka-VirtualBox:~/test$ $CC test1.c

/tmp/cctVzDzW.o: In function `main':

test1.c:(.text+0x50): undefined reference to `__fputc_unlocked'

collect2: error: ld returned 1 exit status

 

From google I got this explain https://www.uclibc.org/FAQ.html# miscompile https://www.uclibc.org/FAQ.html# miscompile saying that:

"

My package builds fine but link fails with errors like "undefined reference to __fputc_unlocked", who do I blame?!

This error crops up when a build system mixes system headers (say glibc) with the target headers (say uClibc). Make sure your build system is not including extraneous include options (-I) and double check that it is using the correct compiler. Many build systems incorrectly force things like -I/usr/include or -I/usr/local/include or -I${prefix}/include (which usually just expands to -I/usr/include)

"

It seems that the cross toolchain mixes glibc and uclibc. To prove this I wrote another program:

// test2.c

# include

int main () {

# ifdef __UCLIBC__

printf (" __UCLIBC__ is defined. \n");

# endif

return 0;

 

}

Compile test2.c with the cross toolchain and run on the Galileo Gen1 board. I got the output "__UCLIBC__ is defined.". So I think there is something wrong with the toolchain. The header file /opt/iot-devkit/1.7.2/sysroots/i586-poky-linux/usr/include/stdio.h has been attached for your reference. I doubt this file is not for glibc but for uclibc.

And, what's more:

If I source the file environment-setup-i586-poky-linux which is generated by "bitbake image-full" and "bitbake meta-ide-support", anything will be OK. No link error for test1.c and no output when running test2.

Is there anyone know what cause this issue and how to fix? Thanks!

(BTW, I have tried both 32 bit and 64 bit machine to built the toolchain and the issue exist all the same.)

7 Replies
Sergio_A_Intel
Employee
136 Views

Hi,

We will investigate and post a reply soon. We will update the case when we have more information.

Sergio

Weining_L_Intel
Employee
136 Views

Thanks for your reply, Sergio.

Weining

Sergio_A_Intel
Employee
136 Views

It looks like an issue with the header file. Which board are you using? We ran some tests and BSP source 1.0.6 from https://github.com/01org/Galileo-Runtime 01org/Galileo-Runtime does not have this issue. If you are using a Galileo I'd suggest you to use this package that has been tested with the Galileo.

Let us know your results.

Sergio

Sergio_A_Intel
Employee
136 Views

Were you able to run the tests we recommended? Do you still need help with this thread?

Sergio

Weining_L_Intel
Employee
136 Views

Hi Sergio,

Sorry for the late reply due to the Chinese New Year holiday. I'm using the Galileo Gen1 board and Board_Support_Package_Sources_for_Intel_Quark_v1.2.0.7z downloaded from https://downloadcenter.intel.com/download/23197/Intel-Quark-BSP Download Intel® Quark™ BSP. But I found that the version has been upgraded to 1.2.1.7 which I have not tried. Is the BSP 1.0.6 you mentioned at https://github.com/01org/Galileo-Runtime GitHub - 01org/Galileo-Runtime an older version? (I have not tried.) Is it an eglibc or uclibc toolchain?

Thanks,

Weining

Sergio_A_Intel
Employee
136 Views

Yes, BSP 1.0.6 is an older version. If you look at the link we provided you'll find a link to the User Guide. At the end of section 7 you'll find information on how to build an eglibc image.

I haven't tried with 1.2.1.7 version either, but give it a try and let us know your results as well as with BSP 1.0.6. You can see more information on BSP 1.2.1.7 here https://downloadmirror.intel.com/23197/eng/X1000_BSP_BuildGuide.pdf https://downloadmirror.intel.com/23197/eng/X1000_BSP_BuildGuide.pdf

Sergio

Weining_L_Intel
Employee
136 Views

One of my colleague just tried BSP 1.2.1.7 and the same issue exists. With limit time, we decide to use the toolchain environment setup script generated by "bitbake meta-ide-support" on the build machine. It is possible that BSP 1.0.6 works but we have not enough time to try.

 

Thanks for your time and I will close this post.

 

Weining

 

Reply