Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Fails on Mac OS 12.4 #8

Closed
Greeley opened this issue Jul 18, 2022 · 3 comments
Closed

Build Fails on Mac OS 12.4 #8

Greeley opened this issue Jul 18, 2022 · 3 comments

Comments

@Greeley
Copy link

Greeley commented Jul 18, 2022

Downloading and doing cmake --build build after the configure command provides a memset_s undeclared error.

/Users/Greeley/Workspace/Cppspace/Culinoire/build/subprojects/Source/wxWidgets_external/src/unix/utilsunx.cpp:229:5: error: use of undeclared identifier 'memset_s'
    memset_s(v, n, 0, n);
    ^
1 error generated.
make[5]: *** [libs/base/CMakeFiles/wxbase.dir/__/__/__/__/src/unix/utilsunx.cpp.o] Error 1
make[4]: *** [libs/base/CMakeFiles/wxbase.dir/all] Error 2
make[3]: *** [all] Error 2

Downloading wxWidgets and performing cd ~/wxWidgets && mkdir buildOSX && cd buildOSX && ./configure --enable-debug && make -j3 && cd samples/minimal && make && open minimal.app builds and launches minimal.app just fine.

But even after building it that way I can't seem to figure out how to use it that way.

@Greeley
Copy link
Author

Greeley commented Jul 18, 2022

Changing my wxWidgets CMakeLists.txt to the one provided in issue #7 fails later with this error.
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS)

@Greeley
Copy link
Author

Greeley commented Jul 18, 2022

Changes CMakeLists.txt in /src to this.

cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
set(CMAKE_C_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c")
set(CMAKE_CXX_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c++")

project(wx_cmake_template_core LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(__STDC_WANT_LIB_EXT1__)

# hack for buggy CMake's FindwxWidgets script
if (DEFINED ENV_WX_CONFIG)
    set (ENV{WX_CONFIG} ${ENV_WX_CONFIG})
endif()

set(wxWidgets_USE_DEBUG 1)
set(wxWidgets_USE_UNICODE 1)
set(wxWidgets_USE_UNIVERSAL 0)
set(wxWidgets_USE_STATIC 1)
#set(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr)

find_package(wxWidgets COMPONENTS core base REQUIRED)

set(SRCS main.cpp)

if (APPLE)
    # create bundle on apple compiles
    add_executable(main MACOSX_BUNDLE ${SRCS} )
    # Set a custom plist file for the app bundle - needed for Mac OS Retina display
    set_target_properties(main PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
else()
    # the WIN32 is needed for Windows in order for it to look for WinMain
    # instead of the main function. This is ignored on other systems,
    # so it works on all platforms
    add_executable(main WIN32 ${SRCS})
endif()

target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES})

This is the new error that I get. Which is the error I was getting before I switched to using this project as a base. So I got nowhere.

[build] [ 81%] Performing configure step for 'Culinoire_core'
[build] loading initial cache file /Users/Greeley/Workspace/Cppspace/Culinoire/build/subprojects/tmp/Culinoire_core/Culinoire_core-cache-.cmake
[build] -- Configuring done
[build] -- Generating done
[build] -- Build files have been written to: /Users/Greeley/Workspace/Cppspace/Culinoire/build/subprojects/Build/Culinoire_core
[build] [ 87%] Performing build step for 'Culinoire_core'
[build] [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
[build] /Users/Greeley/Workspace/Cppspace/Culinoire/src/main.cpp:3:10: fatal error: 'wx/wxprec.h' file not found
[build] #include <wx/wxprec.h>
[build]          ^~~~~~~~~~~~~
[build] 1 error generated.
[build] make[5]: *** [CMakeFiles/main.dir/main.cpp.o] Error 1
[build] make[4]: *** [CMakeFiles/main.dir/all] Error 2
[build] make[3]: *** [all] Error 2
[build] make[2]: *** [subprojects/Stamp/Culinoire_core/Culinoire_core-build] Error 2
[build] make[1]: *** [CMakeFiles/Culinoire_core.dir/all] Error 2
[build] make: *** [all] Error 2
[build] Build finished with exit code 2
[cpptools] The build configurations generated do not contain the active build configuration. Using "" for CMAKE_BUILD_TYPE instead of "Debug" to ensure that IntelliSense configurations can be found

Any thoughts/ideas are greatly appreciated.

@Greeley
Copy link
Author

Greeley commented Jul 19, 2022

Second error is caused by the fact I forgot to put include(${wxWidgets_USE_FILE}) in the src/CMakeLists.txt.

And that is caused by the fact I absolutely loathe video tutorials, my attention span just cannot handle them.

Anyway; excellent work, great tutorial in all.

Thank you.

@Greeley Greeley closed this as completed Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant