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

Build PonyC using CMake #3234

Merged
merged 9 commits into from
Mar 26, 2020
Merged

Build PonyC using CMake #3234

merged 9 commits into from
Mar 26, 2020

Conversation

chalcolith
Copy link
Member

@chalcolith chalcolith commented Jul 22, 2019

PonyC now builds on all platforms using CMake.

The PR includes a helper wrapper (a Makefile on Unix, and a PowerShell script on Windows) that sets up CMake build directories for you and compiles PonyC to the build/release (or build/debug) directory as before, so scripts that depend on this behaviour don't need to change.

Building happens in two steps: you will be able to run make libs, which will build the vendored LLVM and other libraries like Google Test and Google Benchmark. You should only need to do this once unless the vendored LLVM submodule changes.

Then you can run make build and make test as before.

Fixes #3204

@chalcolith chalcolith added the do not merge This PR should not be merged at this time label Jul 22, 2019
@chalcolith
Copy link
Member Author

This is working on Windows. On Ubuntu 8.04 something's not getting linked correctly. All the tests that use JIT are failing. Debugging into the LLVM code it's unable to resolve symbols like pony_exitcode that come from libponyrt at runtime. I'm linking libponyrt with --whole-archive, but it's currently not working.

@winksaville
Copy link
Contributor

I wasn't able to reproduce the problem on my Arch Linux system.
I've run BadPontTest.TupleToUnionGentrace and it worked:

wink@wink-desktop:~/prgs/ponylang/ponyc (winks-changes1)
$ build/release/libponyc.tests --gtest_filter=BadPonyTest.TupleToUnionGentrace
Note: Google Test filter = BadPonyTest.TupleToUnionGentrace
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from BadPonyTest
[ RUN      ] BadPonyTest.TupleToUnionGentrace
[       OK ] BadPonyTest.TupleToUnionGentrace (13 ms)
[----------] 1 test from BadPonyTest (13 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (17 ms total)
[  PASSED  ] 1 test.

I made some changes to Makefile and CMakeLists.txt, I don't think that's why its working, but ya never know:

wink@wink-desktop:~/prgs/ponylang/ponyc (winks-changes1)
$ git diff HEAD~2
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fdc4ad23..05a9548f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,8 +19,8 @@ set(CMAKE_VERBOSE_MAKEFILE ON)
 
 # We require LLVM, Google Test and Google Benchmark
 find_package(LLVM REQUIRED CONFIG PATHS "build/libs/lib/cmake/llvm" NO_DEFAULT_PATH)
-find_package(GTest REQUIRED CONFIG PATHS "build/libs/lib/cmake/GTest" NO_DEFAULT_PATH)
-find_package(benchmark REQUIRED CONFIG PATHS "build/libs/lib/cmake/benchmark" NO_DEFAULT_PATH)
+find_package(GTest REQUIRED CONFIG PATHS "build/libs/lib64/cmake/GTest" NO_DEFAULT_PATH)
+find_package(benchmark REQUIRED CONFIG PATHS "build/libs/lib64/cmake/benchmark" NO_DEFAULT_PATH)
 
 # LibPonyC tests assume that our outputs are two directories above the root directory.
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/../debug)
diff --git a/Makefile b/Makefile
index 5c217d58..a3567a30 100644
--- a/Makefile
+++ b/Makefile
@@ -16,8 +16,8 @@ all: configure build
 
 libs:
        mkdir -p $(libsBuildDir)
-       cd $(libsBuildDir) && cmake -B $(libsBuildDir) -S $(libsSrcDir) -DCMAKE_INSTALL_PREFIX="$(libsOutDir)" -DCMAKE_BUILD_TYPE=Release
-       cd $(libsBuildDir) && cmake --build $(libsBuildDir) --target install --config Release
+       cd $(libsBuildDir) && cmake -B $(libsBuildDir) -S $(libsSrcDir)  -DCMAKE_VERBOSE_MAKEFILE=true -DCMAKE_INSTALL_PREFIX="$(libsOutDir)" -DCMAKE_BUILD_TYPE=Release
+       cd $(libsBuildDir) && cmake --build $(libsBuildDir) --target install --config Release --verbose --parallel 10
 
 cleanlibs:
        rm -rf $(libsBuildDir)
@@ -25,10 +25,10 @@ cleanlibs:
 
 configure:
        mkdir -p $(buildDir)
