Skip to content

undefined reference to `_imp__NimMain' #8

@retsyo

Description

@retsyo

I am using msys2+mingw32 on Win7 64 bits. I modified pmgen.py (https://github.com/retsyo/nim-pymod/blob/master/pmgen.py) in 2 aspects

  1. use raw string in nim.cfg and pmgenSRC_incl.nim so that r"r:\someplace" for nim on windows is a valid pathname
  2. judge getvar('LIBS') which can solve the problem in https://github.com/jboy/nim-pymod/issues/5

however, during compiling

Caught OSError([Error 2] )
Traceback (most recent call last):
File "E:/msys64/home/LOVLJIDY/_nim/nim-pymod/pmgen.py", line 538, in
main()
File "E:/msys64/home/LOVLJIDY/_nim/nim-pymod/pmgen.py", line 173, in main
nim_modfiles, pminc_basename, python_exe_name)
File "E:/msys64/home/LOVLJIDY/_nim/nim-pymod/pmgen.py", line 400, in compile_generated_nim_wrappers
subprocess.check_call(make_command)
File "E:\prg\py\Anaconda2_32\lib\subprocess.py", line 541, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-f', 'Makefile']' returned non-zero exit status 2

I traced it down by

$ cd pmgen/
$ make
nim compile pmgenhw_wrap.nim
Hint: used config file 'E:\prg\nim\nim-0.15.2_x32\config\nim.cfg' [Conf]
Hint: used config file 'r:\pmgen\nim.cfg' [Conf]
Hint: used config file 'r:\pmgen\pmgenhw_wrap.nim.cfg' [Conf]
Hint: system [Processing]
...
Hint: gcc.exe -shared -o R:\pmgen\hw.so nimcache\pymod_docstrings.o nimcache\stdlib_macros.o nimcache\pymod_pymod.o nimcache\greeting.o nimcache\pymod_iteratezipdefs.o nimcache\pymod_pyarrayiters.o nimcache\pymod_ptrutils.o nimcache\pymod_pyarrayobjecttype.o nimcache\pymod_pyarrayflags.o nimcache\pymod_pyarrayenums.o nimcache\pymod_pyarraydescrtype.o nimcache\pymod_cnpytypes.o nimcache\pymod_nptypes.o nimcache\pymod_pyarrayobject.o nimcache\pymod_membrain.o nimcache\pymod_pyobject.o nimcache\stdlib_typetraits.o nimcache\pymod_miscutils.o nimcache\stdlib_algorithm.o nimcache\stdlib_math.o nimcache\stdlib_parseutils.o nimcache\stdlib_strutils.o nimcache\stdlib_system.o nimcache\pmgenhw_wrap.o nimcache\pyarraydescrtype_c.o nimcache\pyarrayobject_c.o nimcache\pyobject_c.o nimcache\pmgenhw_capi.o -O3 -lpython27 -fPIC [Exec]
nimcache\pmgenhw_capi.o:pmgenhw_capi.c:(.text+0x41): undefined reference to _imp__exportpy_greet' nimcache\pmgenhw_capi.o:pmgenhw_capi.c:(.text+0x192): undefined reference to _imp__NimMain'
collect2.exe: error: ld returned 1 exit status
Error: execution of an external program failed: 'gcc.exe -shared -o R:\pmgen\hw.so nimcache\pymod_docstrings.o nimcache\stdlib_macros.o nimcache\pymod_pymod.o nimcache\greeting.o nimcache\pymod_iteratezipdefs.o nimcache\pymod_pyarrayiters.o nimcache\pymod_ptrutils.o nimcache\pymod_pyarrayobjecttype.o nimcache\pymod_pyarrayflags.o nimcache\pymod_pyarrayenums.o nimcache\pymod_pyarraydescrtype.o nimcache\pymod_cnpytypes.o nimcache\pymod_nptypes.o nimcache\pymod_pyarrayobject.o nimcache\pymod_membrain.o nimcache\pymod_pyobject.o nimcache\stdlib_typetraits.o nimcache\pymod_miscutils.o nimcache\stdlib_algorithm.o nimcache\stdlib_math.o nimcache\stdlib_parseutils.o nimcache\stdlib_strutils.o nimcache\stdlib_system.o nimcache\pmgenhw_wrap.o nimcache\pyarraydescrtype_c.o nimcache\pyarrayobject_c.o nimcache\pyobject_c.o nimcache\pmgenhw_capi.o -O3 -lpython27 -fPIC '
make: *** [Makefile:9: hw.so] Error 1

``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions