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

WIP - Add ARM job to Travis-CI #1235

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ env:

matrix:
include:
- name: "Ubuntu 16.04 - gcc-5.4 (Release) - ARM"
os: linux
arch: arm64
dist: xenial
sudo: required
compiler: gcc
env:
- BUILD_TYPE="Release"
- CONAN_WEBREADY_DISABLED=1
- COMMON_CMAKE_OPTIONS="-DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_ENABLE_CURL=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_INSTALL_PREFIX=install"

- name: "Ubuntu 16.04 - gcc-5.4 (Release)"
os: linux
dist: xenial
Expand Down
9 changes: 8 additions & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ fi
source conan/bin/activate

mkdir build && cd build
conan install .. -o webready=True --build missing
if [ -n "$CONAN_WEBREADY_DISABLED" ]; then
conan install .. -o webready=False --build missing
else
conan install .. -o webready=True --build missing
fi

cmake --version
gcc --version

cmake ${CMAKE_OPTIONS} ..
make -j2
Expand Down
9 changes: 6 additions & 3 deletions cmake/compilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
endif()
endif()

add_compile_options(-Wp,-D_GLIBCXX_ASSERTIONS)
if (NOT MINGW)
add_compile_options(-Wp,-D_GLIBCXX_ASSERTIONS)

if (CMAKE_BUILD_TYPE STREQUAL Release AND NOT APPLE)
add_compile_options(-Wp,-D_FORTIFY_SOURCE=2) # Requires to compile with -O2
if (CMAKE_BUILD_TYPE STREQUAL Release AND NOT APPLE)
add_compile_options(-Wp,-D_FORTIFY_SOURCE=2) # Requires to compile with -O2
endif()
endif()


if(BUILD_WITH_COVERAGE)
add_compile_options(--coverage)
# TODO: From CMake 3.13 we could use add_link_options instead these 2 lines
Expand Down
21 changes: 21 additions & 0 deletions cmake/linux-mingw64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)

# cross compilers to use for C and C++
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix)
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
set(CMAKE_CXX_FLAGS "-fno-stack-protector")

# target environment on the build host system
# set 1st to dir with the cross compiler's C/C++ headers/libs
#set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
#set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})

# modify default behavior of FIND_XXX() commands to
# search for headers/libs in the target environment and
# search for programs in the build host environment
#set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
#set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
#set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
56 changes: 56 additions & 0 deletions notesOnCrossCompiling.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Conan Profile for linux_to_win64

luis@ryzenLinux:~/.conan/profiles$ cat linux_to_win64
toolchain=/usr/x86_64-w64-mingw32 # Adjust this path
target_host=x86_64-w64-mingw32
cc_compiler=gcc
cxx_compiler=g++

[env]
CONAN_CMAKE_FIND_ROOT_PATH=$toolchain
CHOST=$target_host
AR=$target_host-ar
AS=$target_host-as
RANLIB=$target_host-ranlib
CC=$target_host-$cc_compiler
CXX=$target_host-$cxx_compiler
STRIP=$target_host-strip
RC=$target_host-windres

[settings]
# We are cross-building to Windows
os=Windows
arch=x86_64
compiler=gcc

# Adjust to the gcc version of your MinGW package
compiler.version=9.3
compiler.libcxx=libstdc++11
build_type=Release

CMake Toolchain file:
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
set(CMAKE_SYSROOT /usr/lib/gcc/x86_64-w64-mingw32/9.3-posix)

set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)



For configuring and building on mingw

conan install --build missing --profile linux_to_win64 ../
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/linux-mingw64.cmake -DBUILD_SHARED_LIBS=OFF ../

It is possible to build the library and all the applications if the exiv2lib is STATIC
(-DBUILD_SHARED_LIBS=OFF). However, when building the SHARED library we get this linking error:

[ 56%] Linking CXX executable ../bin/exiv2.exe
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/exiv2.dir/objects.a(params.cpp.obj):params.cpp:(.text$_ZN5Exiv210BasicErrorIcEC1INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_9ErrorCodeERKT_[_ZN5Exiv210BasicErrorIcEC1INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_9ErrorCodeERKT_]+0x95): undefined reference to `__imp__ZN5Exiv210BasicErrorIcE6setMsgEv'
collect2: error: ld returned 1 exit status

As discussed in the following link, we have to deal with the BasicError::setMsg monster:
https://github.com/Exiv2/exiv2/issues/663
6 changes: 6 additions & 0 deletions xmpsdk/include/XMP_Environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@
#elif defined macintosh || defined MACOS_CLASSIC || defined MACOS_X_UNIX || defined MACOS_X || defined MACOS || defined(__APPLE__)
# define MAC_ENV 1
#else

#ifdef __MINGW32__
# define WIN_ENV 1
#else
# define UNIX_ENV 1
#endif

#endif

// ! Tempting though it might be to have a standard macro for big or little endian, there seems to
// ! be no decent way to do that on our own in UNIX. Forcing it on the client isn't acceptable.

Expand Down