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

Error on MAKE #33

Open
GeGaX opened this issue Nov 23, 2023 · 1 comment
Open

Error on MAKE #33

GeGaX opened this issue Nov 23, 2023 · 1 comment

Comments

@GeGaX
Copy link

GeGaX commented Nov 23, 2023

Hi,
I'm trying to install libvisio2svg on my MAC M1 but I'm encountering a problem that I don't know how to solve.

brew install git

=> OK

brew install librevenge libwmf libvisio libemf2svg argp-standalone

=> OK

git clone https://github.com/kakwa/libvisio2svg

=> OK

cd libvisio2svg

=> OK

~/libvisio2svg $ cmake . -DCMAKE_INSTALL_PREFIX=/usr/local
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is AppleClang 15.0.0.15000040
-- The CXX compiler identification is AppleClang 15.0.0.15000040
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Find Header Directory for libemf2svg: /opt/homebrew/include
-- Find Dynamic Library for libemf2svg:  /opt/homebrew/lib/libemf2svg.dylib
-- Find Header Directory for libwmf: /opt/homebrew/include
-- Find Dynamic Library for libwmf:  /opt/homebrew/lib/libwmf.dylib
-- Find Dynamic Library for libwmflite:  /opt/homebrew/lib/libwmflite.dylib
-- Find Header Directory for librevenge: /opt/homebrew/include/librevenge-0.0
-- Find Header Directory for librevenge: /opt/homebrew/include/librevenge-0.0
-- Find Dynamic Library for librevenge:  /opt/homebrew/lib/librevenge-0.0.dylib
-- Find Dynamic Library for librevenge:  /opt/homebrew/lib/librevenge-stream-0.0.dylib
-- Find Header Directory for libvisio: /opt/homebrew/include/libvisio-0.1
-- Find Dynamic Library for libvisio:  /opt/homebrew/lib/libvisio-0.1.dylib
-- Found LibXml2: /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/libxml2.tbd (found version "2.9.13") 
-- Found Freetype: /opt/homebrew/lib/libfreetype.dylib (found version "2.13.2") 
-- Configuring done (1.2s)
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   TitleGenerator
   Visio2Svg

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done (0.0s)
-- Build files have been written to: /Users/romain/libvisio2svg

=> NOK

~/libvisio2svg $ make
[ 12%] Building CXX object CMakeFiles/TitleGenerator.dir/src/lib/visio2svg/TitleGenerator.cpp.o
[ 25%] Linking CXX shared library libTitleGenerator.dylib
[ 25%] Built target TitleGenerator
[ 37%] Building CXX object CMakeFiles/Visio2Svg.dir/src/lib/visio2svg/Visio2Svg.cpp.o
In file included from /Users/romain/libvisio2svg/src/lib/visio2svg/Visio2Svg.cpp:3:
In file included from /Users/romain/libvisio2svg/inc/visio2svg/Visio2Svg.h:7:
/opt/homebrew/include/libwmf/ipa.h:72:15: warning: 'wmf_ipa_bmp_copy' has C-linkage specified, but returns incomplete type 'wmfBMP' (aka '_wmfBMP') which could be incompatible with C [-Wreturn-type-c-linkage]
extern wmfBMP wmf_ipa_bmp_copy (wmfAPI*,wmfBMP*,unsigned int,unsigned int);
              ^
/opt/homebrew/include/libwmf/ipa.h:89:15: warning: 'wmf_rgb_white' has C-linkage specified, but returns incomplete type 'wmfRGB' (aka '_wmfRGB') which could be incompatible with C [-Wreturn-type-c-linkage]
extern wmfRGB wmf_rgb_white (wmfAPI*);
              ^
/opt/homebrew/include/libwmf/ipa.h:90:15: warning: 'wmf_rgb_black' has C-linkage specified, but returns incomplete type 'wmfRGB' (aka '_wmfRGB') which could be incompatible with C [-Wreturn-type-c-linkage]
extern wmfRGB wmf_rgb_black (wmfAPI*);
              ^
/opt/homebrew/include/libwmf/ipa.h:91:15: warning: 'wmf_rgb_color' has C-linkage specified, but returns incomplete type 'wmfRGB' (aka '_wmfRGB') which could be incompatible with C [-Wreturn-type-c-linkage]
extern wmfRGB wmf_rgb_color (wmfAPI*,float,float,float);
              ^
4 warnings generated.
[ 50%] Linking CXX shared library libVisio2Svg.dylib
ld: library 'argp' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libVisio2Svg.0.5.5.dylib] Error 1
make[1]: *** [CMakeFiles/Visio2Svg.dir/all] Error 2
make: *** [all] Error 2

=> NOK ...

@sieteunoseis
Copy link

sieteunoseis commented Mar 21, 2024

I solved this by adding Findargp.cmake to the cmake folder

https://github.com/alehaa/CMake-argp/tree/master

I then edited the CmakeLists.txt as follows:


project (vss2svg)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")

