Further we kindly ask you to describe the detected problem as detailed as possible and to add debug output if available, by using the following template:
Command line output:
$ git clone https://github.com/stlink-org/stlink.git
Cloning into 'stlink'...
remote: Enumerating objects: 12328, done.
remote: Counting objects: 100% (2251/2251), done.
remote: Compressing objects: 100% (707/707), done.
remote: Total 12328 (delta 1580), reused 2135 (delta 1521), pack-reused 10077
Receiving objects: 100% (12328/12328), 16.67 MiB | 1.47 MiB/s, done.
Resolving deltas: 100% (8032/8032), done.
$ cd stlink
$ git status
On branch develop
Your branch is up to date with 'origin/develop'.
nothing to commit, working tree clean
$ cd stlink
$ make
-- The C compiler identification is GNU 12.1.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/bin/git (found version "2.36.1")
-- Rewrite xxxx/stlink/.version with 1.7.0!
-- stlink version: 1.7.0-195-g951859c
-- Major 1 Minor 7 Patch 0
-- Performing Test C_SUPPORTS_WALL
-- Performing Test C_SUPPORTS_WALL - Success
-- Performing Test C_SUPPORTS_WEXTRA
-- Performing Test C_SUPPORTS_WEXTRA - Success
-- Performing Test C_SUPPORTS_WSHADOW
-- Performing Test C_SUPPORTS_WSHADOW - Success
-- Performing Test C_SUPPORTS_D_FORTIFY_SOURCE_2
-- Performing Test C_SUPPORTS_D_FORTIFY_SOURCE_2 - Success
-- Performing Test C_SUPPORTS_FSTRICT_ALIASING
-- Performing Test C_SUPPORTS_FSTRICT_ALIASING - Success
-- Performing Test C_SUPPORTS_WUNDEF
-- Performing Test C_SUPPORTS_WUNDEF - Success
-- Performing Test C_SUPPORTS_WFORMAT
-- Performing Test C_SUPPORTS_WFORMAT - Success
-- Performing Test C_SUPPORTS_WFORMAT_SECURITY
-- Performing Test C_SUPPORTS_WFORMAT_SECURITY - Success
-- Performing Test C_SUPPORTS_WMAYBE_UNINITIALIZED
-- Performing Test C_SUPPORTS_WMAYBE_UNINITIALIZED - Success
-- Performing Test C_SUPPORTS_WMISSING_VARIABLE_DECLARATIONS
-- Performing Test C_SUPPORTS_WMISSING_VARIABLE_DECLARATIONS - Failed
-- Performing Test C_SUPPORTS_WSHORTEN_64_TO_32
-- Performing Test C_SUPPORTS_WSHORTEN_64_TO_32 - Failed
-- Performing Test C_SUPPORTS_WIMPLICIT_FUNCTION_DECLARATION
-- Performing Test C_SUPPORTS_WIMPLICIT_FUNCTION_DECLARATION - Success
-- Performing Test C_SUPPORTS_WREDUNDANT_DECLS
-- Performing Test C_SUPPORTS_WREDUNDANT_DECLS - Success
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test C_SUPPORTS_WERROR
-- Performing Test C_SUPPORTS_WERROR - Success
-- Found libusb: /usr/lib64/libusb-1.0.so
-- Looking for __stack_chk_fail in ssp
-- Looking for __stack_chk_fail in ssp - not found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - not found
-- Looking for sys/time.h
-- Looking for sys/time.h - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for dirent.h
-- Looking for dirent.h - not found
-- STLINK_LIB_SHARED: stlink-shared
-- PROJECT_VERSION_MAJOR: 1
-- VERSION: 1.7.0
-- STLINK_LIB_STATIC: stlink-static
-- PROJECT_VERSION_MAJOR: 1
-- VERSION: 1.7.0
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.0")
-- Checking for module 'gtk+-3.0'
-- Found gtk+-3.0, version 3.24.34
-- Found GTK3: -I/usr/include/gtk-3.0;/usr/include/pango-1.0;/usr/include/glib-2.0;/usr/lib64/glib-2.0/include;/usr/include/sysprof-4;/usr/include/harfbuzz;/usr/include/freetype2;/usr/include/libpng16;/usr/include/libmount;/usr/include/blkid;/usr/include/fribidi;/usr/include/libxml2;/usr/include/cairo;/usr/include/pixman-1;/usr/include/gdk-pixbuf-2.0;/usr/include/gio-unix-2.0;/usr/include/cloudproviders;/usr/include/atk-1.0;/usr/include/at-spi2-atk/2.0;/usr/include/dbus-1.0;/usr/lib64/dbus-1.0/include;/usr/include/at-spi-2.0, gtk-3;gdk-3;z;pangocairo-1.0;pango-1.0;harfbuzz;atk-1.0;cairo-gobject;cairo;gdk_pixbuf-2.0;gio-2.0;gobject-2.0;glib-2.0
-- Manpage generation disabled
-- Configuring done
-- Generating done
-- Build files have been written to: xxxx/stlink/build/Release
[RELEASE]
[ 1%] Building C object CMakeFiles/stlink-shared.dir/src/read_write.c.o
[ 3%] Building C object CMakeFiles/stlink-shared.dir/src/common.c.o
In file included from xxxx/stlink/src/common.c:15:
xxxx/stlink/src/map_file.h:17:10: fatal error: mmap.h: No such file or directory
17 | #include <mmap.h>
| ^~~~~~~~
compilation terminated.
make[3]: *** [CMakeFiles/stlink-shared.dir/build.make:90: CMakeFiles/stlink-shared.dir/src/common.c.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:240: CMakeFiles/stlink-shared.dir/all] Error 2
make[1]: *** [Makefile:156: all] Error 2
make: *** [Makefile:34: release] Error 2
Expected/description:
The problem is that /usr/include/features.h warns if _FORTIFY_SOURCE is defined with compiler optimisation disabled:
# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0
# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
# elif ...
To build successfully, I modify cmake/modules/c_flags.cmake and rebuild the Makefile:
$ git diff
diff --git a/cmake/modules/c_flags.cmake b/cmake/modules/c_flags.cmake
index 44052bb..2243b23 100644
--- a/cmake/modules/c_flags.cmake
+++ b/cmake/modules/c_flags.cmake
@@ -20,7 +20,7 @@ endfunction()
add_cflag_if_supported("-Wall")
add_cflag_if_supported("-Wextra")
add_cflag_if_supported("-Wshadow")
-add_cflag_if_supported("-D_FORTIFY_SOURCE=2")
+add_cflag_if_supported("-D_FORTIFY_SOURCE=2 -O")
add_cflag_if_supported("-fstrict-aliasing")
add_cflag_if_supported("-Wundef")
add_cflag_if_supported("-Wformat")
$ cmake .
-- The C compiler identification is GNU 12.1.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/bin/git (found version "2.36.1")
-- Rewrite xxxx/stlink/.version with 1.7.0!
-- stlink version: 1.7.0-195-g951859c-dirty
-- Major 1 Minor 7 Patch 0
-- Performing Test C_SUPPORTS_WALL
-- Performing Test C_SUPPORTS_WALL - Success
-- Performing Test C_SUPPORTS_WEXTRA
-- Performing Test C_SUPPORTS_WEXTRA - Success
-- Performing Test C_SUPPORTS_WSHADOW
-- Performing Test C_SUPPORTS_WSHADOW - Success
-- Performing Test C_SUPPORTS_D_FORTIFY_SOURCE_2 _O
-- Performing Test C_SUPPORTS_D_FORTIFY_SOURCE_2 _O - Failed
-- Performing Test C_SUPPORTS_FSTRICT_ALIASING
-- Performing Test C_SUPPORTS_FSTRICT_ALIASING - Success
-- Performing Test C_SUPPORTS_WUNDEF
-- Performing Test C_SUPPORTS_WUNDEF - Success
-- Performing Test C_SUPPORTS_WFORMAT
-- Performing Test C_SUPPORTS_WFORMAT - Success
-- Performing Test C_SUPPORTS_WFORMAT_SECURITY
-- Performing Test C_SUPPORTS_WFORMAT_SECURITY - Success
-- Performing Test C_SUPPORTS_WMAYBE_UNINITIALIZED
-- Performing Test C_SUPPORTS_WMAYBE_UNINITIALIZED - Success
-- Performing Test C_SUPPORTS_WMISSING_VARIABLE_DECLARATIONS
-- Performing Test C_SUPPORTS_WMISSING_VARIABLE_DECLARATIONS - Failed
-- Performing Test C_SUPPORTS_WSHORTEN_64_TO_32
-- Performing Test C_SUPPORTS_WSHORTEN_64_TO_32 - Failed
-- Performing Test C_SUPPORTS_WIMPLICIT_FUNCTION_DECLARATION
-- Performing Test C_SUPPORTS_WIMPLICIT_FUNCTION_DECLARATION - Success
-- Performing Test C_SUPPORTS_WREDUNDANT_DECLS
-- Performing Test C_SUPPORTS_WREDUNDANT_DECLS - Success
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test C_SUPPORTS_WERROR
-- Performing Test C_SUPPORTS_WERROR - Success
-- Found libusb: /usr/lib64/libusb-1.0.so
-- Looking for __stack_chk_fail in ssp
-- Looking for __stack_chk_fail in ssp - not found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for dirent.h
-- Looking for dirent.h - found
-- STLINK_LIB_SHARED: stlink-shared
-- PROJECT_VERSION_MAJOR: 1
-- VERSION: 1.7.0
-- STLINK_LIB_STATIC: stlink-static
-- PROJECT_VERSION_MAJOR: 1
-- VERSION: 1.7.0
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.0")
-- Checking for module 'gtk+-3.0'
-- Found gtk+-3.0, version 3.24.34
-- Found GTK3: -I/usr/include/gtk-3.0;/usr/include/pango-1.0;/usr/include/glib-2.0;/usr/lib64/glib-2.0/include;/usr/include/sysprof-4;/usr/include/harfbuzz;/usr/include/freetype2;/usr/include/libpng16;/usr/include/libmount;/usr/include/blkid;/usr/include/fribidi;/usr/include/libxml2;/usr/include/cairo;/usr/include/pixman-1;/usr/include/gdk-pixbuf-2.0;/usr/include/gio-unix-2.0;/usr/include/cloudproviders;/usr/include/atk-1.0;/usr/include/at-spi2-atk/2.0;/usr/include/dbus-1.0;/usr/lib64/dbus-1.0/include;/usr/include/at-spi-2.0, gtk-3;gdk-3;z;pangocairo-1.0;pango-1.0;harfbuzz;atk-1.0;cairo-gobject;cairo;gdk_pixbuf-2.0;gio-2.0;gobject-2.0;glib-2.0
-- Manpage generation disabled
-- Configuring done
-- Generating done
-- Build files have been written to: xxxx/stlink
$ make
[ 1%] Building C object CMakeFiles/stlink-shared.dir/src/read_write.c.o
[ 3%] Building C object CMakeFiles/stlink-shared.dir/src/common.c.o
[ 5%] Building C object CMakeFiles/stlink-shared.dir/src/option_bytes.c.o
[ 7%] Building C object CMakeFiles/stlink-shared.dir/src/common_flash.c.o
[ 9%] Building C object CMakeFiles/stlink-shared.dir/src/map_file.c.o
[ 11%] Building C object CMakeFiles/stlink-shared.dir/src/flashloader.c.o
[ 13%] Building C object CMakeFiles/stlink-shared.dir/src/calculate.c.o
[ 15%] Building C object CMakeFiles/stlink-shared.dir/src/stlink-lib/chipid.c.o
[ 17%] Building C object CMakeFiles/stlink-shared.dir/src/stlink-lib/flash_loader.c.o
[ 19%] Building C object CMakeFiles/stlink-shared.dir/src/stlink-lib/logging.c.o
[ 21%] Building C object CMakeFiles/stlink-shared.dir/src/stlink-lib/md5.c.o
[ 23%] Building C object CMakeFiles/stlink-shared.dir/src/stlink-lib/sg.c.o
[ 25%] Building C object CMakeFiles/stlink-shared.dir/src/stlink-lib/usb.c.o
[ 26%] Building C object CMakeFiles/stlink-shared.dir/src/stlink-lib/helper.c.o
[ 28%] Linking C shared library lib/libstlink.so
[ 28%] Built target stlink-shared
[ 30%] Building C object CMakeFiles/stlink-static.dir/src/read_write.c.o
[ 32%] Building C object CMakeFiles/stlink-static.dir/src/common.c.o
[ 34%] Building C object CMakeFiles/stlink-static.dir/src/option_bytes.c.o
[ 36%] Building C object CMakeFiles/stlink-static.dir/src/common_flash.c.o
[ 38%] Building C object CMakeFiles/stlink-static.dir/src/map_file.c.o
[ 40%] Building C object CMakeFiles/stlink-static.dir/src/flashloader.c.o
[ 42%] Building C object CMakeFiles/stlink-static.dir/src/calculate.c.o
[ 44%] Building C object CMakeFiles/stlink-static.dir/src/stlink-lib/chipid.c.o
[ 46%] Building C object CMakeFiles/stlink-static.dir/src/stlink-lib/flash_loader.c.o
[ 48%] Building C object CMakeFiles/stlink-static.dir/src/stlink-lib/logging.c.o
[ 50%] Building C object CMakeFiles/stlink-static.dir/src/stlink-lib/md5.c.o
[ 51%] Building C object CMakeFiles/stlink-static.dir/src/stlink-lib/sg.c.o
[ 53%] Building C object CMakeFiles/stlink-static.dir/src/stlink-lib/usb.c.o
[ 55%] Building C object CMakeFiles/stlink-static.dir/src/stlink-lib/helper.c.o
[ 57%] Linking C static library lib/libstlink.a
[ 57%] Built target stlink-static
[ 59%] Building C object CMakeFiles/st-flash.dir/src/st-flash/flash.c.o
[ 61%] Building C object CMakeFiles/st-flash.dir/src/st-flash/flash_opts.c.o
[ 63%] Linking C executable bin/st-flash
[ 63%] Built target st-flash
[ 65%] Building C object CMakeFiles/st-info.dir/src/st-info/info.c.o
[ 67%] Linking C executable bin/st-info
[ 67%] Built target st-info
[ 69%] Building C object CMakeFiles/st-util.dir/src/st-util/gdb-remote.c.o
[ 71%] Building C object CMakeFiles/st-util.dir/src/st-util/gdb-server.c.o
[ 73%] Building C object CMakeFiles/st-util.dir/src/st-util/semihosting.c.o
[ 75%] Linking C executable bin/st-util
[ 75%] Built target st-util
[ 76%] Building C object CMakeFiles/st-trace.dir/src/st-trace/trace.c.o
[ 78%] Linking C executable bin/st-trace
[ 78%] Built target st-trace
[ 80%] Building C object src/stlink-gui/CMakeFiles/stlink-gui-local.dir/gui.c.o
[ 82%] Linking C executable ../../bin/stlink-gui-local
[ 82%] Built target stlink-gui-local
[ 84%] Building C object src/stlink-gui/CMakeFiles/stlink-gui.dir/gui.c.o
[ 86%] Linking C executable ../../bin/stlink-gui
[ 86%] Built target stlink-gui
[ 88%] Building C object tests/CMakeFiles/test-usb.dir/usb.c.o
[ 90%] Linking C executable ../bin/test-usb
[ 90%] Built target test-usb
[ 92%] Building C object tests/CMakeFiles/test-sg.dir/sg.c.o
[ 94%] Linking C executable ../bin/test-sg
[ 94%] Built target test-sg
[ 96%] Building C object tests/CMakeFiles/test-flash.dir/flash.c.o
[ 98%] Building C object tests/CMakeFiles/test-flash.dir/__/src/st-flash/flash_opts.c.o
[100%] Linking C executable ../bin/test-flash
[100%] Built target test-flash
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4