3.1.4 to 3.15 link error

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
pvn
Experienced Solver
Experienced Solver
Posts: 93
Joined: Mon Dec 26, 2016 5:21 am
Contact:

3.1.4 to 3.15 link error

Post by pvn » Mon May 17, 2021 8:07 pm

I have an app built with version 3.1.4, that builds on Mac, Linux, Windows

I gave a try to build with 3.1.5 and this error shows up on Mac OS 11.3 (Big Sur) ; will post here later results for Windows and Linux

Code: Select all

[ 42%] Linking CXX executable alert_site_query.app/Contents/MacOS/alert_site_query
Undefined symbols for architecture x86_64:
  "_kCAContentsFormatRGBA8Uint", referenced from:
      -[wxNSView viewWillDraw] in libwx_osx_cocoau_core-3.1.a(window.mm.o)
ld: symbol(s) not found for architecture x86_64
Undefined symbols for architecture x86_64:
  "_kCAContentsFormatRGBA8Uint", referenced from:
      -[wxNSView viewWillDraw] in libwx_osx_cocoau_core-3.1.a(window.mm.o)
I'm using Cmake, using this script, that lists the Mac dependencies

Code: Select all

cmake_minimum_required(VERSION 3.17)
set(CMAKE_BUILD_TYPE Debug)
project (mcc)

set(CMAKE_CXX_STANDARD 17)
option(BUILD_STATIC "BUILD_STATIC" OFF)
if (MSVC)
if(BUILD_STATIC)
  set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()
message("-- Static build: " ${BUILD_STATIC})
message(STATUS "Source directory is " ${CMAKE_SOURCE_DIR})
message(STATUS "Build directory is " ${CMAKE_CURRENT_BINARY_DIR})
if (MSVC)
  include_directories(${CMAKE_SOURCE_DIR}/build/wxwidgets-3.1.5/lib/vc_x64_lib/mswud)
  link_directories(${CMAKE_SOURCE_DIR}/build/wxwidgets-3.1.5/lib/vc_x64_lib)
elseif(APPLE)
  include_directories(${CMAKE_SOURCE_DIR}/build/wxwidgets-3.1.5/lib/wx/include/osx_cocoa-unicode-static-3.1)
  link_directories(${CMAKE_SOURCE_DIR}/build/wxwidgets-3.1.5/lib)
  add_definitions(-DWXUSINGDLL -D__WXOSX_COCOA__ -D__WXMAC__ -D__WXOSX__)
endif()
include_directories(${CMAKE_SOURCE_DIR}/wxwidgets-3.1.5/include)

include_directories(nlohmann_json-3.9.1/single_include)

#//////////////////////////
#ODBC Linux/Mac
#/Volumes/Home/pvn/git/wx/build/wxwidgets-3.1.5/wx-config --libs
#//////////////////////////

if(UNIX AND NOT APPLE)
  set(LINUX TRUE)
endif()

if(APPLE)
  message(STATUS "Mac OS build...")
endif()

#//////////////////////////
#source common
#//////////////////////////

set(src ${src})
set(src_extra ${src_extra})
if (MSVC)
  set(src_extra ${src_extra} ${CMAKE_SOURCE_DIR}/minimal/sample.rc)
elseif(APPLE)
  set(src_extra ${src_extra} ${CMAKE_SOURCE_DIR}/wxwidgets-3.1.5/src/osx/carbon/wxmac.icns)
endif()

include_directories(${CMAKE_SOURCE_DIR}/mcc)
include_directories(${CMAKE_SOURCE_DIR}/odbc)
include_directories(${CMAKE_SOURCE_DIR}/qms)
include_directories(${CMAKE_SOURCE_DIR}/alert)

#//////////////////////////
#MCC lib source 
#//////////////////////////

set(mcc_lib ${mcc_lib})
set(mcc_lib ${mcc_lib} mcc/mcc.hh)
set(mcc_lib ${mcc_lib} mcc/parser.hh)
set(mcc_lib ${mcc_lib} mcc/parser.cc)
set(mcc_lib ${mcc_lib} mcc/connect.cc)
set(mcc_lib ${mcc_lib} mcc/connect.hh)
set(mcc_lib ${mcc_lib} mcc/log.cc)
set(mcc_lib ${mcc_lib} mcc/log.hh)
set(mcc_lib ${mcc_lib} mcc/sat_lut.hh)

#//////////////////////////
#ODBC lib source 
#//////////////////////////

set(odbc_lib ${odbc_lib} odbc/wodbc.hh)
set(odbc_lib ${odbc_lib} odbc/wodbc.cc)
set(odbc_lib ${odbc_lib} odbc/table.hh)
set(odbc_lib ${odbc_lib} odbc/csv.hh)
set(odbc_lib ${odbc_lib} odbc/csv.cc)

#//////////////////////////
#source alert_site_query
#//////////////////////////

set(src_alert ${src_alert})
set(src_alert ${src_alert} alert/alert_input.cc)
set(src_alert ${src_alert} alert/alert_edit.cc)
set(src_alert ${src_alert} alert/alert_grid.cc)
set(src_alert ${src_alert} alert/alert_output.cc)
set(src_alert ${src_alert} alert/brief.cc)
set(src_alert ${src_alert} alert/map.cc)
set(src_alert ${src_alert} alert/messages.cc)
set(src_alert ${src_alert} alert/solutions.cc)

set(src_alert ${src_alert} alert/alert.hh)
set(src_alert ${src_alert} alert/messages.hh)

set(src_alert ${src_alert} alert/send_messages.cc)
set(src_alert ${src_alert} alert/send.cc)

#//////////////////////////
#QMS lib source 
#//////////////////////////

set(qms_lib ${qms_lib})
set(qms_lib ${qms_lib} qms/qms.cc)
set(qms_lib ${qms_lib} qms/qms_results.cc)
set(qms_lib ${qms_lib} qms/qms.hh)
set(qms_lib ${qms_lib} qms/qms_analysis.cc)
set(qms_lib ${qms_lib} qms/qms_sat_lut.hh)
set(qms_lib ${qms_lib} qms/qms_sat_lut.cc)

#//////////////////////////
#source qms
#//////////////////////////

set(src_qms ${src_qms})
set(src_qms ${src_qms} qms/qms_interface.hh)
set(src_qms ${src_qms} qms/qms_interface.cc)
set(src_qms ${src_qms} qms/qms_action.cc)
set(src_qms ${src_qms} qms/qms_input.cc)
set(src_qms ${src_qms} qms/qms_current.cc)
set(src_qms ${src_qms} qms/qms_report.cc)
set(src_qms ${src_qms} qms/qms_results.cc)

#//////////////////////////
#executables
#//////////////////////////

add_library(mcc ${mcc_lib})
add_library(odbc ${odbc_lib})
add_library(qms ${qms_lib})

add_executable(alert_site_query WIN32 MACOSX_BUNDLE alert/alert_site_query.cc ${src_alert} ${src_extra})
add_executable(msg_query WIN32 MACOSX_BUNDLE msg_query/msg_query.cc msg_query/msg_query.hh 
alert/send_messages.cc alert/send.cc ${src_extra})
add_executable(qms_interface WIN32 MACOSX_BUNDLE ${src_qms} ${src_extra})
add_executable(qms_test WIN32 MACOSX_BUNDLE qms/qms_test.hh qms/qms_test.cc qms/test.cc qms/test.hh ${src_lib_qms} ${src_extra})

#//////////////////////////
#post build
#//////////////////////////


set_target_properties(alert_site_query PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR})
file(COPY "${CMAKE_SOURCE_DIR}/alert/leaflet.html" DESTINATION ${CMAKE_BINARY_DIR})
file(COPY "${CMAKE_SOURCE_DIR}/alert/leaflet.css" DESTINATION ${CMAKE_BINARY_DIR})
file(COPY "${CMAKE_SOURCE_DIR}/alert/leaflet.js" DESTINATION ${CMAKE_BINARY_DIR})

#//////////////////////////
#LINUX
#order of the link libraries matters; pthread dl ${ODBC_LIBRARY} must be last
#//////////////////////////

