vegastrike / Vega-Strike-Engine-Source

Vega Strike Engine
Other
260 stars 44 forks source link

cmake fails on non-Debian Linux #801

Open stamasd opened 1 year ago

stamasd commented 1 year ago

After updating the engine tree today, cmake fails to generate a makefile. It's because it can't figure out which version of Debian I'm on. I don't use Debian (Funtoo is my distribution, similar to Gentoo) and there is no file /etc/debian_version

Relevant output:

-- Configuring Packaging for Linux -- Configuring Debian Packaging CMake Error at CMakeLists.txt:1313 (FILE): FILE failed to open for reading (No such file or directory):

/etc/debian_version

Looking for /home/silviu/games/vegastrike/Vega-Strike-Engine-Source/build/dependency.list Still need to generate dependency list SEND_WARNING!! Unsupported Debian version.

stamasd commented 1 year ago

I overcame this by manually configuring with Debian packaging disabled. FWIW I did not have to do this in the past.

stamasd commented 1 year ago

On further investigation, this may be because in the past month I have installed a version of dpkg on my system (was playing with installing some Debian packages) and cmake finds it and thinks incorrectly that I am on Debian. This issue may only apply to my very special case (a non-Debian system that has dpkg installed anyway) and I think this issue can be closed.

BenjamenMeyer commented 1 year ago

@stamasd So it primarily looks at /etc/os-release and the LSB Release information (lsb_release). It checks for dpkg-buildpackage and rpmbuild to determine if its able to build those packages regardless of the host - e.g cross platform package building. So what does your /etc/os-release file look like and do you have lsb_release installed?

FabioLolix commented 1 year ago

On Arch Linux this isn't happening, there is /etc/os-release; even when building in clean chroot where lsb_release isn't installed

Edited: Instead I confirm @stamasd issue

BenjamenMeyer commented 1 year ago

@FabioLolix could you post a copy of what /etc/os-release looks like on Arch? That's part of the FreeDesktop standards so I'd expect it even when LSB data isn't available.

FabioLolix commented 1 year ago

I've got a message on AURWeb and instead I confirm the problem https://aur.archlinux.org/packages/vegastrike-engine?all_deps=1#comment-938453

Will update later this evening

evertvorster commented 1 year ago
cat /etc/os-release

NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo
BenjamenMeyer commented 1 year ago

Okay looking a little closer.

@evertvorster - thanks.

@stamasd if you're hitting https://github.com/vegastrike/Vega-Strike-Engine-Source/blob/master/engine/CMakeLists.txt#L1313 then it's because it detected Debian's Package Tooling on your system via https://github.com/vegastrike/Vega-Strike-Engine-Source/blob/master/engine/FindLinuxDistro.cmake#L88 and it also did not detected the LSB Tooling per https://github.com/vegastrike/Vega-Strike-Engine-Source/blob/master/engine/FindLinuxDistro.cmake#L75 so it thinks the Debian /etc/debian_version data should then be available.

Essentially, the our CMake tooling checks for the available tools and configures CPack accordingly:

...
    IF(VS_CAN_BUILD_DEB)
        MESSAGE("-- Configuring Debian Packaging")
        # See https://cmake.org/cmake/help/v3.3/module/CPackDeb.html
        SET(CPACK_DEBIAN_PACKAGE_NAME "Vega-Strike")
        SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "maintainers@vega-strike.org")
        SET(CPACK_DEBIAN_PACKAGE_VERSION "${VEGASTRIKE_PKG_VERSION_STR}")
        # Debian Version: /etc/debian_version - <name>/<junk>
        IF (NOT LSB_EXISTS)
            SET(USE_DEBIAN_VERSION TRUE)
            FILE(READ "/etc/debian_version" DEBIAN_VERSION_DATA)
            STRING(REGEX MATCH "^(.+)\/.*$" DEBIAN_VERSION_DATA DEBIAN_RELEASE_VERSION)
        ELSE (NOT LSB_EXISTS)
            SET(USE_DEBIAN_VERSION FALSE)
            SET(DEBIAN_RELEASE_VERSION "Debian Derivative Release Version ${LSB_LINUX_DISTRIBUTION_CODENAME}")
        ENDIF (NOT LSB_EXISTS)
...

We probably should have a check to see if the /etc/debian_version file exists first; but the easiest way to fix it is to remove the Debian Tooling (dpkb-buildpackage).

@FabioLolix you only need lsb_release on Debian and perhaps RPM-based (RH/Fedora/SuSe) distros or if you have rpmbuild or dpkg-buildpackage installed. So I don't think it needs to be part of the AUR requirements; OTOH you're missing libxmu.

NOTE: I used https://github.com/vegastrike/build-system-docker-images/pull/45 to build an image to test locally. master builds just fine; but there's a few bugs on the 0.8.x side.

FabioLolix commented 1 year ago

you only need lsb_release on Debian and perhaps RPM-based (RH/Fedora/SuSe) distros or if you have rpmbuild or dpkg-buildpackage installed. So I don't think it needs to be part of the AUR requirements

I have added lsb_release to makedepends because I had an user complain https://aur.archlinux.org/packages/vegastrike-engine?all_deps=1#comment-938453 it will stay to prevent this corner case build error, it is only a 17,7 kB package

OTOH you're missing libxmu.

It is a depends of something else, Arch packages don't separate headers, etc

BenjamenMeyer commented 1 year ago

@FabioLolix opened up a couple PRs; please help validate the builds; I was seeing other issues with the 0.8.x builds. I can confirm it detects the Debian Packaging on Arch and correctly marks the Debian Distro as unknown. I do, however, run into other issues with Arch. Would appreciate some confirmation that this will build properly for you all.

This should also alleviate the need for inlcuding the lsb_release dependency. If it's there, it'll still use it; but if it isn't then there shouldn't be a problem. Feedback appreciated.

stamasd commented 1 year ago

@stamasd So it primarily looks at /etc/os-release and the LSB Release information (lsb_release). It checks for dpkg-buildpackage and rpmbuild to determine if its able to build those packages regardless of the host - e.g cross platform package building. So what does your /etc/os-release file look like and do you have lsb_release installed?

Here is my /etc/os-release: ID="funtoo" NAME="Funtoo" PRETTY_NAME="Funtoo Linux" ANSI_COLOR="0;34" HOME_URL="https://www.funtoo.org" BUG_REPORT_URL="https://bugs.funtoo.org"

No, I do not have lsb-release installed (the name of the package on Funtoo is sys-apps/lsb-release)

If I install that, then /etc/lsb-release reads DISTRIB_ID="Gentoo"

But again, that package is not installed by default on Funtoo.

One way to tell if the installed distribution is Gentoo or a Gentoo derivative is to check if a directory /etc/portage exists. And to differentiate between Funtoo and Gentoo, check for a file /etc/ego.conf. That file exists on Funtoo but does not exist on Gentoo.

BenjamenMeyer commented 1 year ago

@stamasd do the PRs I posted help you?

FabioLolix commented 1 year ago

The PRs worked for me