sudo ninja install [2/17] Compiling C object src/libvirgl.a.p/drmdrmcontext.c.o FAILED:…
- User
sudo ninja install [2/17] Compiling C object src/libvirgl.a.p/drm_drm_context.c.o FAILED: src/libvirgl.a.p/drm_drm_context.c.o cc -Isrc/libvirgl.a.p -Isrc -I../src -I../src/gallium/include -I../src/gallium/auxiliary -I../src/gallium/auxiliary/util -I. -I.. -I../src/venus -I../src/drm -I../src/drm/drm-uapi -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O3 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -fvisibility=hidden -imacros /home/jayden/Downloads/virglrenderer/build/config.h -DHAVE_CONFIG_H=1 -fPIC -pthread -MD -MQ src/libvirgl.a.p/drm_drm_context.c.o -MF src/libvirgl.a.p/drm_drm_context.c.o.d -o src/libvirgl.a.p/drm_drm_context.c.o -c ../src/drm/drm_context.c In file included from ../src/drm/drm_context.c:5: /usr/include/xf86drm.h:40:10: fatal error: drm.h: No such file or directory 40 | #include <drm.h> | ^~~~~~~ compilation terminated. [3/17] Compiling C object src/libvirgl.a.p/drm_drm_renderer.c.o FAILED: src/libvirgl.a.p/drm_drm_renderer.c.o cc -Isrc/libvirgl.a.p -Isrc -I../src -I../src/gallium/include -I../src/gallium/auxiliary -I../src/gallium/auxiliary/util -I. -I.. -I../src/venus -I../src/drm -I../src/drm/drm-uapi -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O3 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -fvisibility=hidden -imacros /home/jayden/Downloads/virglrenderer/build/config.h -DHAVE_CONFIG_H=1 -fPIC -pthread -MD -MQ src/libvirgl.a.p/drm_drm_renderer.c.o -MF src/libvirgl.a.p/drm_drm_renderer.c.o.d -o src/libvirgl.a.p/drm_drm_renderer.c.o -c ../src/drm/drm_renderer.c In file included from ../src/drm/drm_renderer.c:15: /usr/include/xf86drm.h:40:10: fatal error: drm.h: No such file or directory 40 | #include <drm.h> | ^~~~~~~ compilation terminated. [4/17] Compiling C object src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o FAILED: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o cc -Isrc/libvirgl.a.p -Isrc -I../src -I../src/gallium/include -I../src/gallium/auxiliary -I../src/gallium/auxiliary/util -I. -I.. -I../src/venus -I../src/drm -I../src/drm/drm-uapi -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O3 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -fvisibility=hidden -imacros /home/jayden/Downloads/virglrenderer/build/config.h -DHAVE_CONFIG_H=1 -fPIC -pthread -MD -MQ src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o -MF src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o.d -o src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o -c ../src/drm/asahi/asahi_renderer.c In file included from ../src/drm/asahi/asahi_renderer.c:16: /usr/include/xf86drm.h:40:10: fatal error: drm.h: No such file or directory 40 | #include <drm.h> | ^~~~~~~ compilation terminated. [11/17] Compiling C object src/libvirglrenderer.so.1.8.8.p/virglrenderer.c.o ninja: build stopped: subcommand failed. jayden@jayden-macbookpro:~/Downloads/virglrenderer/build$
- Assistant
The error you're encountering indicates that the compiler cannot find the header file
drm.h, which is essential for the compilation of thevirglrendererproject you're attempting to build. This is a common issue when the necessary development packages, particularly those related to Direct Rendering Manager (DRM), are not installed on your system.To solve this issue, you need to install the DRM development files. These are typically provided by the
libdrmpackage in most Linux distributions. The exact package name might vary slightly depending on your system's distribution, but you can try installing it using your system's package manager.For Debian/Ubuntu-based systems, you can install
libdrmdevelopment files using the following command:sudo apt-get install libdrm-devFor Fedora/RHEL-based systems, use:
sudo dnf install libdrm-develFor Arch Linux, use Pacman:
sudo pacman -S libdrmAfter installing the
libdrmdevelopment package, try runningsudo ninja installagain in yourvirglrendererbuild directory. This should resolve the compilation error related to the missingdrm.hfile, allowing the build process to proceed.If you encounter more missing headers or libraries, ensure that you have all the necessary development packages installed. The
virglrendererdocumentation or build instructions might list specific dependencies required for building from source. - User
sudo ninja install [1/9] Compiling C object src/libvirgl.a.p/drm_drm_context.c.o FAILED: src/libvirgl.a.p/drm_drm_context.c.o cc -Isrc/libvirgl.a.p -Isrc -I../src -I../src/gallium/include -I../src/gallium/auxiliary -I../src/gallium/auxiliary/util -I. -I.. -I../src/venus -I../src/drm -I../src/drm/drm-uapi -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O3 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -fvisibility=hidden -imacros /home/jayden/Downloads/virglrenderer/build/config.h -DHAVE_CONFIG_H=1 -fPIC -pthread -MD -MQ src/libvirgl.a.p/drm_drm_context.c.o -MF src/libvirgl.a.p/drm_drm_context.c.o.d -o src/libvirgl.a.p/drm_drm_context.c.o -c ../src/drm/drm_context.c In file included from ../src/drm/drm_context.c:5: /usr/include/xf86drm.h:40:10: fatal error: drm.h: No such file or directory 40 | #include <drm.h> | ^~~~~~~ compilation terminated. [2/9] Compiling C object src/libvirgl.a.p/drm_drm_renderer.c.o FAILED: src/libvirgl.a.p/drm_drm_renderer.c.o cc -Isrc/libvirgl.a.p -Isrc -I../src -I../src/gallium/include -I../src/gallium/auxiliary -I../src/gallium/auxiliary/util -I. -I.. -I../src/venus -I../src/drm -I../src/drm/drm-uapi -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O3 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -fvisibility=hidden -imacros /home/jayden/Downloads/virglrenderer/build/config.h -DHAVE_CONFIG_H=1 -fPIC -pthread -MD -MQ src/libvirgl.a.p/drm_drm_renderer.c.o -MF src/libvirgl.a.p/drm_drm_renderer.c.o.d -o src/libvirgl.a.p/drm_drm_renderer.c.o -c ../src/drm/drm_renderer.c In file included from ../src/drm/drm_renderer.c:15: /usr/include/xf86drm.h:40:10: fatal error: drm.h: No such file or directory 40 | #include <drm.h> | ^~~~~~~ compilation terminated. [3/9] Compiling C object src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o FAILED: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o cc -Isrc/libvirgl.a.p -Isrc -I../src -I../src/gallium/include -I../src/gallium/auxiliary -I../src/gallium/auxiliary/util -I. -I.. -I../src/venus -I../src/drm -I../src/drm/drm-uapi -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O3 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -fvisibility=hidden -imacros /home/jayden/Downloads/virglrenderer/build/config.h -DHAVE_CONFIG_H=1 -fPIC -pthread -MD -MQ src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o -MF src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o.d -o src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o -c ../src/drm/asahi/asahi_renderer.c In file included from ../src/drm/asahi/asahi_renderer.c:16: /usr/include/xf86drm.h:40:10: fatal error: drm.h: No such file or directory 40 | #include <drm.h> | ^~~~~~~ compilation terminated. [4/9] Compiling C object vtest/virgl_test_server.p/vtest_renderer.c.o ninja: build stopped: subcommand failed. jayden@jayden-macbookpro:~/Downloads/virglrenderer/build$ sudo dnf install libdrm-devel Last metadata expiration check: 0:06:02 ago on Sat 13 Apr 2024 08:39:36 PM EDT. allow_vendor_change is disabled. This option is currently not supported for downgrade and distro-sync commands Package libdrm-devel-2.4.120-1.fc39.aarch64 is already installed. Dependencies resolved. Nothing to do. Complete!
- Assistant
Given that you've already installed
libdrm-develbut are still encountering errors indicating thatdrm.his missing, it's likely that there's an issue with how include paths are being detected or specified during your build process.Here are a few steps you can follow to troubleshoot and potentially resolve this issue:
1. Verify
drm.hLocationFirst, make sure
drm.hactually exists on your system and locate it. You can use thefindcommand to do this:sudo find /usr/include -name drm.hThis command will search for
drm.hwithin/usr/include. If you find the file in a location not being searched by your compiler, you'll need to tell the compiler where to find it.2. Specify Include Directories
If
drm.his located in a non-standard directory that your compiler is not checking, you may need to specify this directory manually.You can add include directories to your build command with
-Iflags. For instance, ifdrm.his in/usr/local/include/drm, you could modify your build command as follows (this is a general example; specifics might vary based on how you're invoking the build process):cc ... -I/usr/local/include/drm ...For
ninja, you typically do not invokeccdirectly but rather would adjust the relevantmeson.build(or similar) file to include additional directories:include_directories = include_directories('/usr/local/include/drm')3. Check for Broken Packages
Since
libdrm-develis installed but headers aren't found, ensure your package isn't broken. You might try reinstalling it:sudo dnf reinstall libdrm-devel4. Environment Variables
Some build systems rely on environment variables to locate certain files. Although it's less common for header files, ensuring your
PKG_CONFIG_PATHis set correctly can help in some situations where dependencies are not found:export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfigAdjust paths as necessary for your system configuration.
5. Symbolic Links
If all else fails and the
drm.hfile exists but is not being recognized, creating a symbolic link from wheredrm.his located to a directory that is being searched by your compiler might work as a quick (but less preferred) fix.sudo ln -s /path/to/drm.h /usr/include/drm.hBe cautious with symbolic links though, as they can complicate future maintenance or updates to your development environment.
Conclusion
If after trying these steps you still encounter issues, consider checking the
virglrendererdocumentation for any known issues or prerequisites. Sometimes, project-specific mailing lists, forums, or issue trackers might also have information relevant to your problem. - User
/usr/include/libdrm
- Assistant
If you've discovered that
drm.hresides within/usr/include/libdrmbut the build process for your project is failing due to the compiler not findingdrm.h, it suggests that the include path forlibdrmisn't correctly set in the build configuration. The compiler needs to be explicitly told to search in/usr/include/libdrmfor header files.To solve this issue, you have a few options depending on how the project is configured.
1. Adjusting Include Directories in Build Configuration
If you are using a build system like
MesonorCMake, you usually can specify additional include directories.-
For Meson, locate the relevant
meson.buildfile and add/usr/include/libdrmto the include directories:inc_dirs = include_directories('/usr/include/libdrm') -
For CMake, in the
CMakeLists.txtfile, use theinclude_directories()command:include_directories(SYSTEM /usr/include/libdrm)
If the project uses a different build system or a custom one, look for where it specifies its include directories and add
/usr/include/libdrmaccordingly.2. Modify Compiler Flags Directly
For a more direct but less portable approach, you can modify the build commands or scripts to include the
-I/usr/include/libdrmflag in thegccorg++commands. This tells the compiler to include/usr/include/libdrmin its search path for header files.If you're invoking
gccdirectly or through a Makefile, you can adjust the command like so:gcc -I/usr/include/libdrm ... (rest of the command)3. Environment Variables
Although less commonly required for include paths, you can also adjust environment variables to hint at the correct include paths for your build tools:
- For
PKG_CONFIG_PATH, iflibdrmprovides a pkg-config file and your project uses pkg-config to discover library flags, ensure the path is correctly set:export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig - For
C_INCLUDE_PATHorCPLUS_INCLUDE_PATH, adding/usr/include/libdrmmight help, though this is generally more for command-line compilation rather than project-based builds:export C_INCLUDE_PATH=/usr/include/libdrm export CPLUS_INCLUDE_PATH=/usr/include/libdrm
4. Checking for Symlinks
Sometimes, a system might expect
drm.hto be in a more generic include path, like/usr/includedirectly. You could create a symbolic link as a workaround; however, consider this a last resort since it could affect other builds or package management:sudo ln -s /usr/include/libdrm/drm.h /usr/include/drm.hConclusion
Adjusting include paths is a common task in C/C++ development, especially when dealing with libraries installed in non-standard locations or when the build system doesn't automatically discover them. Start with the most appropriate method for your scenario and build system. Always refer back to the documentation for the build system you're using, as it might provide more specific or idiomatic ways to address the issue.
-
- User
sudo ninja install [1/8] Compiling C object src/libvirgl.a.p/drm_drm_context.c.o FAILED: src/libvirgl.a.p/drm_drm_context.c.o cc -Isrc/libvirgl.a.p -Isrc -I../src -I../src/gallium/include -I../src/gallium/auxiliary -I../src/gallium/auxiliary/util -I. -I.. -I../src/venus -I../src/drm -I../src/drm/drm-uapi -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O3 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -fvisibility=hidden -imacros /home/jayden/Downloads/virglrenderer/build/config.h -DHAVE_CONFIG_H=1 -fPIC -pthread -MD -MQ src/libvirgl.a.p/drm_drm_context.c.o -MF src/libvirgl.a.p/drm_drm_context.c.o.d -o src/libvirgl.a.p/drm_drm_context.c.o -c ../src/drm/drm_context.c In file included from /usr/include/xf86drm.h:40, from ../src/drm/drm_context.c:5: /usr/include/drm.h:1025:10: fatal error: drm_mode.h: No such file or directory 1025 | #include "drm_mode.h" | ^~~~~~~~~~~~ compilation terminated. [2/8] Compiling C object src/libvirgl.a.p/drm_drm_renderer.c.o FAILED: src/libvirgl.a.p/drm_drm_renderer.c.o cc -Isrc/libvirgl.a.p -Isrc -I../src -I../src/gallium/include -I../src/gallium/auxiliary -I../src/gallium/auxiliary/util -I. -I.. -I../src/venus -I../src/drm -I../src/drm/drm-uapi -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O3 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -fvisibility=hidden -imacros /home/jayden/Downloads/virglrenderer/build/config.h -DHAVE_CONFIG_H=1 -fPIC -pthread -MD -MQ src/libvirgl.a.p/drm_drm_renderer.c.o -MF src/libvirgl.a.p/drm_drm_renderer.c.o.d -o src/libvirgl.a.p/drm_drm_renderer.c.o -c ../src/drm/drm_renderer.c In file included from /usr/include/xf86drm.h:40, from ../src/drm/drm_renderer.c:15: /usr/include/drm.h:1025:10: fatal error: drm_mode.h: No such file or directory 1025 | #include "drm_mode.h" | ^~~~~~~~~~~~ compilation terminated. [3/8] Compiling C object src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o FAILED: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o cc -Isrc/libvirgl.a.p -Isrc -I../src -I../src/gallium/include -I../src/gallium/auxiliary -I../src/gallium/auxiliary/util -I. -I.. -I../src/venus -I../src/drm -I../src/drm/drm-uapi -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O3 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -fvisibility=hidden -imacros /home/jayden/Downloads/virglrenderer/build/config.h -DHAVE_CONFIG_H=1 -fPIC -pthread -MD -MQ src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o -MF src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o.d -o src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o -c ../src/drm/asahi/asahi_renderer.c In file included from /usr/include/xf86drm.h:40, from ../src/drm/asahi/asahi_renderer.c:16: /usr/include/drm.h:1025:10: fatal error: drm_mode.h: No such file or directory 1025 | #include "drm_mode.h" | ^~~~~~~~~~~~ compilation terminated. ninja: build stopped: subcommand failed. how do I include the /usr/include/libdrm folder in meson ninja?
- Assistant
To include the
/usr/include/libdrmdirectory in your Meson build system for a project that uses Ninja for its build process, you will modify themeson.buildconfiguration files. Meson uses these files to determine how your project should be built, including specifying additional include directories.Here's what you generally need to do:
-
Identify the Target:
- First, you need to identify the target (executable or library) which requires the additional include directory. This target is defined in one of your
meson.buildfiles, possibly in the root directory of your project or in a subdirectory.
- First, you need to identify the target (executable or library) which requires the additional include directory. This target is defined in one of your
-
Add the Include Directory:
- Once you've identified the target, you can add an
include_directoriescall to specify additional directories where the compiler should look for header files.
- Once you've identified the target, you can add an
Example
Suppose you have a target named
my_libraryin yourmeson.buildthat looks something like this:# Create a static library my_library = static_library('mylibname', sources: ['source1.c', 'source2.c', ...], dependencies: [some_dependency], c_args: ['-DSOME_DEFINITION=1'], )To add the
/usr/include/libdrmdirectory for this target, you would modify it as follows:# First, define the additional include directory libdrm_inc = include_directories('/usr/include/libdrm') # Then, add it to your target’s configuration my_library = static_library('mylibname', sources: ['source1.c', 'source2.c', ...], dependencies: [some_dependency], include_directories: libdrm_inc, # Add this line c_args: ['-DSOME_DEFINITION=1'], )Global Include Directories
If multiple targets in your project require access to the headers in
/usr/include/libdrm, you might add the include directory to your project's global configuration instead. You can do this near the top of your rootmeson.buildfile:# Add a global include directory inc_libdrm = include_directories('/usr/include/libdrm') # Now, pass `inc_libdrm` to any target that requires itUsing pkg-config (If Applicable)
If
libdrmprovides a pkg-config file, it's even better to use Meson'sdependencyfunction, as this will automatically set up include directories and linker flags.libdrm_dep = dependency('libdrm', version: '>=2.4', required: true) executable('my_executable_name', sources: ['main.c'], dependencies: [libdrm_dep], )This approach is preferred because it handles variations in installation paths across different systems and package managers.
Finally, after making changes to your
meson.buildfiles, you should configure your build directory (if it's not already done) withmeson setup <builddir>and then useninja -C <builddir>to build your project, which will now include the additional include directories in the compilation of the specified targets. -
- User
can I just passFAILED: src/libvirglrenderer.so.1.8.8 cc -o src/libvirglrenderer.so.1.8.8 src/libvirglrenderer.so.1.8.8.p/virglrenderer.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libvirglrenderer.so.1 src/gallium/libgallium.a src/mesa/libmesa.a src/libvirgl.a -lm -pthread /usr/lib64/libepoxy.so /usr/lib64/libX11.so -Wl,--end-group /usr/bin/ld: src/libvirgl.a.p/drm_drm_renderer.c.o: in function
drm_renderer_init': drm_renderer.c:(.text+0x24): undefined reference todrmGetVersion' /usr/bin/ld: drm_renderer.c:(.text+0x78): undefined reference todrmFreeVersion' /usr/bin/ld: drm_renderer.c:(.text+0xa8): undefined reference todrmOpenWithType' /usr/bin/ld: drm_renderer.c:(.text+0xe4): undefined reference todrmFreeVersion' /usr/bin/ld: src/libvirgl.a.p/drm_drm_renderer.c.o: in functiondrm_renderer_create': drm_renderer.c:(.text+0x1d8): undefined reference todrmOpenWithType' /usr/bin/ld: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o: in functionasahi_ccmd_syncobj_create': asahi_renderer.c:(.text+0xa8): undefined reference todrmIoctl' /usr/bin/ld: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o: in functionasahi_ccmd_syncobj_wait': asahi_renderer.c:(.text+0x15c): undefined reference todrmIoctl' /usr/bin/ld: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o: in functiongem_close': asahi_renderer.c:(.text+0x1dc): undefined reference todrmIoctl' /usr/bin/ld: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o: in functionasahi_ccmd_get_params': asahi_renderer.c:(.text+0x23c): undefined reference todrmIoctl' /usr/bin/ld: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o: in functionasahi_ccmd_submit': asahi_renderer.c:(.text+0x374): undefined reference todrmSyncobjCreate' /usr/bin/ld: asahi_renderer.c:(.text+0x398): undefined reference todrmIoctl' /usr/bin/ld: asahi_renderer.c:(.text+0x3b4): undefined reference todrmSyncobjExportSyncFile' /usr/bin/ld: asahi_renderer.c:(.text+0x3e8): undefined reference todrmSyncobjDestroy' /usr/bin/ld: asahi_renderer.c:(.text+0x414): undefined reference todrmSyncobjCreate' /usr/bin/ld: asahi_renderer.c:(.text+0x424): undefined reference todrmSyncobjImportSyncFile' /usr/bin/ld: asahi_renderer.c:(.text+0x44c): undefined reference todrmSyncobjCreate' /usr/bin/ld: asahi_renderer.c:(.text+0x47c): undefined reference todrmIoctl' /usr/bin/ld: asahi_renderer.c:(.text+0x4e4): undefined reference todrmSyncobjDestroy' /usr/bin/ld: asahi_renderer.c:(.text+0x4fc): undefined reference todrmSyncobjDestroy' /usr/bin/ld: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o: in functionasahi_ccmd_gem_new': asahi_renderer.c:(.text+0x58c): undefined reference todrmIoctl' /usr/bin/ld: asahi_renderer.c:(.text+0x5c8): undefined reference todrmIoctl' /usr/bin/ld: asahi_renderer.c:(.text+0x5f0): undefined reference todrmPrimeHandleToFD' /usr/bin/ld: asahi_renderer.c:(.text+0x714): undefined reference todrmIoctl' /usr/bin/ld: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o: in functionasahi_ccmd_ioctl_simple': asahi_renderer.c:(.text+0x7d0): undefined reference todrmIoctl' /usr/bin/ld: src/libvirgl.a.p/drm_asahi_asahi_renderer.c.o: in functionasahi_ccmd_gem_bind': asahi_renderer.c:(.text+0xd20): undefined reference todrmIoctl' /usr/bin/ld: src/libvirgl.a.p/drm_drm_context.c.o: in functiondrm_renderer_attach_resource': drm_context.c:(.text+0x98): undefined reference todrmPrimeFDToHandle' /usr/bin/ld: src/libvirgl.a.p/drm_drm_context.c.o: in functiondrm_renderer_export_opaque_handle': drm_context.c:(.text+0x258): undefined reference todrmPrimeHandleToFD' /usr/bin/ld: src/libvirgl.a.p/drm_drm_context.c.o: in functiondrm_renderer_get_blob': drm_context.c:(.text+0x464): undefined reference to `drmPrimeHandleToFD' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. - Assistant
The errors you're encountering during the linking phase are due to the linker (
ld) not being able to find the definitions for functions from the Direct Rendering Manager (DRM). These functions are typically found in thelibdrmlibrary. The messages likeundefined reference to 'drmOpenWithType'indicate that the compiler knows the function should exist (because it was declared in a header file the compiler saw), but the linker doesn't know where to find the actual implementation of the function.To solve this, you need to ensure the linker is instructed to link against
libdrm. This is generally done by adding-ldrmto the command line arguments of the linker, which tells it to search forlibdrmand link against it.Since you're using Meson and Ninja, you don't directly interact with the
ccorldcommands. Instead, you specify your project's dependencies in themeson.buildfiles, and Meson takes care of generating the appropriate build commands.You should ensure
libdrmis specified as a dependency in your project'smeson.buildfiles. Here's how you can do that using Meson'sdependencyfunction:drm_dep = dependency('libdrm', version: '>=2.4', required: true)Then, when you define your target (executable or library) that requires DRM, you add
drm_depto the list of dependencies:executable('your_program_name', sources: ['source1.c', 'source2.c', ...], dependencies: [drm_dep, ...other dependencies... ], )or
shared_library('libvirglrenderer', sources: [...], dependencies: [drm_dep, ...other dependencies... ], install: true, )Make sure to replace
your_program_name,source1.c,source2.c,libvirglrenderer, and[...other dependencies...]with the actual names and details relevant to your project.If you have not already, you may need to install
pkg-config(if not installed), as Meson commonly uses it to find the dependencies specified with thedependencyfunction:# For Debian/Ubuntu and derivatives: sudo apt-get install pkg-config # For Fedora/RHEL and derivatives: sudo dnf install pkg-config # For Arch Linux and derivatives: sudo pacman -S pkg-configAdditionally, ensure that
libdrmand its development headers are installed on your system:# For Debian/Ubuntu and derivatives: sudo apt-get install libdrm-dev # For Fedora/RHEL and derivatives: sudo dnf install libdrm-devel # For Arch Linux: sudo pacman -S libdrmAfter making these changes, reconfigure the build directory with Meson (if necessary) and run Ninja again to build your project.
- User
how do I install meson on fedora?
- Assistant
To install Meson on Fedora, you can use the
dnfpackage manager, which is the default package management system for Fedora. Meson is available in the default Fedora repositories, making the installation straightforward.Open your terminal and run the following command:
sudo dnf install mesonThis command will download and install the Meson build system and any required dependencies. After the installation is complete, you can verify the installation by checking the Meson version:
meson --versionThis command should output the version of Meson that was installed, confirming that the installation was successful.
Meson is a powerful build system that's designed to be as user-friendly as possible and supports modern programming languages and practices. It relies on Ninja (a small build system with a focus on speed) for its actual build tasks, so you may also want to ensure that Ninja is installed on your system. Usually, installing Meson through
dnfalso installs Ninja, but if it doesn't, you can install Ninja separately using the following command:sudo dnf install ninja-buildWith Meson and Ninja installed, you're ready to configure and build Meson-based projects on your Fedora system.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.