Github Action - Can't build gtest using ccache, mingw, cmake and ninja - github-actions

I am using this workflow: cmake_build.yaml
Here is my toplevel CMakeLists.txt:
cmake_minimum_required(VERSION 3.15)
project(
container
VERSION 0.1.0
DESCRIPTION "An extension to the standard container library in c++"
HOMEPAGE_URL ""
LANGUAGES CXX
)
add_executable(${PROJECT_NAME} src/main.cpp)
set_target_properties(
${PROJECT_NAME}
PROPERTIES
LINKER_LANGUAGE CXX
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}"
)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
target_include_directories(
${PROJECT_NAME}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
install(
DIRECTORY
include/${PROJECT_NAME_LOWERCASE}
DESTINATION
include
)
enable_testing()
add_subdirectory(test)
and test/CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
project(my_project)
# GoogleTest requires at least C++14
set(CMAKE_CXX_STANDARD 17)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
add_executable(
hello_test
hello_test.cc
)
target_link_libraries(
hello_test
GTest::gtest_main
)
include(GoogleTest)
gtest_discover_tests(hello_test)
I am using the example from gtest docs:
test/hello_test.cc:
#include <gtest/gtest.h>
TEST(HelloTest, BasicAssertions) {
// Expect two strings not to be equal.
EXPECT_STRNE("hello", "world");
// Expect equality.
EXPECT_EQ(7 * 6, 42);
}
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
It builds fine on Windows MSVC, Macos Clang, Linux GCC, but fails using Mingw GCC, here is error shown:
FAILED: test/hello_test.exe test/hello_test[1]_tests.cmake D:/a/tsst/tsst/build/test/hello_test[1]_tests.cmake
cmd.exe /C "cd . && C:\ProgramData\chocolatey\bin\g++.exe -O3 -DNDEBUG test/CMakeFiles/hello_test.dir/hello_test.cc.obj -o test\hello_test.exe -Wl,--out-implib,test\libhello_test.dll.a -Wl,--major-image-version,0,--minor-image-version,0 lib/libgtest_main.a lib/libgtest.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cmd.exe /C "cd /D D:\a\tsst\tsst\build\test && D:\a\tsst\tsst\cmake-3.24.3-windows-x86_64\bin\cmake.exe -D TEST_TARGET=hello_test -D TEST_EXECUTABLE=D:/a/tsst/tsst/build/test/hello_test.exe -D TEST_EXECUTOR= -D TEST_WORKING_DIR=D:/a/tsst/tsst/build/test -D TEST_EXTRA_ARGS= -D TEST_PROPERTIES= -D TEST_PREFIX= -D TEST_SUFFIX= -D TEST_FILTER= -D NO_PRETTY_TYPES=FALSE -D NO_PRETTY_VALUES=FALSE -D TEST_LIST=hello_test_TESTS -D CTEST_FILE=D:/a/tsst/tsst/build/test/hello_test[1]_tests.cmake -D TEST_DISCOVERY_TIMEOUT=5 -D TEST_XML_OUTPUT_DIR= -P D:/a/tsst/tsst/cmake-3.24.3-windows-x86_64/share/cmake-3.24/Modules/GoogleTestAddTests.cmake""
CMake Error at D:/a/tsst/tsst/cmake-3.24.3-windows-x86_64/share/cmake-3.24/Modules/GoogleTestAddTests.cmake:112 (message):
Error running test executable.
Path: 'D:/a/tsst/tsst/build/test/hello_test.exe'
Result: Exit code 0xc0000139
Output:
Call Stack (most recent call first):
D:/a/tsst/tsst/cmake-3.24.3-windows-x86_64/share/cmake-3.24/Modules/GoogleTestAddTests.cmake:225 (gtest_discover_tests_impl)
ninja: build stopped: subcommand failed.
Build works fine without building gtest, and it fails when building test executable with gtest

Related

Trouble installing DBD::mysql under macOS Catalina 10.15.1

Can't install DBD::mysql under macOS Catalina 10.15.1. Mysql 8.0.18 and openssl 1.0.2t are installed through brew.
Here is the module installation log:
cpan[1]> install DBD::mysql
..........
I will use the following settings for compiling and testing:
cflags (mysql_config) = -I/usr/local/Cellar/mysql/8.0.18_1/include/mysql
embedded (guessed ) =
ldflags (guessed ) =
libs (mysql_config) = -L/usr/local/Cellar/mysql/8.0.18_1/lib -L/usr/local/opt/openssl/lib -lmysqlclient -lssl -lcrypto
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
nossl (default ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testport (default ) =
testsocket (default ) =
testuser (guessed ) = dmitry
To change these settings, see 'perl Makefile.PL --help' and
'perldoc DBD::mysql::INSTALL'.
Checking if libs are available for compiling...
Looks good.
Checking if your kit is complete...
Looks good
Using DBI 1.631 (for perl 5.018004 on darwin-thread-multi-2level) installed in /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/
Writing Makefile for DBD::mysql
Wide character in print at /System/Library/Perl/5.18/ExtUtils/MakeMaker.pm line 1034.
Wide character in print at /System/Library/Perl/5.18/ExtUtils/MakeMaker.pm line 1034.
Writing MYMETA.yml and MYMETA.json
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cc -c -I/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI -I/usr/local/Cellar/mysql/8.0.18_1/include/mysql -DDBD_MYSQL_WITH_SSL -g -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"4.050\" -DXS_VERSION=\"4.050\" -iwithsysroot "/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" dbdimp.c
In file included from dbdimp.c:15:
./dbdimp.h:20:10: fatal error: 'DBIXS.h' file not found
#include <DBIXS.h> /* installed by the DBI module */
^~~~~~~~~
1 error generated.
make: *** [dbdimp.o] Error 1
DVEEDEN/DBD-mysql-4.050.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
DVEEDEN/DBD-mysql-4.050.tar.gz : make NO
cpan[2]>
It seems the compiler could not find the DBIXS.h file. find found this file in the system:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
How to include this header file during compilation?
UPDATE
My searches led me to build the package using the standard path where there are no header files
/System/Library/Perl/5.18/darwin-thread-multi-2level
And you must use the path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level
But here's how to specify it? I encountered the same problem when installing Mac::SystemDirectory
/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h -
file not found
Perl information:
perl -V
Summary of my perl5 (revision 5 version 18 subversion 4) configuration:
Platform:
osname=darwin, osvers=19.0, archname=darwin-thread-multi-2level
uname='darwin osx391.sd.apple.com 19.0 darwin kernel version 18.0.0: tue jul 9 11:12:08 pdt 2019; root:xnu-4903.201.2.100.7~1release_x86_64 x86_64 '
config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none -Dcc=cc'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags =' -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector',
optimize='-Os',
cppflags='-g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector'
ccversion='', gccversion='4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.32.4) (-macos10.15-objc-selector-opts)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector'
libpth=/usr/lib /usr/local/lib
libs=
perllibs=
libc=, so=dylib, useshrplib=true, libperl=libperl.dylib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API
Locally applied patches:
/Library/Perl/Updates/<version> comes before system perl directories
installprivlib and installarchlib points to the Updates directory
Built under darwin
Compiled at Aug 23 2019 16:44:31
#INC:
/Library/Perl/5.18/darwin-thread-multi-2level
/Library/Perl/5.18
/Network/Library/Perl/5.18/darwin-thread-multi-2level
/Network/Library/Perl/5.18
/Library/Perl/Updates/5.18.4/darwin-thread-multi-2level
/Library/Perl/Updates/5.18.4
/System/Library/Perl/5.18/darwin-thread-multi-2level
/System/Library/Perl/5.18
/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.18
.
The missing EXTERN.h file you find here:
$ find /Library/Developer/CommandLineTools -name EXTERN.h
A detailed instructions you find here:
DBD::mysql installation on Catalina/Big Sur fail with 'EXTERN.h' file not found?

Meson find_program not finding program

I'm building a Vala program with gnome-builder and flatpak. I wan't to connect to a mySQL Database. Thats why I need to run mysql_config to get the right compiler flags.
So I added mysql_config = find_program('mysql_config')to my meson.build file.
When I try to compile I get meson.build:7:0: ERROR: Program(s) ['mysql_config'] not found or not executable.
When I run whereis mysql_config on command line I get the expected result mysql_config: /usr/bin/mysql_config. Also I can run mysql_config --cflags from command line with the expected result -I/usr/include/mysql -I/usr/include/mysql.
Thats why I think that the problem is that I'm building with flatpak-builder.
My ./meson.build:
project('zeiterfassunggtk', ['c', 'vala'], version: '0.1.0',
meson_version: '>= 0.40.0',
)
i18n = import('i18n')
mysql_config = find_program('mysql_config')
mysql_vapi = meson.get_compiler('vala').find_library('mysql')
mysql_dep = declare_dependency(c_args: run_command([mysql_config, '--cflags']).stdout().split(),
link_args: run_command([mysql_config, '--libs']).stdout().split(),
dependencies: [mysql_vapi])
subdir('data')
subdir('src')
subdir('po')
meson.add_install_script('build-aux/meson/postinstall.py')
My ./src/meson.build
zeiterfassunggtk_sources = [
'main.vala',
'window.vala',
'mysql.vala',
]
zeiterfassunggtk_deps = [
dependency('gio-2.0', version: '>= 2.50'),
dependency('gtk+-3.0', version: '>= 3.22'),
]
gnome = import('gnome')
zeiterfassunggtk_sources += gnome.compile_resources('zeiterfassunggtk-resources',
'zeiterfassunggtk.gresource.xml',
c_name: 'zeiterfassunggtk'
)
executable('zeiterfassunggtk', zeiterfassunggtk_sources,
vala_args: '--target-glib=2.50', dependencies: zeiterfassunggtk_deps,
install: true,
)
The full output of the build process:
flatpak build --env=LANG=de_AT.UTF-8 --env=USER=g.zehetner --env=HOME=/home/g.zehetner --env=PATH=/usr/bin:/bin --env=TERM=xterm-256color --env=V=0 --env=CCACHE_DIR=/home/g.zehetner/.cache/gnome-builder/flatpak-builder/ccache --env=PATH=/app/bin:/usr/bin --build-dir=/home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/builds/org.gnome.Zeiterfassunggtk.json-flatpak-org.gnome.Platform-x86_64-3.26-master --share=network --nofilesystem=host --filesystem=/home/g.zehetner/.cache/gnome-builder --filesystem=/home/g.zehetner/Projekte/ZeiterfassungGtk --filesystem=/home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/builds/org.gnome.Zeiterfassunggtk.json-flatpak-org.gnome.Platform-x86_64-3.26-master --env=V=1 '--env=CFLAGS=-O2 -g' '--env=CXXFLAGS=-O2 -g' --env=NOCONFIGURE=1 /home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/flatpak/staging/x86_64-master ninja
[0/1] Regenerating build files.
The Meson build system
Version: 0.46.0
Source dir: /home/g.zehetner/Projekte/ZeiterfassungGtk
Build dir: /home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/builds/org.gnome.Zeiterfassunggtk.json-flatpak-org.gnome.Platform-x86_64-3.26-master
Build type: native build
Project name: zeiterfassunggtk
Native C compiler: ccache cc (gcc 6.2.0 "cc (GCC) 6.2.0")
Appending CFLAGS from environment: '-O2 -g'
Appending LDFLAGS from environment: '-L/app/lib '
Native Vala compiler: valac (valac 0.38.2)
Appending LDFLAGS from environment: '-L/app/lib '
Build machine cpu family: x86_64
Build machine cpu: x86_64
Program mysql_config found: NO
meson.build:7:0: ERROR: Program(s) ['mysql_config'] not found or not executable
A full log can be found at /home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/builds/org.gnome.Zeiterfassunggtk.json-flatpak-org.gnome.Platform-x86_64-3.26-master/meson-logs/meson-log.txt
FAILED: build.ninja
/usr/bin/python3 /usr/bin/meson --internal regenerate /home/g.zehetner/Projekte/ZeiterfassungGtk /home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/builds/org.gnome.Zeiterfassunggtk.json-flatpak-org.gnome.Platform-x86_64-3.26-master --backend ninja
ninja: error: rebuilding 'build.ninja': subcommand failed
You can find the full code at Github.com

Please tell me how to run my UEFI application on QEMU

My environment is Ubuntu15.10.
I wrote the following source code.
#include "efi.h"
#include "efilib.h"
EFI_STATUS
EFIAPI
efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
InitializeLib(ImageHandle, SystemTable);
Print(L"HelloWorld\n");
return EFI_SUCCESS;
}
I wrote the following Makefile and compile source code.
ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
OBJS = main.o
TARGET = hello.efi
EFIINC = /usr/include/efi
EFIINCS = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol
EFILIB = /usr/lib
EFI_CRT_OBJS = $(EFILIB)/crt0-efi-$(ARCH).o
EFI_LDS = $(EFILIB)/elf_$(ARCH)_efi.lds
CFLAGS = $(EFIINCS) -fno-stack-protector -fpic \
-fshort-wchar -mno-red-zone -Wall
ifeq ($(ARCH),x86_64)
CFLAGS += -DEFI_FUNCTION_WRAPPER
endif
LDFLAGS = -nostdlib -znocombreloc -T $(EFI_LDS) -shared \
-Bsymbolic -L $(EFILIB) -L $(LIB) $(EFI_CRT_OBJS)
all: $(TARGET)
hello.so:$(OBJS)
ld $(LDFLAGS) $(OBJS) -o $# -lefi -lgnuefi
%.efi: %.so
objcopy -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc \
--target=efi-app-$(ARCH) $^ $#
I store hello.efi on named RT directory and I run "qemu-system-x86_64 -bios OVMF.fd -hda fat:RT/".
I run hello.efi but not execute my UEFI application.
Qemu say "Error reported: Invalud Parameter".
Please help me!
Removing -L $(LIB) from the LDFLAGS in the Makefile helped:
Don't you need 'main()' vs. 'efi_main()'?

Busybox rpm scriplets

I am packaging with rpm for embedded device with busybox instead normal GNU system.
When I install with busybox, it install module, but do not even try to run scriplets.
On regular system, It runs them and fails(ofc, another version of kernel).
Question: Where am I wrong, and how to work around it?
Here is my spec-file:
# The kernel version you are building for
%define kernel 3.4.0-rc6-01292-g9b8149d
# The name of the module you are supplying
%define modname ktgrabber
# The path to the module, after it is installed
%define modpath /lib/modules/%{kernel}/kernel/net/ipv4
# Which revision are we on
%define pkgrelease 1.SL
# Is this a new module, or are we replacing an existing module
# 1 - new module
# 0 - replacing an existing module
%define newmodule 1
# Optional - what Architecture we are building for
#%define thisarch ia32e
Name: kernel-module-%{modname}-%{kernel}
Summary: Kernel Module %{modname} for the %{kernel} kernel
Version: 0.99
Release: 1
Epoch: 0
License: GPLv2+
Packager: Troy Dawson <dawson#fnal.gov>
Group: System Environment/Kernel
BuildRoot: %{_tmppath}/%{name}-%{version}-root
#Requires: /boot/vmlinux-%{kernel}, modutils
Provides: kernel-module-%{modname} = %{epoch}:%{version}
Source0: %{modname}.ko.%{kernel}
%description
This package provides a %{modname} kernel module for
kernel %{kernel}.
%install
mkdir -p $RPM_BUILD_ROOT/%{modpath}
%if %{newmodule}
install -m 644 %{SOURCE0} $RPM_BUILD_ROOT/%{modpath}/%{modname}.ko
%else
install -m 644 %{SOURCE0} $RPM_BUILD_ROOT/%{modpath}/%{modname}.%{version}.%{pkgrelease}.o
%endif
%pre
touch /root/bar
mkdir /alice
%post
touch /bar
/bin/echo %{modname} >> /etc/modules
depmod
mkdir /foo
depmod -ae %{kernel} >/dev/null 2>&1
modprobe %{modname}
%postun
sed -i 's/^%{modname}$//g' /etc/modules
%if %{newmodule}
depmod -ae %{kernel} >/dev/null 2>&1 || :
%else
if [ "" = "0" ] ; then
if ! [ -f %{modpath}/%{modname}.original.o ] ; then
mv %{modpath}/%{modname}.o %{modpath}/%{modname}.original.o
fi
cp -f %{modpath}/%{modname}.%{version}.%{pkgrelease}.o %{modpath}/%{modname}.o
depmod -ae %{kernel} >/dev/null 2>&1 || :
fi
%endif
%files
%if %{newmodule}
%{modpath}/%{modname}.ko
%else
%{modpath}/%{modname}.%{version}.%{pkgrelease}.ko
%endif
Check out this link : http://lists.busybox.net/pipermail/busybox/2006-November/059507.html scriptlets aren't run by busybox's rpm command.
Looking at the source at http://git.busybox.net/busybox/tree/archival/rpm.c#n149 that appears to be true.

creating ipa file using command line with code signing

I am trying to create an ipa file using xcode command line including signing.
i tried searching for it, i got the commands to create ipa with out code signing.
i need the commands mainly to integrate with hudson CI.
Please suggest.
-Prahasa
This is the script which I use to integrate with Hudson and my iPhone Apps.
#!/bin/sh
CONFIGURATION="AdHoc" # or Release or Debug
# location of files included in dist (.mobileprovision, iTunesArtwork, README)
DISTDIR="_distfiles"
. build.config
MARKETING_VERSION=`agvtool what-marketing-version -terse1`
build_xcode ()
{
xcodebuild -configuration "$CONFIGURATION" -sdk $SDK
}
# CONFIGURATION for xcode build can be overridden from commandline
NEWCONFIG="$1"
if ! test "$NEWCONFIG"x = x; then
echo "=== using configuration from command line $NEWCONFIG"
CONFIGURATION="$NEWCONFIG"
fi
# XCODE check build available for specified configuration
CHECKCONFIGURATION=`xcodebuild -list | egrep "$CONFIGURATION($|\ )"`
if test "$CHECKCONFIGURATION"x = x; then
echo "ERROR: xcodebuild could not find valid build configuration $CONFIGURATION"
echo
xcodebuild -list
echo
exit
fi
VERSION="$MARKETING_VERSION ($BUILD_NUMBER)"
#######
echo "=== Building distribution package for $RELEASE - $VERSION"
echo "=== setting build number to $BUILD_NUMBER"
agvtool new-version -all "${BUILD_NUMBER}"
# XCODE make sure buildpath exists for configuration, build if missing
BUILDPATH="build/$CONFIGURATION-iphoneos"
build_xcode
if [ $? != 0 ]; then
echo "ERROR: xcodebuild not successful"
exit 1
fi
if test ! -d "$BUILDPATH"; then
echo "ERROR: xcodebuild could not build configuration $CONGIRUATION ($BUILDPATH)"
exit
fi
echo "=== Successfully built configuration $CONFIGURATION ($BUILDPATH)"
# HACK : accomodate configurations with spaces, chdir to determine app name
cd "$BUILDPATH"
# derive name of .app dir (application)
APPDIR=`ls -d *.app`
cd ../..
APPPATH="$BUILDPATH/$APPDIR"
DSYMPATH="$BUILDPATH/$APPDIR.dSYM"
if test "$APPDIR"x = x; then
APPPATH="$BUILDPATH/.app"
fi
# XCODE make sure app dir exists in buildpath, build if missing
if test ! -d "$APPPATH"; then
echo "missing $APPPATH build in $BUILDPATH, trying to build"
build_xcode
# HACK : accomodate configurations with spaces, chdir to determine app name
cd "$BUILDPATH"
# derive name of .app dir (application)
APPDIR=`ls -d *.app`
cd ../..
# check again for APPDIR/APPPATH
APPPATH="$BUILDPATH/$APPDIR"
if test "$APPDIR"x = x; then
APPPATH="$BUILDPATH/.app"
fi
if test ! -d "$APPPATH"; then
echo "ERROR: xcodebuild could not build $APPPATH configuration $CONGIRUATION ($BUILDPATH)"
exit
fi
echo "=== Successfully built $APPDIR configuration $CONFIGURATION ($BUILDPATH)"
fi
# Create directory for release package
echo " - Creating release dir"
RELEASEDIR="$RELEASEBASE/$RELEASE-$CONFIGURATION-$MARKETING_VERSION-$BUILD_NUMBER"
mkdir -p "$RELEASEDIR"
echo "RELEASEDIR = $RELEASEDIR"
echo "BUILDPATH = $BUILDPATH"
echo "APPPATH = $APPPATH"
echo "DSYMPATH = $APPPATH"
# Copy other files
cp $DISTDIR/* "$RELEASEDIR"
# .IPA file: iphone app archive file, installable by itunes
IPA=`echo $APPDIR | sed "s/\.app/\.ipa/"`
echo " - Creating $IPA payload"
mkdir -p "$RELEASEDIR/Payload/"
echo " - Copying $APPPATH to $RELEASEDIR/Payload/"
# Copy built .app to payload/ itunes-specific install dir
cp -Rp "$APPPATH" "$RELEASEDIR/Payload/"
# Build .IPA file
# this is just a zipfile with a payload/ dir with the .app, and artwork
cd "$RELEASEDIR"
# include 512x512 png of artwork, if foudn
if test -f "iTunesArtwork"; then
zip -y -r "$IPA" iTunesArtwork Payload/
rm -rf Payload iTunesArtwork
else
zip -y -r "$IPA" Payload/
rm -rf Payload
fi
cd ..
pwd
# Create .zip packaged Distribution
ZIPFILE="$RELEASE-$CONFIGURATION-$MARKETING_VERSION-$BUILD_NUMBER.zip"
DSYMZIPFILE="$RELEASE-$CONFIGURATION-$MARKETING_VERSION-$BUILD_NUMBER-dSYM.zip"
echo " - zipfile is $ZIPFILE"
echo " - Compressing release $ZIPFILE"
zip -y -r "$ZIPFILE" "$RELEASE-$CONFIGURATION-$MARKETING_VERSION-$BUILD_NUMBER"
cp -pR "../$DSYMPATH" "$RELEASE-$CONFIGURATION-$MARKETING_VERSION-$BUILD_NUMBER"
echo " - creating zip of dSYM file"
zip -y -r "$DSYMZIPFILE" "$RELEASE-$CONFIGURATION-$MARKETING_VERSION-$BUILD_NUMBER/$APPDIR.dSYM"
cd ..
echo "=== Build complete for $RELEASEBASE/$ZIPFILE"
Then, my hudson configuration looks like this:
./build.sh AdHoc
./build.sh Release
Finally, my files to archive looks like this:
_release/MobilePracticePro-*-${BUILD_NUMBER}*.zip
Hope this is helpful to you! Using Hudson is really great. Also, realize your signing key needs to be installed on the same box as hudson runs and running as same user. At least that is how it is for me.
I have been facing the same issue and resolved by using the steps give in the details of the link Xcode "Build and Archive" from command line