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 error on Fedora 33 (magic.h: No such file or directory) #48

Closed
Calinou opened this issue Dec 6, 2020 · 9 comments · Fixed by #69
Closed

Build error on Fedora 33 (magic.h: No such file or directory) #48

Calinou opened this issue Dec 6, 2020 · 9 comments · Fixed by #69

Comments

@Calinou
Copy link
Contributor

Calinou commented Dec 6, 2020

While working on #47, I stumbled upon the following build error:

[ 44%] Building CXX object CMakeFiles/ImHex.dir/source/views/view_pattern.cpp.o
/ImHex/source/views/view_pattern.cpp:12:10: fatal error: magic.h: No such file or directory
   12 | #include <magic.h>
      |          ^~~~~~~~~

I'm also getting the same build error on my bare metal Fedora 33 system (outside the Docker container, that is).

@WerWolv
Copy link
Owner

WerWolv commented Dec 6, 2020

This file gets provided by libmagic which, at least on Arch and mingw, gets provided together with the file utility. Make sure you have libmagic properly installed.

@Calinou
Copy link
Contributor Author

Calinou commented Dec 6, 2020

The file and file-libs packages are already installed, and I can't find libmagic using dnf search libmagic 🙁

dnf search magic doesn't bring relevant results either (mainly Python and Perl bindings).

@WerWolv
Copy link
Owner

WerWolv commented Dec 6, 2020

Weird. I'd have thought this is fairly standard on every linux distro. On Arch Linux, the file comes from the core/file package:

➜  include sudo pacman -F /usr/include/magic.h
usr/include/magic.h is owned by core/file 5.39-1

https://www.archlinux.org/packages/core/x86_64/file/

@Calinou
Copy link
Contributor Author

Calinou commented Dec 7, 2020

@laguf1 Per locate libmagic, I have libmagic on my system as /usr/lib64/libmagic.so.1 and /usr/lib64/libmagic.so.1.0.0.

@Calinou
Copy link
Contributor Author

Calinou commented Dec 7, 2020

@laguf1 There's no such package in the Fedora repositories, other than file-libs which I already have installed:

file-libs.x86_64 : Libraries for applications using libmagic

Maybe I have to compile it from source, but that feels kind of sketchy to have to do it for such a common library 🙁

brianredbeard added a commit to brianredbeard/ImHex that referenced this issue Dec 8, 2020
Due to differences in package names between Deb based systems, Arch
Linux, and RPM based systems the package containing the development
headers for file were missing from the Fedora dependencies script.

This includes the package `file-devel`, which is the package which
resolves the issue.

In Fedora, one can identify the package providing a specific file using
the verb "whatprovides" with the command dnf, e.g.:

    [~]$ dnf whatprovides /usr/include/magic.h
    Last metadata expiration check: 4 days, 0:23:05 ago on Fri 04 Dec 2020 09:06:53 AM PST.
    file-devel-5.39-3.fc33.i686 : Libraries and header files for file development
    Repo        : fedora
    Matched from:
    Filename    : /usr/include/magic.h

    file-devel-5.39-3.fc33.x86_64 : Libraries and header files for file development
    Repo        : @System
    Matched from:
    Filename    : /usr/include/magic.h

    file-devel-5.39-3.fc33.x86_64 : Libraries and header files for file development
    Repo        : fedora
    Matched from:
    Filename    : /usr/include/magic.h

If one is unsure of the specific path, globbing may be used (but must be
quoted):

    dnf whatprovides "*/magic.h"

Resolves WerWolv#48
WerWolv added a commit that referenced this issue Dec 11, 2020
* add glm to arch deps

After running got `None of the required 'glm' found`. This fixes that

* dist/fedora: Include file magic headers

Due to differences in package names between Deb based systems, Arch
Linux, and RPM based systems the package containing the development
headers for file were missing from the Fedora dependencies script.

This includes the package `file-devel`, which is the package which
resolves the issue.

In Fedora, one can identify the package providing a specific file using
the verb "whatprovides" with the command dnf, e.g.:

    [~]$ dnf whatprovides /usr/include/magic.h
    Last metadata expiration check: 4 days, 0:23:05 ago on Fri 04 Dec 2020 09:06:53 AM PST.
    file-devel-5.39-3.fc33.i686 : Libraries and header files for file development
    Repo        : fedora
    Matched from:
    Filename    : /usr/include/magic.h

    file-devel-5.39-3.fc33.x86_64 : Libraries and header files for file development
    Repo        : @System
    Matched from:
    Filename    : /usr/include/magic.h

    file-devel-5.39-3.fc33.x86_64 : Libraries and header files for file development
    Repo        : fedora
    Matched from:
    Filename    : /usr/include/magic.h

If one is unsure of the specific path, globbing may be used (but must be
quoted):

    dnf whatprovides "*/magic.h"

Resolves #48

* dist: Prevent already installed packages in ArchLinux and MSYS2.

Use --needed option with pacman to prevent it.

* Add script to install dependencies on Debian/Ubuntu.

Tested with Xubuntu 20.04 and Debian testing
(in today's Docker image bitnami/minideb).

Update README.md.

* ci: rework (#31)

* Support non standard LLVM library names (#86)

This fix openSUSE and Gentoo issue mentioned in #37 (comment).

(tested on openSUSE tumbleweed via Docker)

I also took the liberty of renaming llvm_lib to llvm_demangle_lib to be more specific in the ``CMakeLists.txt``.

* Implement proper DPI handling

* Implement basic custom font support

* Fix building on windows

* Hopefully fix fonts on Windows

* Fix several scaling issues

* Replace font renderer with freetype

* Updated CI and dependency scripts

* Rebuild default font atlas

* Correct platform detection macro for mingw

* Fixed PKGBUILD

Co-authored-by: brockelmore <31553173+brockelmore@users.noreply.github.com>
Co-authored-by: Brian 'Redbeard' Harrington <redbeard@dead-city.org>
Co-authored-by: Biswapriyo Nath <nathbappai@gmail.com>
Co-authored-by: Stéphane Gourichon <stephane.gourichon@fidergo.fr>
Co-authored-by: umarcor <38422348+umarcor@users.noreply.github.com>
Co-authored-by: Mary <me@thog.eu>
Co-authored-by: WerWolv <werwolv98@gmail.com>
@josevnz
Copy link

josevnz commented Apr 4, 2021

If you are using Fedora, you only need to do this:

sudo dnf install -y file-devel file-libs

@IS4Code
Copy link

IS4Code commented Dec 8, 2022

@iTrooz
Copy link
Collaborator

iTrooz commented Dec 8, 2022

I don't understand, how does this relate to the issue ? Is there a package needed that is in this repository ?

@IS4Code
Copy link

IS4Code commented Dec 8, 2022

@iTrooz Sorry, should have been more descriptive ‒ a search for missing magic.h (for a different software) led me here, but installing file-devel helped only after enabling PowerTools.

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

Successfully merging a pull request may close this issue.

6 participants
@Calinou @IS4Code @WerWolv @iTrooz @josevnz and others