-       cd $(buildDir) && cmake -B $(buildDir) -S $(srcDir) -DCMAKE_BUILD_TYPE=$(config) -DCMAKE_C_FLAGS="-march=$(arch)" -DCMAKE_CXX_FLAGS="-march=$(arch)" -DPONYC_VERSION=$(version)
+       cd $(buildDir) && cmake -B $(buildDir) -S $(srcDir) -DCMAKE_VERBOSE_MAKEFILE=true -DCMAKE_BUILD_TYPE=$(config) -DCMAKE_C_FLAGS="-march=$(arch)" -DCMAKE_CXX_FLAGS="-march=$(arch)" -DPONYC_VERSION=$(version)
 
 build:
-       cd $(buildDir) && cmake --build $(buildDir) --config $(config) --target all
+       cd $(buildDir) && cmake --build $(buildDir) --config $(config) --target all --verbose --parallel 10
 
 test:
        cd $(outDir) && ./libponyrt.tests

Anyway, what I'd like to see is the output of ldd on your system. Here is mine for ponyc and libpoyc.tests in build/release/:

wink@wink-desktop:~/prgs/ponylang/ponyc (winks-changes1)
$ ldd build/release/ponyc 
	linux-vdso.so.1 (0x00007ffcf6f4a000)
	libLTO.so.7 => /home/wink/prgs/ponylang/ponyc/src/ponyc/../../build/libs/lib/libLTO.so.7 (0x00007f3b232b4000)
	libatomic.so.1 => /usr/lib/libatomic.so.1 (0x00007f3b23270000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f3b2326b000)
	libedit.so.0 => /usr/lib/libedit.so.0 (0x00007f3b23231000)
	libz.so.1 => /usr/lib/libz.so.1 (0x00007f3b2301a000)
	librt.so.1 => /usr/lib/librt.so.1 (0x00007f3b2300f000)
	libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x00007f3b22f9e000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f3b22f7d000)
	libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f3b22e15000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f3b22c2d000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f3b22ae7000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f3b22acd000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f3b22908000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f3b2a072000)
	libicuuc.so.64 => /usr/lib/libicuuc.so.64 (0x00007f3b22730000)
	liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f3b2250a000)
	libicudata.so.64 => /usr/lib/libicudata.so.64 (0x00007f3b20ac6000)
wink@wink-desktop:~/prgs/ponylang/ponyc (winks-changes1)
$ ldd build/release/libponyc.tests 
	linux-vdso.so.1 (0x00007ffc6f1e5000)
	libLTO.so.7 => /home/wink/prgs/ponylang/ponyc/test/libponyc/../../build/libs/lib/libLTO.so.7 (0x00007f02c555a000)
	libatomic.so.1 => /usr/lib/libatomic.so.1 (0x00007f02c5516000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f02c5511000)
	libedit.so.0 => /usr/lib/libedit.so.0 (0x00007f02c54d7000)
	libz.so.1 => /usr/lib/libz.so.1 (0x00007f02c52c0000)
	librt.so.1 => /usr/lib/librt.so.1 (0x00007f02c52b5000)
	libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x00007f02c5244000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f02c5223000)
	libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f02c50bb000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f02c4ed3000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f02c4d8d000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f02c4d73000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f02c4bae000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f02cc763000)
	libicuuc.so.64 => /usr/lib/libicuuc.so.64 (0x00007f02c49d6000)
	liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f02c47b0000)
	libicudata.so.64 => /usr/lib/libicudata.so.64 (0x00007f02c2d6c000)

@chalcolith
Copy link
Member Author

Current status: builds on Linux (glibc & musl), FreeBSD, MacOS and Windows.

There is an intermittent assertion in the hash resize() function (hash.c:111) in libponyrt on Windows that I'm still trying to track down.

@chalcolith
Copy link
Member Author

Latest status: we see the following assertion when compiling the standard library tests (command line is -d --checktree --verify -b stdlib-debug -o C:\Users\Gordon\Dev\Pony\ponyc_cmake\build\debug C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\stdlib):

We see it intermittently because the order of compiling things seems to be non-deterministic. @dipinhora Sean said you might have some insight into this as you have done work on hashing in libponyrt. Any ideas?

Building builtin -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\builtin
Building C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\stdlib -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\stdlib
Building ponytest -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\ponytest
Building time -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\time
Building collections -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\collections
Building random -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\random
Building assert -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\assert
Building backpressure -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\backpressure
Building encode/base64 -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\encode\base64
Building buffered -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\buffered
Building builtin_test -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\builtin_test
Building bureaucracy -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\bureaucracy
Building promises -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\promises
Building capsicum -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\capsicum
Building files -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\files
Building term -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\term
Building strings -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\strings
Building signals -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\signals
Building cli -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\cli
Building collections/persistent -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\collections\persistent
Building debug -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\debug
Building format -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\format
Building ini -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\ini
Building itertools -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\itertools
Building json -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\json
Building logger -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\logger
Building math -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\math
Building net -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\net
Building options -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\options
Building ponybench -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\ponybench
Building process -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\process
Building serialise -> C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\serialise
C:\Users\Gordon\Dev\Pony\ponyc_cmake\src\libponyrt\ds\hash.c:111: resize: Assertion `map->count == c` failed.

