build: native build fails with GCC 15 (ubuntu-26.04): implicit fopen64 in vendored ioapi.c

オープン
#118 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@kalwalt がすでに取り組んでいます。

2026年11月17日 から。

評価

この issue はまだ評価されていません。

説明

bug CI

Summary

The native build fails with GCC 15. GitHub's ubuntu-latest now runs ubuntu-26.04 with GCC 15.2.0, and there lib/SRC/ARUtil/ioapi.c no longer compiles. #117 pins the test job to ubuntu-24.04 as a stopgap. This issue is for the real fix: make the native build work with GCC 15 without touching lib/SRC/**, which CONTRIBUTING keeps unmodified, by adding a compile definition in the build system.

The errors

From run 44119363224 (#116), job build, step "Build and test WebARKitLib":

lib/SRC/ARUtil/ioapi.c:144:16: error: implicit declaration of function ‘fopen64’; did you mean ‘fopen’? [-Wimplicit-function-declaration]
lib/SRC/ARUtil/ioapi.c:144:14: error: assignment to ‘FILE *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
lib/SRC/ARUtil/ioapi.c:240:11: error: implicit declaration of function ‘ftello64’; did you mean ‘ftello’? [-Wimplicit-function-declaration]
lib/SRC/ARUtil/ioapi.c:298:9: error: implicit declaration of function ‘fseeko64’; did you mean ‘fseeko’? [-Wimplicit-function-declaration]
make[2]: *** [.../WebARKitNFT.dir/.../lib/SRC/ARUtil/ioapi.c.o] Error 1

The two runs compared

Run Branch Image Compiler Result
40030611008 dev ubuntu-24.04 GNU 13.3.0 green
44119363224 feat/115-external-detector (#116) ubuntu-26.04 GNU 15.2.0 fails in ioapi.c

The failure has nothing to do with #116. Any push to ubuntu-latest hits it.

Why it happens

  • ioapi.h defines _GNU_SOURCE under __linux, so that glibc declares the *64 functions.
  • But ioapi.c includes <stdlib.h> and <string.h> before ioapi.h. By the time _GNU_SOURCE is defined, glibc's feature macros are already fixed, so fopen64, ftello64 and fseeko64 are never declared.
  • GCC 13 accepted the implicit declarations with a warning. Since GCC 14, -Wimplicit-function-declaration and -Wint-conversion are errors by default in C.

Possible fixes (build system only)

Either definition would go on the minizip sources (ioapi.c, unzip.c, zip.c), or on the whole WebARKitNFT target, in WebARKit/WebARKitTrackers/WebARKitNFT/CMakeLists.txt:

  • USE_FILE32API. The Emscripten build already sets it on exactly these three files. ioapi.h then maps fopen64 / ftello64 / fseeko64 to fopen / ftell / fseek. The cost is 32-bit file offsets in minizip; probably irrelevant for marker archives, but worth confirming.
  • _LARGEFILE64_SOURCE, passed on the command line so it applies before any system header. glibc then declares the *64 functions and the code keeps 64-bit offsets.
  • _GNU_SOURCE, passed on the command line. This is what ioapi.h already tries to do. Its define only comes too late because ioapi.c includes <stdlib.h> first, so -D_GNU_SOURCE from the build system is the closest to what the header intended. It also enables the other GNU extensions for whichever files it is applied to.

Whichever is chosen, CI should go back to ubuntu-latest, or move to a pinned ubuntu-26.04, once the build is green on GCC 15.

Scope: open-ended

The build stopped at ioapi.c, so nothing compiled after it has been tried with GCC 15. The jump from GCC 13 to 15 may surface more errors than these:

  • elsewhere in the vendored C sources;
  • in the OpenCV-based WebARKitLib target;
  • in the tests.

A pinned ubuntu-26.04 job, or a local GCC 15 build, is the way to find the full list before deciding on the fix.

Related: #117 (the stopgap pin), #116 (where the failure first showed up).

主要言語
C++
スター
21
フォーク
8
平均マージ
3時間 42分
マージ済み PR(30日)
22

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

webarkit/WebARKitLib のほかの issue

webarkit/WebARKitLib の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。