Merge lp:~widelands-dev/widelands/macos_build_app_compiler into lp:widelands
- macos_build_app_compiler
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 8789 |
Proposed branch: | lp:~widelands-dev/widelands/macos_build_app_compiler |
Merge into: | lp:widelands |
Prerequisite: | lp:~widelands-dev/widelands/macos_build_app |
Diff against target: |
157 lines (+74/-12) 2 files modified
CMakeLists.txt (+8/-0) utils/macos/build_app.sh (+66/-12) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/macos_build_app_compiler |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Klaus Halfmann | dowload,short testrun | Approve | |
GunChleoc | Approve | ||
Review via email: mp+353035@code.launchpad.net |
Commit message
choose between compiler clang or gcc, specify build type: debug or release
Description of the change
One can choose between Clang and GCC now. The Wiki has been changed accordingly:
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 3796. State: failed. Details: https:/
Appveyor build 3595. State: failed. Details: https:/
Klaus Halfmann (klaus-halfmann) wrote : | # |
Toni, you re doing a great job!
Just give me some time to catch up with your speed :-)
You may contact me via PM or such, so we can align on our skills.
Ill try to review this this week but will not promise anything ...
Klaus Halfmann (klaus-halfmann) wrote : | # |
Mmh, this does not contain the ASAN Flags as we have them in compile.sh,
this would make sense for a debug build (yes, it _is_ slower :-)
OTOH wee need this just for the release in then End, I would guess.
I use macports so lets try this now ....
wlbuild klaus$ ./build_app.sh clang debug ../macos_
Source: ../macos_
Version: r8783
Destination: WidelandsRelease
Type: Debug
macOS: 10.13
Compiler: Apple LLVM version 9.1.0 (clang-902.0.39.2)
./build_app.sh: line 140: brew: command not found
OK so this is tied to homebrew (will not install this here)
There is a script / reciept for macports, too.
Are you interested to get into contact with the maintainer?
(I think there is some howto for macports on the homepage, too)
Code LGTM. so maybe you want to provide me with some .dmg derived from your script?
As this will not affect any build this can go in.
Toni Förster (stonerl) wrote : | # |
$ ./build_app.sh clang debug ../macos_
gives me this output later on
-- Using AddressSanitizer http://
So it is using it without explicitly declaring it. Does work with clang. gcc currently gives me headaches, though. It seems to use the clangs dylib.
Still do some testings and gonna add some stuff to the script. When done I'll give you some .dmg
Klaus Halfmann (klaus-halfmann) wrote : | # |
I rember that SirVer used brew as well for R19 and I used macports
and we had some significat differences in the end, was much bigger, or such.
SirVer, Gun: do we have that Ticket still in some Archive?
Once we target R20 we should use all variants and use the smalles/fastest on.
Lets see.
Toni Förster (stonerl) wrote : | # |
Here are the clang builds:
http://
http://
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 3800. State: failed. Details: https:/
Appveyor build 3599. State: success. Details: https:/
GunChleoc (gunchleoc) wrote : | # |
> SirVer, Gun: do we have that Ticket still in some Archive?
There is nothing relevant with the "macos" tag in the archive. Of course, such a bug might have been fix released before I did the tag cleanup.
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 3805. State: passed. Details: https:/
Appveyor build 3604. State: success. Details: https:/
Toni Förster (stonerl) wrote : | # |
@Klaus
is there something like "brew --prefix" for MacPorts? We could easily adapt the script to handle both package manager.
Also ASsam is enabled by default for debug builds in the "CMakeLists.txt" That's why I havn't had to enable it for debug.
I disabled it for GCC, though.
Klaus Halfmann (klaus-halfmann) wrote : | # |
@Toni
We already have a description to build developer verions using macports:
https:/
And some dsicussion around this as well: https:/
And the corresponding Portfile, which includes some packagnh, too:
https:/
We may have to Adopt this along with your changes.
I am downloading your .dmg and will check them (running, compare binary size etc.)
In theory macports and Brew should result in the +/- same binary, but, well ....
Klaus Halfmann (klaus-halfmann) wrote : | # |
Approve, checked both images, (debug build is 50M,
my develop build is 67M but all libs are staically linked)
I only tried to open a savegame. (which was from some other brach, and failed to load, well)
travis currebtly has some erro as of a broken test / savegame.
We can either merge trunk to fix this or use the force, what do you think :-)
Toni Förster (stonerl) wrote : | # |
I just added a check for ccache and added gettext to $PATH to avoid force linking it (removed thsi line from the wiki). Also merged from trunk.
ASan stays disabled for GCC since it does not pass the test and throws error like this one:
Start 1: test_economy
1/4 Test #1: test_economy .......
==3314==The following global variable is not properly aligned.
==3314==This may happen if another global with the same name
==3314==resides in another non-instrumented module.
==3314==Or the global comes from a C file built w/o -fno-common.
==3314==In either case this is likely an ODR violation bug,
==3314==but AddressSanitizer can not provide more details.
=======
==3314==ERROR: AddressSanitizer: odr-violation (0x001c0000003a):
ASAN:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.
Start 2: test_io_filesystem
2/4 Test #2: test_io_filesystem .......
==3315==The following global variable is not properly aligned.
==3315==This may happen if another global with the same name
==3315==resides in another non-instrumented module.
==3315==Or the global comes from a C file built w/o -fno-common.
==3315==In either case this is likely an ODR violation bug,
==3315==but AddressSanitizer can not provide more details.
=======
==3315==ERROR: AddressSanitizer: odr-violation (0x0001000000e3):
ASAN:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.
Start 3: notifications_test
3/4 Test #3: notifications_test ............... Passed 0.43 sec
Start 4: test_scripting
4/4 Test #4: test_scripting .......
==3317==The following global variable is not properly aligned.
==3317==This may happen if another global with the same name
==3317==resides in another non-instrumented module.
==3317==Or the global comes from a C file built w/o -fno-common.
==3317==In either case this is likely an ODR violation bug,
==3317==but AddressSanitizer can not provide more details.
=======
==3317==ERROR: AddressSanitizer: odr-violation (0x000100000162):
ASAN:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 3809. State: passed. Details: https:/
Appveyor build 3608. State: success. Details: https:/
GunChleoc (gunchleoc) wrote : | # |
Let's have it :)
@bunnybot merge
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2018-05-16 19:37:59 +0000 |
3 | +++ CMakeLists.txt 2018-08-15 18:37:08 +0000 |
4 | @@ -79,6 +79,14 @@ |
5 | endif() |
6 | endif() |
7 | |
8 | +# Disable no symbols warning on macOS |
9 | +if (APPLE) |
10 | + SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>") |
11 | + SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>") |
12 | + SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>") |
13 | + SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>") |
14 | +endif() |
15 | + |
16 | # TODO(sirver): One day, this should be enabled. Then we have no more cycles in our dependencies.... |
17 | # set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES ON) |
18 | |
19 | |
20 | === modified file 'utils/macos/build_app.sh' |
21 | --- utils/macos/build_app.sh 2018-08-12 19:02:16 +0000 |
22 | +++ utils/macos/build_app.sh 2018-08-15 18:37:08 +0000 |
23 | @@ -2,9 +2,54 @@ |
24 | |
25 | set -e |
26 | |
27 | -if [ "$#" == "0" ]; then |
28 | - echo "Usage: $0 <bzr_repo_directory>" |
29 | - exit 1 |
30 | +USAGE="Usage: $0 <clang|gcc> <debug|release> <bzr_repo_directory>" |
31 | +USE_ASAN="OFF" |
32 | + |
33 | +if [ ! -z "$3" ]; then |
34 | + case "$2" in |
35 | + debug|Debug) |
36 | + TYPE="Debug" |
37 | + if [ "$1" == "clang" ]; then |
38 | + USE_ASAN="ON" |
39 | + # Necessary to avoid linking errors later on |
40 | + ASANLIB=$(echo "int main(void){return 0;}" | xcrun clang -fsanitize=address \ |
41 | + -xc -o/dev/null -v - 2>&1 | tr ' ' '\n' | grep libclang_rt.asan_osx_dynamic.dylib) |
42 | + mkdir -p "@rpath" |
43 | + ln -fs "$ASANLIB" "@rpath/" |
44 | + fi |
45 | + ;; |
46 | + release|Release) |
47 | + TYPE="Release" |
48 | + ;; |
49 | + *) |
50 | + echo $USAGE |
51 | + exit 1 |
52 | + ;; |
53 | + esac |
54 | + case "$1" in |
55 | + clang) |
56 | + C_COMPILER="clang" |
57 | + CXX_COMPILER="clang++" |
58 | + COMPILER=$(clang --version | grep "clang") |
59 | + ;; |
60 | + gcc) |
61 | + C_COMPILER="gcc-7" |
62 | + CXX_COMPILER="g++-7" |
63 | + COMPILER=$(gcc-7 --version | grep "GCC") |
64 | + ;; |
65 | + *) |
66 | + echo $USAGE |
67 | + exit 1 |
68 | + ;; |
69 | + esac |
70 | + if [ ! -z $(type -p ccache) ]; then |
71 | + C_COMPILER="$(brew --prefix ccache)/libexec/$C_COMPILER" |
72 | + CXX_COMPILER="$(brew --prefix ccache)/libexec/$CXX_COMPILER" |
73 | + fi |
74 | + SOURCE_DIR=$3 |
75 | +else |
76 | + echo $USAGE |
77 | + exit 1 |
78 | fi |
79 | |
80 | # Check if the SDK for the minimum build target is available. |
81 | @@ -17,10 +62,9 @@ |
82 | SDK_DIRECTORY="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk" |
83 | fi |
84 | |
85 | -SOURCE_DIR=$1 |
86 | REVISION=`bzr revno $SOURCE_DIR` |
87 | DESTINATION="WidelandsRelease" |
88 | -TYPE="Release" |
89 | + |
90 | if [[ -f $SOURCE_DIR/WL_RELEASE ]]; then |
91 | WLVERSION="$(cat $SOURCE_DIR/WL_RELEASE)" |
92 | else |
93 | @@ -33,6 +77,7 @@ |
94 | echo " Destination: $DESTINATION" |
95 | echo " Type: $TYPE" |
96 | echo " macOS: $OSX_MIN_VERSION" |
97 | +echo " Compiler: $COMPILER" |
98 | echo "" |
99 | |
100 | function MakeDMG { |
101 | @@ -46,7 +91,11 @@ |
102 | cp $SOURCE_DIR/COPYING $DESTINATION/COPYING.txt |
103 | |
104 | echo "Creating DMG ..." |
105 | - hdiutil create -fs HFS+ -volname "Widelands $WLVERSION" -srcfolder "$DESTINATION" "$UP/widelands_64bit_$WLVERSION.dmg" |
106 | + if [ "$TYPE" == "Release" ]; then |
107 | + hdiutil create -fs HFS+ -volname "Widelands $WLVERSION" -srcfolder "$DESTINATION" "$UP/widelands_64bit_$WLVERSION.dmg" |
108 | + elif [ "$TYPE" == "Debug" ]; then |
109 | + hdiutil create -fs HFS+ -volname "Widelands $WLVERSION" -srcfolder "$DESTINATION" "$UP/widelands_64bit_${WLVERSION}_${TYPE}.dmg" |
110 | + fi |
111 | } |
112 | |
113 | function CopyLibrary { |
114 | @@ -109,24 +158,28 @@ |
115 | } |
116 | |
117 | function BuildWidelands() { |
118 | - PREFIX_PATH="$(brew --prefix libpng)" |
119 | + PREFIX_PATH=";$(brew --prefix gettext)" |
120 | PREFIX_PATH+=";$(brew --prefix jpeg)" |
121 | PREFIX_PATH+=";$(brew --prefix libpng)" |
122 | PREFIX_PATH+=";$(brew --prefix python)" |
123 | PREFIX_PATH+=";$(brew --prefix zlib)" |
124 | PREFIX_PATH+=";/usr/local" |
125 | PREFIX_PATH+=";/usr/local/Homebrew" |
126 | - |
127 | + |
128 | + export PATH="$(brew --prefix gettext)/bin:$PATH" |
129 | export SDL2DIR="$(brew --prefix sdl2)" |
130 | export SDL2IMAGEDIR="$(brew --prefix sdl2_image)" |
131 | export SDL2MIXERDIR="$(brew --prefix sdl2_mixer)" |
132 | export SDL2TTFDIR="$(brew --prefix sdl2_ttf)" |
133 | export BOOST_ROOT="$(brew --prefix boost)" |
134 | - export ICU_ROOT="$(brew --prefix icu4c)" |
135 | + |
136 | + # Not needed for CMake 3.12 or above |
137 | + # see cmake --help-policy CMP0074 |
138 | + #export ICU_ROOT="$(brew --prefix icu4c)" |
139 | |
140 | cmake $SOURCE_DIR -G Ninja \ |
141 | - -DCMAKE_C_COMPILER:FILEPATH="$(brew --prefix ccache)/libexec/gcc-7" \ |
142 | - -DCMAKE_CXX_COMPILER:FILEPATH="$(brew --prefix ccache)/libexec/g++-7" \ |
143 | + -DCMAKE_C_COMPILER:FILEPATH="$C_COMPILER" \ |
144 | + -DCMAKE_CXX_COMPILER:FILEPATH="$CXX_COMPILER" \ |
145 | -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="$OSX_MIN_VERSION" \ |
146 | -DCMAKE_OSX_SYSROOT:PATH="$SDK_DIRECTORY" \ |
147 | -DCMAKE_INSTALL_PREFIX:PATH="$DESTINATION/Widelands.app/Contents/MacOS" \ |
148 | @@ -134,7 +187,8 @@ |
149 | -DCMAKE_BUILD_TYPE:STRING="$TYPE" \ |
150 | -DGLEW_INCLUDE_DIR:PATH="$(brew --prefix glew)/include" \ |
151 | -DGLEW_LIBRARY:PATH="$(brew --prefix glew)/lib/libGLEW.dylib" \ |
152 | - -DCMAKE_PREFIX_PATH:PATH="${PREFIX_PATH}" |
153 | + -DCMAKE_PREFIX_PATH:PATH="${PREFIX_PATH}" \ |
154 | + -DOPTION_ASAN="$USE_ASAN" |
155 | ninja |
156 | |
157 | echo "Done building." |
Code LGTM :)