diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3428948..8daf427 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,26 +54,23 @@ jobs: - name: 'dub build/lint/test' run: | - dub_configuration=application - + echo "::group::Build info:" if [[ -x /usr/bin/xcodebuild ]]; then xcode_version_raw="$(/usr/bin/xcodebuild -version)" xcode_version="$(echo "$xcode_version_raw" | awk '/Xcode/ { print int($2) }')" if [[ $xcode_version -eq 15 ]]; then - dub_configuration="application-xcode$xcode_version" - else - dub_configuration="application-xcode-older" + # https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Known-Issues + export DFLAGS="-L-ld_classic" fi + echo "::notice title=${{ matrix.os }} Xcode version::$xcode_version_raw" fi - - echo "::group::Build info:" - echo "::notice::$xcode_version_raw" - echo "::notice::$($DC --version)($DC)" + compiler_version="$($DC --version)" + echo "::notice title=${{ matrix.os }}/${{ matrix.dc }} compiler::$compiler_version" echo "::endgroup::" - dub build --compiler=$DC --build=release-debug --config=$dub_configuration # --verbose - dub lint --compiler=$DC --config=$dub_configuration # --verbose - dub test --compiler=$DC --config=$dub_configuration --coverage # --verbose + dub build --compiler=$DC --build=release-debug # --verbose + dub lint --compiler=$DC # --verbose + dub test --compiler=$DC --coverage # --verbose - name: 'Upload binary' uses: actions/upload-artifact@v4 diff --git a/.gitignore b/.gitignore index 71574e3..164f506 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,15 @@ .dub /dub.settings.json + +# per-directory dmd configuration: /dmd.conf + +# documentation files: docs.json __dummy.html docs/ -/myrc -myrc.so -myrc.dylib -myrc.dll -myrc.a -myrc.lib -myrc-test-* -*.exe -*.pdb -*.o -*.obj + +# generated binaries: +/myrc* +# code coverage files: *.lst diff --git a/README.md b/README.md index 538ca77..8e792f1 100644 --- a/README.md +++ b/README.md @@ -1,29 +1 @@ -### MacOS Build issues - -issue: -``` -ld: warning: pointer not aligned at address 0x10016509F ('anon' + 146 from ../../../.dub/cache/sdlite/1.2.0/build/library-debug-Euv1mnZz1Zk-3iGZsMSgFQ/libsdlite.a(parser_419_6ff.o)) -ld: warning: pointer not aligned at address 0x1001650E5 ('anon' + 216 from ../../../.dub/cache/sdlite/1.2.0/build/library-debug-Euv1mnZz1Zk-3iGZsMSgFQ/libsdlite.a(parser_419_6ff.o)) -ld: unaligned pointer(s) for architecture x86_64 -``` -fix: -in dub.settings.json: -```json -{ - "defaultBuildEnvironments": { - "MACOSX_DEPLOYMENT_TARGET": "11" - } -} -``` - -issue: -dub lint doesnt work (fails on running scanner) -open dscanner (dub list dscanner) dub.json and add -```json -"lflags-osx": ["-ld_classic"], -``` -and modify: -```diff -- "\"$DC\" -run \"$PACKAGE_DIR/dubhash.d\"" -+ "\"$DC\" -L-ld_classic -run \"$PACKAGE_DIR/dubhash.d\"" -``` +## myrc diff --git a/build_issues.md b/build_issues.md new file mode 100644 index 0000000..38a9fda --- /dev/null +++ b/build_issues.md @@ -0,0 +1,54 @@ +## MacOS build issues + +#### unaligned pointer(s) + +issue: + +linking errors like this: + +``` +ld: warning: pointer not aligned at address 0x10016509F ('anon' + 146 from ../../../.dub/cache/sdlite/1.2.0/build/library-debug-Euv1mnZz1Zk-3iGZsMSgFQ/libsdlite.a(parser_419_6ff.o)) +ld: warning: pointer not aligned at address 0x1001650E5 ('anon' + 216 from ../../../.dub/cache/sdlite/1.2.0/build/library-debug-Euv1mnZz1Zk-3iGZsMSgFQ/libsdlite.a(parser_419_6ff.o)) +ld: unaligned pointer(s) for architecture x86_64 +``` + +fix: + +set `MACOSX_DEPLOYMENT_TARGET` environment variable to `11` (or `12`): +```bash +env MACOSX_DEPLOYMENT_TARGET=11 dub +``` + +#### symbol count from symbol table and dynamic symbol table differ + +issue: + +linking, when XCode version is +[15](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Known-Issues), errors like this: + +``` +ld: multiple errors: symbol count from symbol table and dynamic symbol table differ in '/Users/kucaahbe/.dub/cache/myrc/0.2.1/build/application-debug-adg7nRO7nk0vUCCcUFqMMw/myrc.o' in '/Users/kucaahbe/.dub/cache/myrc/0.2.1/build/application-debug-adg7nRO7nk0vUCCcUFqMMw/myrc.o'; address=0x0 points to section(2) with no content in '/Library/D/dmd/lib/libphobos2.a[3233](config_a98_4c3.o)' +clang: error: linker command failed with exit code 1 (use -v to see invocation) +``` + +fix: + +add `-L-ld_classic` to dmd flags, either: + +```bash +env DFLAGS="-L-ld_classic" dub +``` + +or issue could be solved globally for dmd, by copying [`dmd.conf`](https://dlang.org/dmd-osx.html#dmd-conf) file to +any [allowed location](https://dlang.org/dmd-osx.html#dmd-conf) and appending `-L-ld_classic` there: + +```ini +; ~/.dmd.conf +[Environment] + +; on OSX (when dmd isntalled from .dmg) the original config file is located at +; /Library/D/dmd/bin/dmd.conf and its content should be used as base. +; Original content: +;DFLAGS=-I/Library/D/dmd/src/phobos -I/Library/D/dmd/src/druntime/import -L-L/Library/D/dmd/lib +DFLAGS=-I/Library/D/dmd/src/phobos -I/Library/D/dmd/src/druntime/import -L-L/Library/D/dmd/lib -L-ld_classic +``` diff --git a/dub.sdl b/dub.sdl index a1a931a..af7032c 100644 --- a/dub.sdl +++ b/dub.sdl @@ -11,18 +11,5 @@ mainSourceFile "source/main.d" dependency "sdlite" version="~>1.2.0" configuration "application" { - platforms "linux" targetType "executable" } - -configuration "application-xcode15" { - platforms "osx-x86_64" - targetType "executable" - lflags "-ld_classic" -} - -configuration "application-xcode-older" { - platforms "osx-x86_64" - targetType "executable" - # lflags "-ld_classic" -}