Ask coding questions

← Back to all posts
GRUB - conflicting types
programmeruser (571)

I'm trying to build GRUB from source on Windows on MSYS2, and GCC complains about conflicting types for functions:

But when I comment out the offending functions ld complains about not being able to find symbols.
( @xxpertHacker ping since you and CSharpIsGud are probably the only users on Repl.it who will understand this)

Answered by xxpertHacker (860) [earned 5 cycles]
View Answer
Comments
hotnewtop
xxpertHacker (860)

This means that a function was declared with a type, and later found to have had a different type in the implementation, ex:

// header.hpp
namespace ns {
    void foo(int x);
}
// source.cpp
char ns::foo(int x);

If this helps, please mark this answer as "correct" by clicking the checkmark on the left < side.

(I need more details to actually answer this)

programmeruser (571)

@xxpertHacker I know that, and I've tried commenting out the offending functions, but as I said above it creates undefined symbol linker errors.
The source code of GRUB can be obtained by cloning the git repo at https://git.savannah.gnu.org/git/grub.git.

xxpertHacker (860)

@programmeruser

undefined symbol linker errors

This means that a function was declared, yet was not implemented, thus the program cannot be compiled, ex:

// header.hpp
namespace ns {
    void foo(int x);
}
// source.cpp

If this helps, please mark this answer as "correct" by clicking the checkmark on the left < side.

Okay, now honestly, either grub was poorly coded, as it can't be compiled, or you're doing something wrong.

For any code that is hosted on GitHub, generally, I would just make an issue about it and see if the author or a contributor would answer it.

I'll check the code, but I might take a few hours to get around to it, CSharp is a better bet.

programmeruser (571)

@xxpertHacker there's a SO question where the author is having the same problem that I am, but sadly no one has answered or commented on it.

xxpertHacker (860)

@programmeruser Do you need to build it for source, or are there any prebuilt binaries?

programmeruser (571)

@xxpertHacker there are, but they don't have grub-mkrescue

xxpertHacker (860)

@programmeruser Guess we'll just wait for someone like CSharpIsGud to come along...

programmeruser (571)

@xxpertHacker @CSharpIsGud I eventually found a workaround, you can use grub-mkimage in the Windows binaries of grub to create a bootable image, and mkisofs to create a ISO disk image, but this was after I just gave up and moved to Linux

xxpertHacker (860)

@programmeruser Lol, not sure if you should've marked mine as correct though.

CSharpIsGud (922)

I don't really build many things from source for the reason of having to deal with issues like these.

programmeruser (571)

@CSharpIsGud same, but the problem is that I can't find windows binaries for grub-mkrescue.