Backtrace:
  (ponyint_assert_fail) [00007FF75E2B812F]
  (resize) [00007FF75E2BC604]
  (ponyint_hashmap_putindex) [00007FF75E2BB57B]
  (consume_funs_putindex) [00007FF75E1A30BF]
  (verify_fun_field_not_referenced) [00007FF75E1A3C5C]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A3CB2]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_fun_field_not_referenced) [00007FF75E1A3CB2]
  (verify_fun_field_not_referenced) [00007FF75E1A4076]
  (verify_consume_field_not_referenced) [00007FF75E1A428A]
  (verify_consume_field_not_referenced) [00007FF75E1A433F]
  (verify_consume_field_not_referenced) [00007FF75E1A433F]
  (verify_consume_field_not_referenced) [00007FF75E1A433F]
  (verify_consume_field_not_referenced) [00007FF75E1A433F]
  (verify_reassign_consumed) [00007FF75E1A4418]
  (verify_assign) [00007FF75E1A4562]
  (pass_verify) [00007FF75E1A2913]
  (ast_visit) [00007FF75E16613A]
  (ast_visit) [00007FF75E166076]
  (ast_visit) [00007FF75E166076]
  (ast_visit) [00007FF75E166076]
  (ast_visit) [00007FF75E166076]
  (ast_visit) [00007FF75E166076]
  (ast_visit) [00007FF75E166076]
  (ast_visit) [00007FF75E166076]
  (ast_visit) [00007FF75E166076]
  (ast_visit) [00007FF75E166076]
  (ast_visit) [00007FF75E166076]
  (ast_visit) [00007FF75E166076]
  (visit_pass) [00007FF75E1664C4]
  (ast_passes) [00007FF75E16699B]
  (ast_passes_program) [00007FF75E165BA8]
  (program_load) [00007FF75E167E0F]
  (compile_package) [00007FF75E15902C]
  (main) [00007FF75E1592D5]
  (__scrt_common_main_seh) [00007FF75FD46F9C]
  (BaseThreadInitThunk) [00007FFEE3437BD4]
  (RtlUserThreadStart) [00007FFEE3C8CED1]

@dipinhora
Copy link
Contributor

@kulibali the stack trace itself doesn't shed much light on what's going on. the values of c, s, map->count, and map->size might be insightful though.

