Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build fails with undefined reference to major'` #12

Closed
morganrallen opened this issue Feb 24, 2019 · 7 comments
Closed

build fails with undefined reference to major'` #12

morganrallen opened this issue Feb 24, 2019 · 7 comments

Comments

@morganrallen
Copy link

morganrallen commented Feb 24, 2019

This is the output using the instructions from the readme

/usr/bin/ld: qga/commands-posix.o: in function `dev_major_minor':
/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:656: undefined reference to `major'
/usr/bin/ld: /home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:657: undefined reference to `minor'
collect2: error: ld returned 1 exit status

There are several warning prior

/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c: In function ‘dev_major_minor’:
/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:656:21: warning: implicit declaration of function ‘major’ [-Wimplicit-function-declaration]
         *devmajor = major(st.st_rdev);
                     ^~~~~
/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:656:21: warning: nested extern declaration of ‘major’ [-Wnested-externs]
/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:657:21: warning: implicit declaration of function ‘minor’; did you mean ‘mincore’? [-Wimplicit-function-declaration]
         *devminor = minor(st.st_rdev);
                     ^~~~~
                     mincore
/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:657:21: warning: nested extern declaration of ‘minor’ [-Wnested-externs]

@Ebiroll
Copy link
Owner

Ebiroll commented Feb 24, 2019

What operating system and version are you using when compiling?

@morganrallen
Copy link
Author

morganrallen commented Feb 24, 2019

Ubuntu 19.04

@Ebiroll
Copy link
Owner

Ebiroll commented Feb 24, 2019

You probably already solved this.
Do a #include <sys/sysmacros.h>

@morganrallen
Copy link
Author

I actually just removed the references to major/minor :)))

@Ebiroll Ebiroll closed this as completed Jul 5, 2019
@realjiangdi
Copy link

I met this Problem,too. My OS is Unbuntu 20.04 LTS.
After I add #include <sys/sysmacros.h>. I solved this issiue.

@TaoTaoNie
Copy link

I met this Problem,too. My OS is Unbuntu 20.04 LTS.
After I add #include <sys/sysmacros.h>. I solved this issiue.

which file to add #include <sys/sysmacros.h>?

@DanielWood
Copy link

I met this Problem,too. My OS is Unbuntu 20.04 LTS.
After I add #include <sys/sysmacros.h>. I solved this issiue.

which file to add #include <sys/sysmacros.h>?

commands-posix.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants