Can't build Nokia HEIF library with make - cmake

I'm trying to build the HEIF library in https://github.com/nokiatech/heif, but I'm having no luck.
I have CMake and the latest version of MinGW installed. I'm following the steps to build the library but I'm getting an error.
The first step, which is this:
cd heif/build
cmake --help
cmake ../srcs -G"<Generator listed by above command for your target platform>"
works, but the second step, which is this:
cmake --build .
seems to be working but when it gets to 41% done I get this error:
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp: In constructor 'HEIF::FileStream::FileStream(const char*)':
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp:44:9: error: 'fopen_s' was not declared in this scope
fopen_s(&m_file, filename, "rb");
^~~~~~~
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp:44:9: note: suggested alternative: 'fopen'
fopen_s(&m_file, filename, "rb");
^~~~~~~
fopen
reader\CMakeFiles\heif_static.dir\build.make:93: recipe for target 'reader/CMakeFiles/heif_static.dir/heifstreamfile.cpp.obj' failed
mingw32-make.exe[2]: *** [reader/CMakeFiles/heif_static.dir/heifstreamfile.cpp.obj] Error 1
mingw32-make.exe[2]: Leaving directory 'C:/Users/dantelo/Documents/heif-master/build'
CMakeFiles\Makefile2:233: recipe for target 'reader/CMakeFiles/heif_static.dir/all' failed
mingw32-make.exe[1]: *** [reader/CMakeFiles/heif_static.dir/all] Error 2
mingw32-make.exe[1]: Leaving directory 'C:/Users/dantelo/Documents/heif-master/build'
Makefile:85: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
I'm on Windows 10 in case that's relevant. I have no idea why this is happening. Any help appreciated

It seems that fopen_s is only present in the C library provided by Microsoft, i.e. in MSVC. Source: Is there a way to use fopen_s() with GCC or at least create a #define about it?
Your best bet is then switching to MSVC, because the code you have was apparently never tested with MinGW, as it cannot be compiled by the latter.
Alternatively, if you are feeling lucky, you can just use some #define tricks to convert fopen_s to the standard fopen (see the answers in the linked question) and hope that this is the only incompatibility in the code.

Related

error: no C99 compiler found, eudev requires a C99 compiler

I executed the command "make" after the configurations on the menuconfig of buildroot and then this error appeared.
It appears when i enable eudev.
Can someone help me???
when i do gcc --std=c99
the output is:
gcc: fatal error: no input files
compilation terminated.
You must inform your c++ or c file in the console:
gcc --std=c99 you_source_code.cpp
If you give more information about what you are doing will help understand your problem.

undefined symbol: __afl_area_ptr when trying to compile Kisak strike

I want to fuzz the map loading feature in counter strike. The source code for csgo got leaked a while back and here is a build which you can compile https://github.com/SwagSoftware/Kisak-Strike . However, when I try to compile it using this command:
AFL_USE_ASAN=1 PERSIST=1 cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_ROCKETUI=ON -DFREETYPE_LIBRARY=/usr/lib/x86_64-linux-gnu/libfreetype.so -DFREETYPE_INCLUDE_DIRS=/usr/include/freetype2/freetype/ -DUSE_KISAK_PHYSICS=ON -DCMAKE_C_COMPILER=/home/cyberhacker/Asioita/Hakkerointi/Counterstrikestuff/aflpp/afl-gcc-fastthing/AFLplusplus/afl-gcc-fast -DCMAKE_CXX_COMPILER=/home/cyberhacker/Asioita/Hakkerointi/Counterstrikestuff/aflpp/afl-gcc-fastthing/AFLplusplus/afl-g++-fast ..
and then when i try to run ./csgo_linux64 , it throws this error:
Failed to load the launcher(bin/linux64/launcher_client.so) (/home/cyberhacker/Asioita/Csgocompile/withjump/game/bin/linux64/libtier0_client.so: undefined symbol: __afl_area_ptr)
I am expecting it to just work as usual (same as with the regular build). It works completely fine when I try to compile it normally with this command:
cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_ROCKETUI=ON -DFREETYPE_LIBRARY=/usr/lib/x86_64-linux-gnu/libfreetype.so -DFREETYPE_INCLUDE_DIRS=/usr/include/freetype2/freetype/ -DUSE_KISAK_PHYSICS=ON -DCMAKE_C_COMPILER=/usr/bin/cc -DCMAKE_CXX_COMPILER=/usr/bin/c++ ..
and then make -j8
I searched a bit and found this: this . In that conversation they say that this error can be cause by compiling with afl-gcc but then linking with normal gcc or ld. However this is not the cause of my problem since I have looked through the cmake log files and the binaries are being linked with afl-g++-fast so this shouldn't be a problem in my case. I read somewhere that the libraries should be statically included, not dynamic but I do not think that it is a necessity. Feel free to look at the Kisak strike source code if you want to (obviously).

Custom build command does not work with `cargo publish` because CMake says the path would exceed CMAKE_OBJECT_PATH_MAX

My project can be built and run locally, but when running cargo publish I get an error:
PS C:\Users\jonat\Projects\vulkano_blas> cargo publish
Updating crates.io index
Packaging vulkano_blas v0.1.0 (C:\Users\jonat\Projects\vulkano_blas)
Verifying vulkano_blas v0.1.0 (C:\Users\jonat\Projects\vulkano_blas)
Compiling autocfg v1.0.0
Compiling lazy_static v1.4.0
Compiling maybe-uninit v2.0.0
Compiling libc v0.2.73
Compiling cfg-if v0.1.10
Compiling cc v1.0.58
Compiling proc-macro2 v1.0.19
Compiling scopeguard v1.1.0
Compiling unicode-xid v0.2.1
Compiling syn v1.0.35
Compiling vulkano v0.19.0
Compiling either v1.5.3
Compiling smallvec v1.4.1
Compiling vk-sys v0.5.2
Compiling half v1.6.0
Compiling fnv v1.0.7
Compiling itertools v0.9.0
Compiling crossbeam-utils v0.7.2
Compiling memoffset v0.5.5
Compiling crossbeam-epoch v0.8.2
Compiling shared_library v0.1.9
Compiling cmake v0.1.44
Compiling quote v1.0.7
Compiling shaderc-sys v0.6.2
Compiling crossbeam-queue v0.2.3
Compiling crossbeam-channel v0.4.3
Compiling crossbeam-deque v0.7.3
Compiling crossbeam v0.7.3
The following warnings were emitted during compilation:
warning: System installed library not found. Falling back to build from source
error: failed to verify package tarball
Caused by:
failed to run custom build command for `shaderc-sys v0.6.2`
Middle part removed due to its size
--- stderr
CMake Warning in spirv-tools/source/reduce/CMakeLists.txt:
The object file directory
C:/Users/jonat/Projects/vulkano_blas/target/package/vulkano_blas-0.1.0/target/debug/build/shaderc-sys-81aff4f7b9007197/out/build/spirv-tools/source/reduce/CMakeFiles/SPIRV-Tools-reduce.dir/./
has 191 characters. The maximum full path to an object file is 250
characters (see CMAKE_OBJECT_PATH_MAX). Object file
remove_unreferenced_instruction_reduction_opportunity_finder.cpp.obj
cannot be safely placed under this directory. The build may not work
correctly.
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_ASM_COMPILER
CMAKE_ASM_FLAGS
thread 'main' panicked at '
command did not execute successfully, got: exit code: 1
build script failed, must exit now', C:\Users\jonat\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.44\src\lib.rs:885:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Where does the problem lie? And how could I approach fixing this?
As the error says, the path is too long for CMake / Windows.
You might try to enable Long Paths support in Windows, or put your project in a shallower path.
Building in a shallower directory worked for me:
#.cargo/config.toml
[build]
# fixes CMAKE_OBJECT_PATH_MAX
target-dir = "C:/temp/crate_name"
While this can also be done with a compiler flag, that is not recommended because cargo clean etc will not work as expected.
A side note, Ive had some runtime linker errors using this method with embuild and an esp32. The solution there was to move the entire repo closer to root and keep the default target dir, its a bummer but no two ways about it.

Recompiling and Problems with cmake

first sry for my gramma or my faults, i'm german but i'll try my best ;)
OK, now straight to the problem:
I'm trying to recompile my source but everytime, i got some faults.
So becouse my knowledge of cmake isn't so far, i hope to find help from you.
The project is about an azerothcore privat wow server and it's first to add thoes modules (CMakeList.txt's below) and to update the core itself.
Everytime, while trying "make -j 4; make install" the latest fail the console shows is
CMake Error at CMakeLists.txt:5 (CU_SET_PATH):
Unknown CMake command "CU_SET_PATH".
-- Configuring incomplete, errors occurred!
See also "/home/wajmanor/azerothcore/build/CMakeFiles/CMakeOutput.log".
Makefile:132: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Thoses helps i found with google everytime want to see the log-file, and that's why i attached it already ;):
CMakeOutput.log
For the Advice (thx to Tsyvarev ), i add the both CMakeList.txt's that could couse the problem:
Mod Nr. 1
cmake_minimum_required(VERSION 3.10)
AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/WorldChat.cpp")
AC_ADD_SCRIPT_LOADER("WorldChat" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h")
AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/conf/WorldChat.conf.dist")
Mod Nr. 2
project(GuildHouse)
cmake_minimum_required(VERSION 3.16)
CU_SET_PATH("CMAKE_guildmaster_DIR" "${CMAKE_CURRENT_LIST_DIR}")
AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/guildmaster.cpp")
AC_ADD_SCRIPT_LOADER("guildmaster" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h")
Hope someone could help me....

make tcpflood throws error

I am following this link ( http://www.rsyslog.com/how-to-use-tcpflood/ ) to send messages to rsyslog.
I have cloned the git repository of rsyslog https://github.com/rsyslog/rsyslog.git
While following the link http://www.rsyslog.com/how-to-use-tcpflood/ , I am getting below error while executing "make tcpflood"
root1#atratus06:~/Debashish/rsyslog/tests$ make tcpflood
cc tcpflood.c -o tcpflood
tcpflood.c:86:20: fatal error: config.h: No such file or directory
#include "config.h"
^
compilation terminated.
make: *** [tcpflood] Error 1
Can you please help me with the error, your help will be really appreciated.
I had the same problem. Solution (or rather workaround) was to compile rsyslog...
Just go one directory up, and type:
./configure (you will need to probably install lot of missing stuff here...)
make
make install
After successfully completing all those actions you can go to 'tests' directory and once again type 'make tcpflood'. This time it will work.