How to compile a kernel in C++ using a cross compiler?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
sofferjacob
Posts: 7
Joined: Tue Feb 28, 2017 11:44 am
Libera.chat IRC: sofferjacob

How to compile a kernel in C++ using a cross compiler?

Post by sofferjacob »

I recently started porting my kernel project to c++ (from C) and tried to compile it with the same cross compiler I use to compile my C kernel. The problem is that GCC calls Ubuntu's G++ instead of calling the cross-compiler G++. Therefore when the cross compiler linker tries to link the kernel it can't read the object files. How do I fix this?

Thanks in advance
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: How to compile a kernel in C++ using a cross compiler?

Post by iansjack »

When you created the cross-compiler did you specify C++ as one of the languages it could compile?
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: How to compile a kernel in C++ using a cross compiler?

Post by Korona »

Do you invoke {x86_64,i386}-{elf,youros}-g++ or plain g++? Is i386-elf-g++ in your path?
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
Post Reply