if(LINUX)
  set(lib_dep ${lib_dep} pthread dl)
  find_program(LSB_RELEASE_EXEC lsb_release)
  execute_process(COMMAND ${LSB_RELEASE_EXEC} -is OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
  message(STATUS "Building in " ${LSB_RELEASE_ID_SHORT})
endif()

#//////////////////////////
#link with libraries
#lib_dep contains a cascade definition of all the libraries needed to link
#//////////////////////////

set(mcc_lib mcc)
set(odbc_lib odbc)
set(qms_lib qms)

set(lib_dep ${lib_dep})
set(lib_dep ${lib_dep} ${mcc_lib} ${odbc_lib} ${qms_lib})

if (MSVC)
  set(lib_dep ${lib_dep} wxbase31ud wxmsw31ud_core wxmsw31ud_webview wxbase31ud_net wxpngd wxzlibd wxregexud wxmsw31ud_html)
  set(lib_dep ${lib_dep} odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib ws2_32.lib)
endif()

if(APPLE)
  set(lib_dep ${lib_dep} wx_osx_cocoau_xrc-3.1 wx_osx_cocoau_qa-3.1 wx_baseu_net-3.1 wx_osx_cocoau_html-3.1 wx_osx_cocoau_core-3.1)
  set(lib_dep ${lib_dep} wx_baseu_xml-3.1 wx_baseu-3.1 wx_osx_cocoau_webview-3.1)
  set(lib_dep ${lib_dep} wx_osx_cocoau_core-3.1 wxregexu-3.1 wxjpeg-3.1 wxpng-3.1 wxtiff-3.1 z iconv)
  find_library(COREFOUNDATION CoreFoundation)
  if (NOT COREFOUNDATION)
      message(FATAL_ERROR "CoreFoundation not found")
  endif()
  find_library(SECURITY Security)
  find_library(CARBON Carbon)
  find_library(COCOA Cocoa)
  find_library(IOKIT IOKit)
  find_library(WEBKIT WebKit)
  set(lib_dep ${lib_dep} ${COREFOUNDATION} ${SECURITY} ${CARBON} ${COCOA} ${IOKIT} ${WEBKIT})
endif()

if(UNIX)
  find_path(ODBC_INCLUDE sql.h ${find_opt})
  if(NOT ODBC_INCLUDE)
    message(FATAL_ERROR "sql.h header file not found")
  else()
    message("-- Found sql.h header file at: " ${ODBC_INCLUDE})
  endif()
  include_directories(${ODBC_INCLUDE})
  find_library(ODBC_LIBRARY NAMES odbc PATHS "/usr/local/lib")
  if(NOT ODBC_LIBRARY)
    message(FATAL_ERROR "ODBC library not found$")
  else()
    message("-- Found ODBC library at: " ${ODBC_LIBRARY})
  endif()
  set(lib_dep ${lib_dep} ${ODBC_LIBRARY})
endif()

target_link_libraries(alert_site_query ${lib_dep})
target_link_libraries(msg_query ${lib_dep})
target_link_libraries(qms_interface ${lib_dep})
target_link_libraries(qms_test ${lib_dep})
if (MSVC)
  set_target_properties(alert_site_query PROPERTIES LINK_FLAGS "/SubSystem:\"Windows\"" VS_DPI_AWARE "ON")
  set_target_properties(msg_query PROPERTIES LINK_FLAGS "/SubSystem:\"Windows\"" VS_DPI_AWARE "ON")
  set_target_properties(qms_interface PROPERTIES LINK_FLAGS "/SubSystem:\"Windows\"" VS_DPI_AWARE "ON")
  set_target_properties(qms_test PROPERTIES LINK_FLAGS "/SubSystem:\"Windows\"" VS_DPI_AWARE "ON")
endif()

if(APPLE)
  set(VERSION "1.0")
  set(COPYRIGHT "Sarsat")
  if(NOT IPHONE)
    set_target_properties(qms_interface qms_test alert_site_query msg_query PROPERTIES
      MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/wxwidgets-3.1.5/samples/Info.plist.in"
      RESOURCE "${CMAKE_SOURCE_DIR}/wxwidgets-3.1.5/src/osx/carbon/wxmac.icns")
  endif()
  set_target_properties(qms_interface qms_test alert_site_query msg_query PROPERTIES
    MACOSX_BUNDLE_ICON_FILE wxmac.icns
    MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION}"
    MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION}"
    MACOSX_BUNDLE_VERSION "${VERSION}"
    MACOSX_BUNDLE_COPYRIGHT "${COPYRIGHT}"
    MACOSX_BUNDLE_GUI_IDENTIFIER "org.wxwidgets.qms"
    )
  message(STATUS "MacOS bundle version: " ${VERSION})
endif()