i can probably take a look in 2 or 3 weeks (assuming it's not resolved by then). any chance you can point me to a windows dev/debugging for dipin's guide? i was planning on using lldb in a loop like i've done previously in linux to reproduce rare issues but lldb for windows isn't exactly feature complete as of right now.

@chalcolith
Copy link
Member Author

When the assertion happens,

s is 64
c is 33
map->size is 512
map->count is 26

The problem happens (when it happens) on the 733rd call to resize(), and it stars to show up on the fourth hash element that is copied -- it hits a duplicate bucket, so map->count is not incremented.

It would probably be better to use the Windows debugger rather than LLDB. The easiest way would probably be via Visual Studio. Once you do .\make.ps1 configure, you can open build\build\PonyC.sln in Visual Studio 2019. Choose Debug from the Solution Configurations dropdown. Right-click on the ponyc project in the Solution Explorer, and choose "Set as StartUp Project". Rick-click again, and choose Properties. Under Debugging, enter -d --checktree --verify -b stdlib-debug -o C:\Users\Gordon\Dev\Pony\ponyc_cmake\build\debug C:\Users\Gordon\Dev\Pony\ponyc_cmake\packages\stdlib (with your paths) in the Command Arguments box, and change the "Working Directory" box to $(TargetDir). Then click on "Local Windows Debugger" to run ponyc in debug mode. It will break on the assertion if it happens.

@dipinhora
Copy link
Contributor

@kulibali thanks for the quick how-to for windows debugging.

it hits a duplicate bucket, so map->count is not incremented

the above should not be possible because the same comparison function (cmp) us used in search both before and after resize and shift_put only skips incrementing map->count if search found an exact match via cmp as part of ponyint_hashmap_put.

code snippet from search (all other code paths return NULL instead of elem):

if(cmp(key, elem)) {
// element found
*pos = index;
*probe_length = p_length;
return elem;
}

code snippet from ponyint_hashmap_put (gets elem from search and passes it to shift_put):

void* elem = search(map, &pos, entry, hash, cmp, &probe_length,
&oi_probe_length);
shift_put(map, entry, hash, cmp, pos, probe_length, oi_probe_length, elem);

code snippet from shift_put:

// we put a new item in an empty bucket
if(elem == NULL)
{
map->count++;

@chalcolith
Copy link
Member Author

I believe I have found the problem (#3422). I'll clean some things up and rebase.

@chalcolith
Copy link
Member Author

chalcolith commented Dec 23, 2019

To do:

  • Rebase on master
  • Update LLVM to 9.0.1
  • Implement patching
  • Fix broken (again) Windows build
  • Implement cross-compilation
  • Implement "make install" on Unix
  • Make sure CI is all using CMake
  • Update README
  • Check TryBlockCantCatchCppExcept on Windows

@chalcolith chalcolith force-pushed the cmake branch 2 times, most recently from 76aba02 to 6172657 Compare February 18, 2020 00:12
@chalcolith chalcolith marked this pull request as ready for review February 18, 2020 00:33
@@ -39,8 +39,8 @@ ASSET_DESCRIPTION="https://github.com/ponylang/ponyc"

# Build pony installation
echo "Building ponyc installation..."
make install prefix=${BUILD_PREFIX} default_pic=${PIC} arch=${ARCH} \
-j${MAKE_PARALLELISM} -f Makefile-lib-llvm symlink=no
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

symlink=no isn't needed anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the Makefile set symlink=no if DESTDIR is specified. That seemed like what the logic in the original makefile was doing. I.e. if prefix is specified it'll be something like /usr/local or ~/.local and it's better install to $prefix/lib/pony/$version and symlink, but if DESTDIR is specified then you just want it there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha.

@@ -41,9 +41,8 @@ ASSET_DESCRIPTION="https://github.com/ponylang/ponyc"

# Build pony installation
echo "Building ponyc installation..."
make install prefix=${BUILD_PREFIX} default_pic=${PIC} arch=${ARCH}\
link=static -j${MAKE_PARALLELISM} -f Makefile-lib-llvm symlink=no \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link=static is now the default, yes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just checking. thanks.

@@ -1,104 +1,23 @@
version: 2.1
# Turn off CircleCI integration and delete this file once CMake builds are working.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE!

@@ -6,7 +6,7 @@ task:
only_if: $CIRRUS_API_CREATED == "true"

container:
image: ponylang/ponyc-ci-x86-64-unknown-linux-gnu-builder:20191105
image: ponylang/ponyc-ci-x86-64-unknown-linux-gnu-builder:20191106
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that date correct? i'm surprised for this PR that the image is that old.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been working on this for far too long.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm sorry. that sounds like a pained message from your end.

Comment on lines +93 to +102
config_script:
- ps: .\make.ps1 -Command configure -Config Release -Generator "Visual Studio 16 2019" -Prefix "build\install\release" -Version nightly
build_script:
- ps: .\make.ps1 -Command build -Config Release -Generator "Visual Studio 16 2019" -Prefix "build\install\release" -Version nightly
install_script:
- ps: .\make.ps1 -Command install -Config Release -Prefix "build\install\release"
package_script:
- ps: .\make.ps1 -Command package -Config Release -Prefix "build\install\release" -Version nightly
upload_script:
- ps: $version = (Get-Date).ToString("yyyyMMdd"); cloudsmith push raw --version $version --api-key ${CLOUDSMITH_API_KEY} --summary "Pony compiler" --description "https://github.com/ponylang/ponyc" ponylang/nightlies build\ponyc-x86_64-pc-windows-msvc-nightly-$version-Release.zip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we roll all of this up into one script that is in .ci-scripts ala macOS and Linux scripts? Or is that not something that is desirable with windows?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we could, although it's in some ways harder to check for process error codes inside a PS script. Perhaps we could make a new issue to do this later?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, new issue sounds good. definitely not a show stopper.

.cirrus.yml Outdated
cpu: 8
memory: 24

name: "nightly: x86-64-pc-windows-msvc"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this name is incorrect. for a tag, that isn't a nightly. it should be release: not nightly:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, will fix.

install_script:
- ps: .\make.ps1 -Command install -Config Release -Prefix "build\install\release"
package_script:
- ps: .\make.ps1 -Command package -Config Release -Prefix "build\install\release" -Version nightly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this not setting the version to nightly and some date? it appears to just be the same "nightly" for every version, am I wrong?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a hack -- the make.ps1 script will fill in the date if it is given nightly. Trying to do one-liners in PowerShell is much more verbose than in Bash.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha.

Comment on lines 211 to +229
only_if: $CIRRUS_PR != ''

container:
image: ponylang/ponyc-ci-x86-64-unknown-linux-gnu-builder:20191105
image: ponylang/ponyc-ci-x86-64-unknown-linux-gnu-builder:20191106
cpu: 8
memory: 24

name: "PR: x86-64-unknown-linux-gnu"

libs_cache:
folder: build/libs
fingerprint_script: echo "`md5sum lib/CMakeLists.txt` glibc"
populate_script: make libs build_flags=-j8

configure_script:
- make configure
build_script:
- make build build_flags=-j8
test_script:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a duplicate of the task that starts on 232.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O i c. we don't do debug and non-debug anymore. You can kill the debug ones.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I just re-added the debug builds because the debug build was broken and I thought it would be useful to check it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what was broken about it? it definitely adds a lot more time to PRs but perhaps with caching it won't?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We recently added a bunch of bare inline functions to a header in libponyrt. I learned something new yesterday: for unoptimized builds C99 evidently requires these functions to be declared in a .c file somewhere. So the build worked for release (where the functions were being inlined because optimization) but not in debug.
ca1e2cb#diff-894a332d21d5ee3397dc394ab3dae5cc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be worth leaving them in to catch things like that. Perhaps we can turn off the test step and just compile them.

.cirrus.yml Outdated
test_stdlib_cross_script:
- make test-cross-ci PONYPATH=../armv7-a/release cross_triple=arm-unknown-linux-gnueabihf cross_arch=armv7-a cross_cpu=cortex-a9 cross_linker=arm-linux-gnueabihf-gcc cross_runner="qemu-arm-static -cpu cortex-a9 -L /usr/local/arm-linux-gnueabihf/libc"

# AArch64 has been broken for some time
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we should just delete all the commented out stuff, sound reasonable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Perhaps we should add an issue to take another look at AArch64?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like an excellent idea. open that issue!

@SeanTAllen
Copy link
Member

@kulibali i left a few comments. did you intend to delete the glibbenchmark files that you did?

@chalcolith
Copy link
Member Author

Thanks Sean, I deleted the gtest and gbenchmark code; make libs downloads them from GitHub. The idea is that if we need a newer version of them we just need to change the URL in libs/CMakeLists.txt; my personal preference is to avoid storing thirdparty code in the main repo.

@chalcolith
Copy link
Member Author

@kulibali i wasn't aware that a command such as:

https://github.com/ponylang/ponyc/blob/master/.ci-scripts/x86-64-unknown-linux-gnu-nightly.bash#L44

would cause those others to run.

Oops, I'll fix those scripts.

@SeanTAllen
Copy link
Member

Would a single debug build on any platform be good enough? I'm in favor of that especially if all the LLVM build time is handled via cache.

@chalcolith
Copy link
Member Author

Would a single debug build on any platform be good enough? I'm in favor of that especially if all the LLVM build time is handled via cache.

Sure, sounds good.

@chalcolith
Copy link
Member Author

There are several issues about AArch64 already: #2689, #2875, #2925.

- Only have 1 debug PR CI job for debug mode.
- Fix nightly and release scripts
- Set `LLVM_ENABLE_OCAMLDOC=OFF` for LLVM build.
- Fix indentation in `.gitmodules`

Unrelated:
- Quote arguments with spaces on Windows when starting processes.
@@ -170,7 +170,17 @@ class _ProcessWindows is _Process
fun tag _make_cmdline(args: Array[String] val): String =>
var cmdline: String = ""
for arg in args.values() do
cmdline = cmdline + arg + " "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the changes to process should be in a separate commit, if it should be included in this PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll make a separate PR.

.cirrus.yml Outdated
@@ -152,12 +285,21 @@ task:

install_script:
- echo "FETCH_RETRY = 6" >> /usr/local/etc/pkg.conf
- evho "IGNORE_OSVERSION = yes" >> /usr/local/etc/pkg.conf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should say echo?

Copy link
Contributor

@Theodus Theodus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@Theodus Theodus merged commit eda7b66 into master Mar 26, 2020
@Theodus Theodus deleted the cmake branch March 26, 2020 18:15
github-actions bot pushed a commit that referenced this pull request Mar 26, 2020
@chalcolith chalcolith mentioned this pull request May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - changed Automatically add "Changed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate building PonyC with CMake
7 participants