BRL-CAD / brlcad

BRL-CAD is a powerful cross-platform open source combinatorial solid modeling system
https://brlcad.org
Other
731 stars 147 forks source link

Linux compilation error bext/geogram #168

Open envolution opened 3 days ago

envolution commented 3 days ago

I have also tried with release tarball 7.40.2 that had the same error

Arch Linux gcc/g++ (GCC) 14.2.1 20240910 cmake.log

cmake version 3.31.0

CFLAGS="${CFLAGS} -lm" cmake \ -S . \ -G Ninja \ -B "${srcdir}/build" \ "-DCMAKE_INSTALL_PREFIX=/opt/brlcad" \ "-DCMAKE_BUILD_TYPE=Release" \ -DBRLCAD_BUNDLED_LIBS=ON \ -DBRLCAD_ENABLE_STRICT=NO \ -DBRLCAD_ENABLE_QT=ON 2>&1 | \ tee cmake.log

stderr output is:
...skipping to end...
 "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "_FORTIFY_SOURCE" redefined
...
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition
/tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD/src/lib/geogram/third_party/stb_image/stb_image.h: In function 'stbi__parse_png_file.constprop':
/tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD/src/lib/geogram/third_party/stb_image/stb_image.h:5166:56: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5166 |                   for (k = 0; k < s->img_n; ++k) tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger
      |                                                        ^
/tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD/src/lib/geogram/third_party/stb_image/stb_image.h:5082:25: note: at offset 3 into destination object 'tc' of size 3
 5082 |    stbi_uc has_trans=0, tc[3]={0};
      |                         ^
make[3]: *** [Makefile:156: all] Error 2

CMake Error at /tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD-stamp/GEOGRAM_BLD-build-Release.cmake:47 (message):
  Stopping after outputting logs.

make[2]: *** [geogram/CMakeFiles/GEOGRAM_BLD-install.dir/build.make:83: geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD-stamp/GEOGRAM_BLD-build] Error 1
make[1]: *** [CMakeFiles/Makefile2:3397: geogram/CMakeFiles/GEOGRAM_BLD-install.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
starseeker commented 2 days ago

Could you try building geogram itself as a stand-alone build? If the error persists there (it should) then a bug report should be submitted to that project. It looks like the stb_image header is where this is coming from, so the fix will probably be to either update geogram's stb_image or fix stb_image itself.

envolution commented 2 days ago

BrunoLevy/geogram compiles ok on it's own. I did do a diff compare against stb_image/stb_image.h for brlcad and geogram and they matched. I should let you know I did create a patch for slacon.c(bext/geogram/geogram/src/lib/third_party/numerics/SUPERLU/slacon2.c) slacon_idamax_isamax.patch.txt before capturing the log. This is the compilation log without the patch:

-- stderr output is:
/tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD/src/lib/third_party/numerics/SUPERLU/slacon2.c: In function 'slacon2_':
/tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD/src/lib/third_party/numerics/SUPERLU/slacon2.c:163:27: error: passing argument 2 of 'idamax_' from incompatible pointer type [-Wincompatible-pointer-types]
  163 |     isave[1] = idamax_(n, &x[0], &c__1);  /* j */
      |                           ^~~~~
      |                           |
      |                           float *
/tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD/src/lib/third_party/numerics/SUPERLU/slacon2.c:25:27: note: expected 'double *' but argument is of type 'float *'
   25 | extern int idamax_(int *, double *, int *);
      |                           ^~~~~~~~
make[5]: *** [src/lib/third_party/numerics/CMakeFiles/geogram_num_3rdparty.dir/build.make:7933: src/lib/third_party/numerics/CMakeFiles/geogram_num_3rdparty.dir/SUPERLU/slacon2.c.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:290: src/lib/third_party/numerics/CMakeFiles/geogram_num_3rdparty.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
In file included from /tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD/src/lib/geogram/image/image_serializer_stb.cpp:85:
/tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD/src/lib/geogram/third_party/stb_image/stb_image.h: In function 'int stbi__parse_png_file(stbi__png*, int, int)':
/tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD/src/lib/geogram/third_party/stb_image/stb_image.h:5166:56: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5166 |                   for (k = 0; k < s->img_n; ++k) tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger
      |                                                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/brl/src/build/bext_build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD/src/lib/geogram/third_party/stb_image/stb_image.h:5082:25: note: at offset 3 into destination object 'tc' of size 3
 5082 |    stbi_uc has_trans=0, tc[3]={0};
      |                         ^~
make[3]: *** [Makefile:156: all] Error 2

make[2]: *** [geogram/CMakeFiles/GEOGRAM_BLD-install.dir/build.make:83: geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD-stamp/GEOGRAM_BLD-build] Error 1
make[1]: *** [CMakeFiles/Makefile2:3132: geogram/CMakeFiles/GEOGRAM_BLD-install.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
starseeker commented 7 hours ago

Hmm. I'm surprised it compiles OK alone. Can you try https://github.com/BRL-CAD/geogram/tree/888172e37ea4729469fa2c5dbbc15ba68b8c234e as a stand-alone build? If that fails, I guess the next step will be figuring out what changed compared to BrunoLevy/geogram (or whether one of our build options in https://github.com/BRL-CAD/bext/blob/main/geogram/CMakeLists.txt is a problem.

envolution commented 3 hours ago

It compiled but with some caveats: It was missing some third-party directories: triangle, tetgen, HLBFGS - I took them from the 'main' branch

/tmp/geogram/src/lib/third_party/numerics/SUPERLU/slacon2.c: In function ‘slacon2_’:
/tmp/geogram/src/lib/third_party/numerics/SUPERLU/slacon2.c:163:27: error: passing argument 2 of ‘idamax_’ from incompatible pointer type [-Wincompatible-pointer-types]
  163 |     isave[1] = idamax_(n, &x[0], &c__1);  /* j */
      |                           ^~~~~
      |                           |
      |                           float *
/tmp/geogram/src/lib/third_party/numerics/SUPERLU/slacon2.c:25:27: note: expected ‘double *’ but argument is of type ‘float *’
   25 | extern int idamax_(int *, double *, int *);
      |                           ^~~~~~~~
make[2]: *** [src/lib/third_party/numerics/CMakeFiles/geogram_num_3rdparty.dir/build.make:7933: src/lib/third_party/numerics/CMakeFiles/geogram_num_3rdparty.dir/SUPERLU/slacon2.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1301: src/lib/third_party/numerics/CMakeFiles/geogram_num_3rdparty.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

after applying the slacon2 patch I referred to in my second comment, the geogram branch you linked compiled fully. I do have a github actions script that compiles brlcad for arch that exhibits the same problems if you see any value in that I could trim it down to reproduce the error for you. I'm also happy to perform any tests you'd like locally.