find_package(libemf2svg REQUIRED)
find_package(libwmf REQUIRED)
find_package(librevenge REQUIRED)
find_package(libvisio REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(Freetype REQUIRED)
find_package(argp REQUIRED)

# Project version (sematic versionning)
set(vss2svg_VERSION_MAJOR 0)
set(vss2svg_VERSION_MINOR 5)
set(vss2svg_VERSION_PATCH 5)

set(vss2svg_VERSION ${vss2svg_VERSION_MAJOR}.${vss2svg_VERSION_MINOR}.${vss2svg_VERSION_PATCH})
# set version as a definition
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -DV2S_VERSION='\"${vss2svg_VERSION}\"'")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DV2S_VERSION='\"${vss2svg_VERSION}\"'")

add_custom_target(tag
	COMMAND git tag -a ${vss2svg_VERSION} -m "tagging version ${vss2svg_VERSION}"
	COMMAND git push origin ${vss2svg_VERSION}
)

# Options
option(DEBUG               "compile with debug symbol"                                          OFF)
option(STATIC              "compile statically"                                                 OFF)
option(USE_CLANG           "build application with clang"                                       OFF)
option(USE_GCC             "build application with gcc"                                         OFF)
option(UNSAFE_FILENAME     "disable safe file naming (if your stdlib doesn't support regex)"    OFF)

if(UNSAFE_FILENAME)
else(UNSAFE_FILENAME)
    set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -DSAFE_FILENAME")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSAFE_FILENAME")
endif(UNSAFE_FILENAME)

if(USE_CLANG)
    set(CMAKE_CXX_COMPILER "clang++")
    set(CMAKE_CC_COMPILER  "clang"  )
endif(USE_CLANG)

if(USE_GCC)
    set(CMAKE_CXX_COMPILER "g++")
    set(CMAKE_CC_COMPILER  "gcc")
endif(USE_GCC)

# Build external dependancies if we are on OSX
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   # Mac OS X specific code
   set(EXTERNAL_MEMSTREAM "memstream")
   add_definitions(-DDARWIN)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

if(DEBUG)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -DDEBUG")
    set(CMAKE_BUILD_TYPE Debug)
endif(DEBUG)

if(STATIC)
    set(SHARED "")
    set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
    set(BUILD_SHARED_LIBRARIES OFF)
    set(CMAKE_EXE_LINKER_FLAGS "-static")
else(STATIC)
    set(SHARED "SHARED")
    set(BUILD_SHARED_LIBRARIES ON)
endif(STATIC)

LINK_DIRECTORIES(
    /usr/local/lib
    /usr/lib/
)

include_directories(
    inc/
    ${LIBEMF2SVG_INCLUDE_DIR}
    ${LIBWMF_INCLUDE_DIR}
    ${LIBREVENGE_INCLUDE_DIR}
    ${LIBVISIO_INCLUDE_DIR}
    ${FREETYPE_INCLUDE_DIRS}
    ${FREETYPE_INCLUDE_DIR_ft2build}
    ${FREETYPE_INCLUDE_DIR_freetype2}
    ${LIBXML2_INCLUDE_DIR}
    ${ARGP_INCLUDE_PATH}
)

add_executable(vss2svg-conv src/conv/vss2svg.cpp)
add_executable(vsd2svg-conv src/conv/vsd2svg.cpp)

add_library(TitleGenerator
    ${SHARED}
    src/lib/visio2svg/TitleGenerator.cpp
)

add_library(Visio2Svg
    ${SHARED}
    src/lib/visio2svg/Visio2Svg.cpp
)

set_target_properties(Visio2Svg
    PROPERTIES
    VERSION ${vss2svg_VERSION}
    SOVERSION ${vss2svg_VERSION_MAJOR}
)

set_target_properties(TitleGenerator
    PROPERTIES
    VERSION ${vss2svg_VERSION}
    SOVERSION ${vss2svg_VERSION_MAJOR}
)

target_link_libraries(TitleGenerator
    ${LIBREVENGE_LIBRARIES}
    ${LIBVISIO_LIBRARIES}
)

target_link_libraries(Visio2Svg
    ${LIBREVENGE_LIBRARIES}
    ${LIBVISIO_LIBRARIES}
    ${LIBEMF2SVG_LIBRARIES}
    ${LIBWMF_LIBRARIES}
    ${LIBWMFLITE_LIBRARIES}
    ${LIBREVENGE_STREAM_LIBRARY}
    ${LIBXML2_LIBRARIES}
    TitleGenerator
    ${ARGP_LIBRARIES}
)

target_link_libraries(vss2svg-conv
    Visio2Svg
)

target_link_libraries(vsd2svg-conv
    Visio2Svg
)

if (NOT LIB_INSTALL_DIR)
    set(LIB_INSTALL_DIR lib)
endif ()

if (NOT BIN_INSTALL_DIR)
    set(BIN_INSTALL_DIR bin)
endif ()

if (NOT INCLUDE_INSTALL_DIR)
    set(INCLUDE_INSTALL_DIR include)
endif ()


SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
INSTALL(TARGETS vss2svg-conv vsd2svg-conv TitleGenerator Visio2Svg
  RUNTIME DESTINATION ${BIN_INSTALL_DIR}
  LIBRARY DESTINATION ${LIB_INSTALL_DIR}
  ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)

INSTALL(DIRECTORY inc/visio2svg DESTINATION ${INCLUDE_INSTALL_DIR})

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

2 participants