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 Raspberry Pi 5: _TIME_BITS=64 Requirement Conflict #958

Open
ComTols opened this issue Apr 27, 2024 · 5 comments
Open

Build Error on Raspberry Pi 5: _TIME_BITS=64 Requirement Conflict #958

ComTols opened this issue Apr 27, 2024 · 5 comments

Comments

@ComTols
Copy link

ComTols commented Apr 27, 2024

Hello,

I attempted to compile box86 on a Raspberry Pi 5 running Ubuntu Server 64-bit. However, I encountered a build error during the compilation process. Below are the steps I followed and the error messages that were produced.

Steps to reproduce:

  1. Cloned the box86 repository.
  2. Created a build directory and navigated into it.
  3. Ran the command: cmake .. -D RPI4ARM64=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo
  4. Followed by: make -j$(nproc)

The build process initiated successfully but failed with the following error messages related to time bits configuration:

In file included from /usr/arm-linux-gnueabihf/include/features.h:394,
                 from /usr/arm-linux-gnueabihf/include/bits/libc-header-start.h:33,
                 from /usr/arm-linux-gnueabihf/include/stdio.h:28,
                 from /home/comtols/box86/src/libtools/vkalign.c:3:
/usr/arm-linux-gnueabihf/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
   26 | #   error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
      |     ^~~~~
In file included from /usr/arm-linux-gnueabihf/include/features.h:394,
                 from /usr/arm-linux-gnueabihf/include/bits/libc-header-start.h:33,
                 from /usr/arm-linux-gnueabihf/include/stdio.h:28,
                 from /home/comtols/box86/src/libtools/myalign.c:3:
/usr/arm-linux-gnueabihf/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
   26 | #   error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
      |     ^~~~~
make[2]: *** [CMakeFiles/box86.dir/build.make:787: CMakeFiles/box86.dir/src/libtools/myalign.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/box86.dir/build.make:885: CMakeFiles/box86.dir/src/libtools/vkalign.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:370: CMakeFiles/box86.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

The error indicates a problem with the time bits configuration, specifically that _TIME_BITS=64 is set without the corresponding _FILE_OFFSET_BITS=64.

This issue seems to be related to the compiler or environment settings used in the build process. Any guidance or updates to address this issue would be greatly appreciated.

Thank you for your support and looking forward to a solution.

@ComTols
Copy link
Author

ComTols commented Apr 27, 2024

I've managed to bypass the build error by adjusting the compiler flags to explicitly define _TIME_BITS=32 using the following CMake command:

cmake .. -D RPI4ARM64=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_FLAGS="-D_TIME_BITS=32"

While this resolves the immediate compilation issues, I'm concerned about potential unintended consequences of setting _TIME_BITS to 32 on a 64-bit system. Could this affect the handling of time-related functions, especially with respect to long-term time calculations and compatibility with file systems that expect 64-bit time definitions? Any insights or suggestions on potential impacts or better solutions would be greatly appreciated. Thank you!

@ptitSeb
Copy link
Owner

ptitSeb commented Apr 27, 2024

I've managed to bypass the build error by adjusting the compiler flags to explicitly define _TIME_BITS=32 using the following CMake command:

cmake .. -D RPI4ARM64=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_FLAGS="-D_TIME_BITS=32"

While this resolves the immediate compilation issues, I'm concerned about potential unintended consequences of setting _TIME_BITS to 32 on a 64-bit system. Could this affect the handling of time-related functions, especially with respect to long-term time calculations and compatibility with file systems that expect 64-bit time definitions? Any insights or suggestions on potential impacts or better solutions would be greatly appreciated. Thank you!

Probably not a good idea to overload that globaly.

Better define that inside myalign.c and vkalign.c, the only 2 files where _FILE_OFFSET_BITS is undef. Maybe _TIME_BITS can be undef too there?

@redkwind
Copy link

redkwind commented May 1, 2024

Hey! im also having this same issue trying to build box86 for my OrangePi 5B running Ubuntu 24.04.
This doesn't happen in 22.04 so it must be something related to the newest ubuntu release.

im using this command to start the build as shown in the compiling guide

mkdir build; cd build; cmake .. -DRK3588=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j4

Captura de pantalla 2024-05-01 082312

@cantalupo555
Copy link
Sponsor

I have the same problem with Ubuntu 24.04 (Orange Pi 5)
In Ubuntu 22.04 there was no such error.

[ 51%] Building C object CMakeFiles/box86.dir/src/emu/x87emu_private.c.o
[ 51%] Building C object CMakeFiles/box86.dir/src/libtools/auxval.c.o
[ 51%] Building C object CMakeFiles/box86.dir/src/libtools/myalign.c.o
In file included from /usr/arm-linux-gnueabihf/include/features.h:394,
                 from /usr/arm-linux-gnueabihf/include/bits/libc-header-start.h:33,
                 from /usr/arm-linux-gnueabihf/include/stdio.h:28,
                 from /home/cantalupo/box86/src/libtools/myalign.c:3:
/usr/arm-linux-gnueabihf/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
   26 | #   error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
      |     ^~~~~
make[2]: *** [CMakeFiles/box86.dir/build.make:787: CMakeFiles/box86.dir/src/libtools/myalign.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 51%] Building C object CMakeFiles/box86.dir/src/libtools/myalign64.c.o
make[1]: *** [CMakeFiles/Makefile2:370: CMakeFiles/box86.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

@mariuszbrz
Copy link

Probably not a good idea to overload that globaly.

Better define that inside myalign.c and vkalign.c, the only 2 files where _FILE_OFFSET_BITS is undef. Maybe _TIME_BITS >can be undef too there?
@ptitSeb , Thank You! 🍻
I added
#undef _TIME_BITS
in ./src/libtools/vkalign.c and and ./src/libtools/myalign.c
as You suggested, and it fixed the compilation error, and hopefully performance impact is lower than overload it globally.

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