wxconfig shows
wx-config --libs
-L/Volumes/Home/pvn/git/wx/build/wxwidgets-3.1.5/lib -pthread -Wl,-rpath,/Volumes/Home/pvn/git/wx/build/wxwidgets-3.1.5/lib /Volumes/Home/pvn/git/wx/build/wxwidgets-3.1.5/lib/libwx_osx_cocoau_xrc-3.1.a /Volumes/Home/pvn/git/wx/build/wxwidgets-3.1.5/lib/libwx_osx_cocoau_qa-3.1.a /Volumes/Home/pvn/git/wx/build/wxwidgets-3.1.5/lib/libwx_baseu_net-3.1.a /Volumes/Home/pvn/git/wx/build/wxwidgets-3.1.5/lib/libwx_osx_cocoau_html-3.1.a /Volumes/Home/pvn/git/wx/build/wxwidgets-3.1.5/lib/libwx_osx_cocoau_core-3.1.a /Volumes/Home/pvn/git/wx/build/wxwidgets-3.1.5/lib/libwx_baseu_xml-3.1.a /Volumes/Home/pvn/git/wx/build/wxwidgets-3.1.5/lib/libwx_baseu-3.1.a -lwx_osx_cocoau_core-3.1 -lwxjpeg-3.1 -lwxpng-3.1 -lwxtiff-3.1 -framework AudioToolbox -framework WebKit -lwx_baseu-3.1 libexpat.tbd libz.tbd -lwxregexu-3.1 libiconv.tbd -framework CoreFoundation -framework Security -framework Carbon -framework Cocoa -framework IOKit -framework QuartzCore

PB
Part Of The Furniture
Part Of The Furniture
Posts: 3063
Joined: Sun Jan 03, 2010 5:45 pm

Re: 3.1.4 to 3.15 link error

Post by PB » Mon May 17, 2021 8:56 pm

I know nothing about MacOS and little about CMake but the error looks the same as in this ticket: https://trac.wxwidgets.org/ticket/19169

Is your project linking against QuartzCore framework (see the output of wxConfig)?
Last edited by PB on Mon May 17, 2021 8:58 pm, edited 1 time in total.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5226
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: 3.1.4 to 3.15 link error

Post by ONEEYEMAN » Mon May 17, 2021 8:58 pm

Hi,
According to this, you need to link with CoreAnimation.

Thank you.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5226
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: 3.1.4 to 3.15 link error

Post by ONEEYEMAN » Mon May 17, 2021 9:03 pm

@PB,
He does.
Look at his wx-config output.

@OP,
You should check if "CMake-thingy" is using the framework in the ticket referenced by PB.

Thank you.

pvn
Experienced Solver
Experienced Solver
Posts: 93
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: 3.1.4 to 3.15 link error

Post by pvn » Mon May 17, 2021 9:35 pm

that's it, thanks

the name of the library is "QuartzCore"

https://stackoverflow.com/questions/729 ... de-project

so, the Cmake must use

Code: Select all

find_library(ANIMATION QuartzCore)

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5226
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: 3.1.4 to 3.15 link error

Post by ONEEYEMAN » Mon May 17, 2021 9:51 pm

Hi,
Why you are not use wx-config in you "CMake-thingy"?
Then every time you update wxWidgets you will be guaranteed that everything will work.

Thank you.

pvn
Experienced Solver
Experienced Solver
Posts: 93
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: 3.1.4 to 3.15 link error

Post by pvn » Mon May 17, 2021 9:56 pm

Why you are not use wx-config in you "CMake-thingy"?
this would be ideal, but I don't know how to do that. Do you do it in your CMake scripts ?

this is the general method to add Apple libraries to CMake

https://gitlab.kitware.com/cmake/commun ... Frameworks

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5226
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: 3.1.4 to 3.15 link error

Post by ONEEYEMAN » Mon May 17, 2021 10:05 pm

Hi,
I'm not CMake-user.
I build everything with configure and MSVC solution and then use MSVC, Anjuta w/Makefile and Xcode to build my program.

So in essense I do configure builds everywhere.

It is platform native and is in par with wxWidgets philosophy.

I hope MaartenB can chime in and help you include wx-config...

Thank you.

pvn
Experienced Solver
Experienced Solver
Posts: 93
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: 3.1.4 to 3.15 link error

Post by pvn » Mon May 17, 2021 10:32 pm

I build everything with configure and MSVC solution and then use MSVC, Anjuta w/Makefile and Xcode to build my program.
I use CMake because I develop for these 3 platforms, and with 1 script I build everywhere;
I hope MaartenB can chime in and help you include wx-config...
I appreciate the concern, but I'm fine with the build now, thanks

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5226
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: 3.1.4 to 3.15 link error

Post by ONEEYEMAN » Mon May 17, 2021 10:43 pm

Hi,
You are fione with build NOW.
But with the possibilitry of either Apple changing the library name/shuffling the functipons between libraries or adding new functionality to wx you may not be.

That's why the best way forward is to use wx-config in you script.

Thank you.

Post Reply