DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 20th March 2015
NickF_93 NickF_93 is offline
New User
 
Join Date: Mar 2015
Posts: 3
Question Cross compiling from Linux to OpenBSD with gcc

Hello,

I hope not have been in wrong section.

I was trying to build from scratch a cross-compiler from x86_64 Linux to x86_64 OpenBSD 5.6, but I encountered some problems.

I fail making binutils and this is the error:

**** ld does not support target x86_64-pc-openbsd5.6

As much as I can understand linker doesn't support x86_64-pc-openbsd5.6 triplet, but why? I know that is possible compile gcc for openbsd system.
However this is configuration with flags:

../gcc-4.9.2/configure --target="amd64-openbsd5.6" --prefix="/usr/local/cross" --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-nls --enable-libssp --enable-gold --enable-ld --with-sysroot="/usr/local/sysroot/openbsd5.6" $opt --disable-libgomp

Any ideas?

Thank you in advance.
Reply With Quote
  #2   (View Single Post)  
Old 21st March 2015
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

You need OUR binutils and gcc from our source tree if you even hope to have a chance at being successful at this.

But I must ask: why do you want to cross compile OpenBSD? There's only maybe one or two things I can think of for why and I would definitely discourage you from doing this unless you absolutely need to.
Reply With Quote
  #3   (View Single Post)  
Old 23rd March 2015
NickF_93 NickF_93 is offline
New User
 
Join Date: Mar 2015
Posts: 3
Smile

Quote:
Originally Posted by ibara View Post
You need OUR binutils and gcc from our source tree if you even hope to have a chance at being successful at this.

But I must ask: why do you want to cross compile OpenBSD? There's only maybe one or two things I can think of for why and I would definitely discourage you from doing this unless you absolutely need to.
I'm doing it just for fun, not for work and I'm not going to give up!
So, where can I find YOUR binutils and gcc?

Thank you!
Reply With Quote
  #4   (View Single Post)  
Old 23rd March 2015
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Quote:
Originally Posted by NickF_93 View Post
So, where can I find YOUR binutils and gcc?
In the branch of the OpenBSD source tree that contains GPL-licensed components: src/gnu. Specifically, you will find these tools here: src/gnu/usr.bin/{binutils,binutils-2.17,gcc}

Obtaining the correct "flavor" of the OpenBSD source tree is discussed in OpenBSD FAQ 5, Building the System from Source.
Reply With Quote
  #5   (View Single Post)  
Old 23rd March 2015
NickF_93 NickF_93 is offline
New User
 
Join Date: Mar 2015
Posts: 3
Default

Quote:
Originally Posted by jggimi View Post
In the branch of the OpenBSD source tree that contains GPL-licensed components: src/gnu. Specifically, you will find these tools here: src/gnu/usr.bin/{binutils,binutils-2.17,gcc}

Obtaining the correct "flavor" of the OpenBSD source tree is discussed in OpenBSD FAQ 5, Building the System from Source.
Thank you very much.
That guide it's ok to compile system, but also cross-compile gcc and binutils only?
Thank you
Reply With Quote
  #6   (View Single Post)  
Old 23rd March 2015
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

it is not clear to me what it is you are trying to do, exactly, but it appears to me you are trying to compile OpenBSD-targeted binaries from Linux, rather than from OpenBSD. That is not a supported development path -- hence, you are on your own. Above, ibara recommended you not pursue cross-compilation unless you have a specific need.* He's an OpenBSD developer, so I recommend you follow his advice.

If you insist, I wish you lots of luck. You are certainly welcome to try to build OpenBSD's binutils and gcc tools from Linux; the applicable Makefiles are right there in the tree. You are likely to also need need the collection of include Makefiles to build them. They're in the source tree also, in src/share/mk.

---

* From the same FAQ 5 referenced above:
Quote:
5.11.12 - Can I cross-compile? Why not?

Cross-compiling tools are in the system, for use by developers bringing up a new platform. However, they are not maintained for general use.

When the developers bring up support for a new platform, one of the first big tests is a native-build. Building the system from source puts considerable load on the OS and machine, and does a very good job of testing how well the system really works. For this reason, OpenBSD does all the build process on the platform the build is being used for, also known as "native building". Without native building, it is much more difficult to be sure that the various platforms are actually running reliably, and not just booting.

Last edited by jggimi; 23rd March 2015 at 12:41 PM. Reason: clarity
Reply With Quote
Reply

Tags
binutils, cross-compiler, gcc, linux, openbsd

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to cross-compile the kernel? Skinny OpenBSD General 11 26th November 2012 05:38 PM
Cross compile on ADM5120 martijn NetBSD General 0 21st September 2010 08:08 PM
Kernel and cross compiling on OpenBSD Mr-Biscuit Programming 3 7th September 2010 04:35 AM
Delete compilers to cross compile revzalot OpenBSD Installation and Upgrading 9 28th August 2009 08:06 PM
Compiling OpenBSD code WeakSauceIII OpenBSD General 4 19th May 2008 12:59 AM


All times are GMT. The time now is 11:20 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick