Hello, I'm trying to use clang to compile a file in an x86 machine (running i386 GNU/Linux) to ARM. In the end, all I want is for the bit code (I use -emit-llvm) getArch() result to be Triple::ARM. I tried to use "-target arm" but I get a "fatal error: 'bits/predefs.h' file not found". Is there any easy way to make the target architecture "ARM" without running into such trouble? Thanks! Alon ________________________________ This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. An NDS Group Limited company. www.nds.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121217/4a8a12c7/attachment.html>
Hi, As I understand it, the issue is that (at least in principle) the information in any of the C/C++ system headers can be different between different architectures (and even major versions of the standard library on a given architecture). As such, clang/clang++ attempts to find the system header file for the target architecture rather than the host, and for general code there's no way to get things to work without the headers for the target, which implies having a gcc cross compiler installed (since clang uses it's directory to figure out where to look for headers). You might possibly be able to get away with not having a cross compiler if you don't actually need, and hence remove the includes for, anything which imports system headers. Regards, David From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Shaltiel, Alon Sent: 17 December 2012 17:15 To: llvmdev at cs.uiuc.edu Subject: [LLVMdev] target arm Hello, I'm trying to use clang to compile a file in an x86 machine (running i386 GNU/Linux) to ARM. In the end, all I want is for the bit code (I use -emit-llvm) getArch() result to be Triple::ARM. I tried to use "-target arm" but I get a "fatal error: 'bits/predefs.h' file not found". Is there any easy way to make the target architecture "ARM" without running into such trouble? Thanks! Alon ________________________________ This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com<mailto:postmaster at nds.com> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. An NDS Group Limited company. www.nds.com<http://www.nds.com> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121217/b4b73843/attachment.html>
Ok, found how to fix it: sudo apt-get install libc6-dev :) Also, instead of "clang -target arm", the full triple should be given, such as: "clang -target arm-linux-eabi" Thanks a lot! Alon From: David Tweed [mailto:David.Tweed at arm.com] Sent: Monday, December 17, 2012 7:45 PM To: Shaltiel, Alon; llvmdev at cs.uiuc.edu Subject: RE: [LLVMdev] target arm Hi, As I understand it, the issue is that (at least in principle) the information in any of the C/C++ system headers can be different between different architectures (and even major versions of the standard library on a given architecture). As such, clang/clang++ attempts to find the system header file for the target architecture rather than the host, and for general code there's no way to get things to work without the headers for the target, which implies having a gcc cross compiler installed (since clang uses it's directory to figure out where to look for headers). You might possibly be able to get away with not having a cross compiler if you don't actually need, and hence remove the includes for, anything which imports system headers. Regards, David From: llvmdev-bounces at cs.uiuc.edu<mailto:llvmdev-bounces at cs.uiuc.edu> [mailto:llvmdev-bounces at cs.uiuc.edu]<mailto:[mailto:llvmdev-bounces at cs.uiuc.edu]> On Behalf Of Shaltiel, Alon Sent: 17 December 2012 17:15 To: llvmdev at cs.uiuc.edu<mailto:llvmdev at cs.uiuc.edu> Subject: [LLVMdev] target arm Hello, I'm trying to use clang to compile a file in an x86 machine (running i386 GNU/Linux) to ARM. In the end, all I want is for the bit code (I use -emit-llvm) getArch() result to be Triple::ARM. I tried to use "-target arm" but I get a "fatal error: 'bits/predefs.h' file not found". Is there any easy way to make the target architecture "ARM" without running into such trouble? Thanks! Alon ________________________________ This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com<mailto:postmaster at nds.com> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. An NDS Group Limited company. www.nds.com<http://www.nds.com> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121223/99bb8525/attachment.html>