[libpng] No hardware optimisation enabled for PowerPC architecture
- Dominant language
- CMake
- Stars
- 27.5k
- Forks
- 7.7k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 321
Description
**Describe the bug**
I ran into errors when compiling my [Raytracing demo app](https://github.com/GPSnoopy/RayTracingInVulkan.git). Please refer to *Failure logs* section for more details
**Environment**
- OS: Linux (Fedora 40 ppc64le)
- Compiler: gcc (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0)
**To Reproduce**
Steps to reproduce the behavior:
```
$ git clone https://github.com/GPSnoopy/RayTracingInVulkan.git
$ cd RayTracingInVulkan
$ mkdir -p build
$ cd build
$ git clone https://github.com/Microsoft/vcpkg.git vcpkg.linux
$ cd vcpkg.linux
$ vcpkg install \
boost-exception:ppc64le-linux \
boost-program-options:ppc64le-linux \
boost-stacktrace:ppc64le-linux \
glfw3:ppc64le-linux \
glm:ppc64le-linux \
imgui[core,freetype,glfw-binding,vulkan-binding]:ppc64le-linux \
stb:ppc64le-linux \
tinyobjloader:ppc64le-linux
$ cd ../..
$ mkdir --parents build/linux
$ cd build/linux
$ cmake -D CMAKE_MAKE_PROGRAM=make -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ -D CMAKE_BUILD_TYPE=Release -D VCPKG_TARGET_TRIPLET=ppc64le-linux -D CMAKE_TOOLCHAIN_FILE=../vcpkg.linux/scripts/buildsystems/vcpkg.cmake ../..
$ make -j32
```
**Expected behavior**
No error
**Failure logs**
```
[ 94%] Building CXX object src/CMakeFiles/RayTracer.dir/ModelViewController.cpp.o
[ 95%] Building CXX object src/CMakeFiles/RayTracer.dir/RayTracer.cpp.o
[ 98%] Building CXX object src/CMakeFiles/RayTracer.dir/UserInterface.cpp.o
[ 98%] Building CXX object src/CMakeFiles/RayTracer.dir/SceneList.cpp.o
[100%] Linking CXX executable ../bin/RayTracer
/usr/bin/ld: /home/tle/Work/RayTracingInVulkan/build/vcpkg.linux/installed/ppc64le-linux/lib/libpng16.a(pngrutil.c.o): in function `png_read_filter_row':
pngrutil.c:(.text+0x8a08): undefined reference to `png_init_filter_functions_vsx'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:931: bin/RayTracer] Error 1
make[1]: *** [CMakeFiles/Makefile2:142: src/CMakeFiles/RayTracer.dir/all] Error 2
make: *** [Makefile:91: all] Error
```
**Additional context**
That is likely caused by the lacking of VSX support. From what I could tell is that `libpng` does opt-in the VSX optimisation option, please refer to [codes](https://github.com/pnggroup/libpng/blob/libpng16/configure.ac#L368-L372)
However it's seems to me it is not the case.
I guess the vcpkg port might have to handle that logic instead... (though I am not sold of that idea)
My ugly pseudocodes are kinda like this:
```
if(PPC64LE OR PPC64)
add_definitions(-DPNG_POWERPC_VSX_OPT=2) # enabled
else()
add_definitions(-DPNG_POWERPC_VSX_OPT=0) # disabled
endif()
```
Contributor guide
Assessment
This issue has not been assessed yet.