Compatibility with Nim 1.0.0
andreaferretti opened this issue · comments
I am trying to use nimPNG with Nim 1.0.0 but I am having lots of issues while compiling (on MacOS).
Normally, I'd try to debug this myself, but I am at a loss here. Here is the output of tests on my Mac:
# nim c -r tester/test.nim
/Users/andrea/esperimenti/nimPNG/tester/test.nim(103) test
/Users/andrea/esperimenti/nimPNG/tester/test.nim(99) main
/Users/andrea/.mynim/devel/lib/system/assertions.nim(27) failedAssertImpl
/Users/andrea/.mynim/devel/lib/system/assertions.nim(20) raiseAssert
/Users/andrea/.mynim/devel/lib/system/fatal.nim(39) sysFatal
Error: unhandled exception: /Users/andrea/esperimenti/nimPNG/tester/test.nim(99, 9) `not data.isNil` [AssertionError]
# nim c -r tester/testCodec.nim
codec test 1 1
codec test 2 2
codec test 1 1
codec test 7 7
codec test 127 127
codec test 127 127
codec other pattern 1
/Users/andrea/esperimenti/nimPNG/tester/testCodec.nim(1197) testCodec
/Users/andrea/esperimenti/nimPNG/tester/testCodec.nim(1176) doMain
/Users/andrea/esperimenti/nimPNG/tester/testCodec.nim(240) testPNGCodec
/Users/andrea/esperimenti/nimPNG/tester/testCodec.nim(116) testOtherPattern1
/Users/andrea/esperimenti/nimPNG/tester/testCodec.nim(83) doCodecTest
/Users/andrea/esperimenti/nimPNG/tester/testCodec.nim(62) doCodecTest
/Users/andrea/esperimenti/nimPNG/nimPNG.nim(3262) encodePNG
/Users/andrea/esperimenti/nimPNG/nimPNG.nim(3249) encodePNG
/Users/andrea/esperimenti/nimPNG/nimPNG.nim(3168) encoderCore
/Users/andrea/esperimenti/nimPNG/nimPNG.nim(3135) frameConvert
/Users/andrea/esperimenti/nimPNG/nimPNG.nim(2963) preProcessScanLines
/Users/andrea/esperimenti/nimPNG/nimPNG.nim(2903) filter
/Users/andrea/esperimenti/nimPNG/nimPNG.nim(2751) filterMinsum
/Users/andrea/esperimenti/nimPNG/nimPNG.nim(2685) filterScanLine
/Users/andrea/.mynim/devel/lib/system/fatal.nim(48) sysFatal
Error: unhandled exception: value out of range: -2 [RangeError]
# nim c -r tester/testSuite.nim
CC: stdlib_assertions.nim
CC: stdlib_dollars.nim
CC: stdlib_io.nim
CC: stdlib_system.nim
CC: stdlib_streams.nim
CC: stdlib_math.nim
CC: stdlib_strutils.nim
CC: stdlib_pathnorm.nim
CC: stdlib_posix.nim
CC: stdlib_times.nim
CC: stdlib_os.nim
CC: stdlib_tables.nim
CC: ../nimPNG/buffer.nim
CC: ../nimPNG/nimz.nim
CC: ../nimPNG.nim
CC: minibmp.nim
CC: testSuite.nim
Error: execution of an external compiler program 'clang -c -w -I/Users/andrea/.mynim/devel/lib -I/Users/andrea/esperimenti/nimPNG/tester -o /Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c.o /Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c' failed with exit code: 1
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8627:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_500)] = ((NIM_CHAR)chckRange((mode_t)((NU16)((NU16)(p.r) >> (NU64)(((NI) 8))) & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8633:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_502)] = ((NIM_CHAR)chckRange((mode_t)(p.r & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8659:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_505)] = ((NIM_CHAR)chckRange((mode_t)((NU16)((NU16)(p.r) >> (NU64)(((NI) 8))) & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8665:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_507)] = ((NIM_CHAR)chckRange((mode_t)(p.r & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8671:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_509)] = ((NIM_CHAR)chckRange((mode_t)((NU16)((NU16)(p.g) >> (NU64)(((NI) 8))) & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8677:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_511)] = ((NIM_CHAR)chckRange((mode_t)(p.g & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8683:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_513)] = ((NIM_CHAR)chckRange((mode_t)((NU16)((NU16)(p.b) >> (NU64)(((NI) 8))) & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8689:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_515)] = ((NIM_CHAR)chckRange((mode_t)(p.b & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8711:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_518)] = ((NIM_CHAR)chckRange((mode_t)((NU16)((NU16)(p.r) >> (NU64)(((NI) 8))) & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8717:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_520)] = ((NIM_CHAR)chckRange((mode_t)(p.r & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8723:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_522)] = ((NIM_CHAR)chckRange((mode_t)((NU16)((NU16)(p.a) >> (NU64)(((NI) 8))) & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8729:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_524)] = ((NIM_CHAR)chckRange((mode_t)(p.a & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8759:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_527)] = ((NIM_CHAR)chckRange((mode_t)((NU16)((NU16)(p.r) >> (NU64)(((NI) 8))) & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8765:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_529)] = ((NIM_CHAR)chckRange((mode_t)(p.r & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8771:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_531)] = ((NIM_CHAR)chckRange((mode_t)((NU16)((NU16)(p.g) >> (NU64)(((NI) 8))) & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8777:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_533)] = ((NIM_CHAR)chckRange((mode_t)(p.g & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8783:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_535)] = ((NIM_CHAR)chckRange((mode_t)((NU16)((NU16)(p.b) >> (NU64)(((NI) 8))) & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8789:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_537)] = ((NIM_CHAR)chckRange((mode_t)(p.b & ((NI) 255)), 0, 255));
^
/Users/andrea/.cache/nim/testSuite_d/@m..@snimPNG.nim.c:8795:86: error: use of undeclared identifier 'mode_t'
(*output).data->data[(NI)(TM__CaabljTnIulNq49cYzoUYeQ_539)] = ((NIM_CHAR)chckRange((mode_t)((NU16)((NU16)(p.a) >> (NU64)(((NI) 8))) & ((NI) 255)), 0, 255));
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
I already fixes the 1st and the 2nd 'bug' in #34. but the third is probably Nim codegen bug.
module posix_macos_amd64.nim
contains an importc of mode_t
from <sys/types.h>
, but the generated C file not containing any #include <sys/types.h>
.
Great! If you have some more clues, maybe you can open an issue about the codegen on the Nim tracker
fixed
Great, thank you!