nim-pymod icon indicating copy to clipboard operation
nim-pymod copied to clipboard

Broken on Nim 0.17.2

Open wizzardx opened this issue 7 years ago • 4 comments

Hi there.

Following the basic example, I get as far as this point:

python path/to/pmgen.py greeting.nim

However, that gives me a series of warnings, followed by a fatal error.

Here's the whole thing:

python /home/david/.nimble/pkgs/pymod-0.1.0/pmgen.py greeting.nim
Determined Python C-API includes & ldflags using command `python-config`
 - includes = ['-I/usr/include/python2.7', '-I/usr/include/x86_64-linux-gnu/python2.7']
 - ldflags = ['-L/usr/lib/python2.7/config-x86_64-linux-gnu', '-L/usr/lib', '-lpython2.7', '-lpthread', '-ldl', '-lutil', '-lm', '-Xlinker', '-export-dynamic', '-Wl,-O1', '-Wl,-Bsymbolic-functions']
Found Numpy installation at: /usr/lib/python2.7/dist-packages/numpy
Numpy installation paths: ['/usr/lib/python2.7/dist-packages/numpy']
Determined Numpy C-API includes
 - includes = ['-I/usr/lib/python2.7/dist-packages/numpy/core/include']
make -f Makefile.pmgen-greeting pmgen
nim compile  --define:pmgen  --noLinking --noMain pmgengreeting_incl.nim
Hint: used config file '/etc/nim.cfg' [Conf]
Hint: used config file '/tmp/x/y/pmgen/nim.cfg' [Conf]                                                                                                                      
Hint: system [Processing]                                                                                                                                                   
Hint: pmgengreeting_incl [Processing]                                                                                                                                       
Hint: macros [Processing]                                                                                                                                                   
Hint: astutils [Processing]                                                                                                                                                 
Hint: os [Processing]                                                                                                                                                       
Hint: strutils [Processing]                                                                                                                                                 
Hint: parseutils [Processing]                                                                                                                                               
Hint: math [Processing]                                                                                                                                                     
Hint: algorithm [Processing]                                                                                                                                                
Hint: times [Processing]                                                                                                                                                    
Hint: posix [Processing]                                                                                                                                                    
Hint: ospaths [Processing]                                                                                                                                                  
Hint: impls [Processing]                                                                                                                                                    
Hint: hashes [Processing]                                                                                                                                                   
Hint: docstrings [Processing]                                                                                                                                               
Hint: registrytypes [Processing]                                                                                                                                            
Hint: sequtils [Processing]                                                                                                                                                 
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/includes/realmacrodefs.nim(29, 55) Warning: stmt is deprecated [Deprecated]                                           
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/includes/realmacrodefs.nim(38, 20) Warning: expr is deprecated [Deprecated]                                           
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/includes/realmacrodefs.nim(38, 27) Warning: stmt is deprecated [Deprecated]                                           
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/includes/realmacrodefs.nim(48, 26) Warning: expr is deprecated [Deprecated]
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/includes/realmacrodefs.nim(48, 33) Warning: stmt is deprecated [Deprecated]
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/includes/realmacrodefs.nim(51, 29) Warning: expr is deprecated [Deprecated]
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/includes/realmacrodefs.nim(51, 36) Warning: stmt is deprecated [Deprecated]
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/includes/realmacrodefs.nim(58, 57) Warning: expr is deprecated [Deprecated]
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/includes/realmacrodefs.nim(58, 65) Warning: stmt is deprecated [Deprecated]
Hint: pymod [Processing]
Hint: pyobject [Processing]
stack trace: (most recent call last)
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/includes/realmacrodefs.nim(49) exportpy
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/impls.nim(543) exportpyImpl
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/impls.nim(258) verifyProcDef
/tmp/x/y/greeting.nim(9, 39) template/generic instantiation from here
/home/david/.nimble/pkgs/pymod-0.1.0/pymodpkg/private/impls.nim(258, 10) Error: can't exportpy proc `greet` [/tmp/x/y/greeting.nim(9, 0)] because it isn't marked for export from the module.
Hint: Add an asterisk (`*`) after the proc name, as described here:
 http://nim-lang.org/manual.html#export-marker

      error(msg)
           ^
Makefile.pmgen-greeting:7: recipe for target 'pmgen' failed
make: *** [pmgen] Error 1
Traceback (most recent call last):
  File "/home/david/.nimble/pkgs/pymod-0.1.0/pmgen.py", line 525, in <module>
    main()
  File "/home/david/.nimble/pkgs/pymod-0.1.0/pmgen.py", line 161, in main
    pmgen_fnames = generate_pmgen_files(nim_modfiles, pminc_basename)
  File "/home/david/.nimble/pkgs/pymod-0.1.0/pmgen.py", line 334, in generate_pmgen_files
    subprocess.check_call(make_command)
  File "/usr/lib/python2.7/subprocess.py", line 186, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-f', 'Makefile.pmgen-greeting', 'pmgen']' returned non-zero exit status 2

david@david-pc:/tmp/x/y$ nim --version
Nim Compiler Version 0.17.2 (2017-09-08) [Linux: amd64]
Copyright (c) 2006-2017 by Andreas Rumpf

active boot switches: -d:release

greeting.nim is exactly as per the example, greet* (with an export marker) is present.

Please check this sometime?

wizzardx avatar Sep 28 '17 08:09 wizzardx

Yeah, I just stumbled on the same issue.
We are currently discussing it on IRC

apahl avatar Sep 28 '17 09:09 apahl

Fixed in my fork.

apahl avatar Sep 28 '17 09:09 apahl

Thanks, I tested your fork, the example works for me now. Make a pull request to this repo?

wizzardx avatar Sep 28 '17 09:09 wizzardx

Done (https://github.com/jboy/nim-pymod/pull/11) .

apahl avatar Sep 28 '17 10:09 apahl