arnetheduck / nlvm

LLVM-based compiler for the Nim language
Other
712 stars 42 forks source link

Errors out on compiling #23

Closed napalu closed 4 years ago

napalu commented 4 years ago
nlvm compiler for Nim, version 0.0.1 [Linux: amd64]

Copyright (c) 2015-2019 Jacek Sieka
Nim compiler (c) 2009-2019 Andreas Rumpf

nlvm: 0.0.1 (d37a7adcce653f53f773bb1ece4e0b21639dba3b)
Nim: 1.2.0 (b916fe647e59c512c94c6ad019995bd396f24d04)
llvm: 10.0.0

Trying to compile some code it seems nlvm does not understand the following constructs found in nlvm_system.nim

 let p =
    case encoding and 0x0F
    of DW_EH_PE_absptr:  v.readBytes(uint)
    of DW_EH_PE_uleb128: cast[uint](v.readUleb128())
    of DW_EH_PE_udata2: cast[uint](v.readBytes(uint16))
    of DW_EH_PE_udata4: cast[uint](v.readBytes(uint32))
    of DW_EH_PE_udata8: cast[uint](v.readBytes(uint64))
    of DW_EH_PE_sleb128: cast[uint](v.readSleb128())
    of DW_EH_PE_sdata2: cast[uint](v.readBytes(int16))
    of DW_EH_PE_sdata4: cast[uint](v.readBytes(int32))
    of DW_EH_PE_sdata8: cast[uint](v.readBytes(int64))
    else: c_abort()

complaining that nlvm_system.nim(158, 26) Error: expression 'readBytes(v, uint)' is of type 'uint' and has to be discarded

arnetheduck commented 4 years ago

sounds like it's not picking up the nlvm branch of Nim/lib which contains a fix to c_abort (it's incorrectly declared in upstream).

hm, can you check the paths with nlvm dump?

napalu commented 4 years ago

nvlm dump returns:

╰─>$ /data/Projects/nlvm/nlvm/nlvm dump
Hint: used config file '/data/Projects/nlvm/Nim/config/nim.cfg' [Conf]
Hint: used config file '/data/Projects/nlvm/Nim/config/config.nims' [Conf]
-- list of currently defined symbols --
nimHasWarningCaseTransition
nimHasCursor
nimHasWarningIndexCheck
nimHasWarningProveIndex
nimHasimplicitDeref
nimHasWarningResultShadowed
nimHasdynamicBindSym
nimHascaseStmtMacros
nimHasHintLink
nimHasInvariant
nimHasHintGCStats
nimlocks
nimHasnotnil
nimNewDot
nimHascompiletimeFFI
nimHasWarningGcUnsafe2
nimHasWarningUnusedImport
nimunion
nimHasWarningLockLevel
nimHasWarningInheritFromException
nimHasHintExpandMacro
nimHashOrdinalFixed
nimNewIntegerOps
nimHasWarningFieldXNotSupported
noIntrinsicsBitOpts
nimHasHintPattern
nimHasHotCodeReloading
nimHasWarningXIsNeverRead
nimHasWarningUnknownMagic
nimHasparallel
nimHasWarningProveField
nimHasdestructor
nimHasHintSuccessX
nimHasHintQuitCalled
nimHasHintSuccess
nimDistros
nimNotNil
nimHasWarningXmightNotBeenInit
nimNewRuntime
nimHasHintUser
nimHasWarningDeprecated
nimNoArrayToCstringConversion
nimnode
nimHasWarningCannotOpenFile
nimHasHintStackTrace
nimNoNilSeqs2
nimHasUserErrors
nimeffects
nimHasWarningWriteToForeignHeap
nimIncrSeqV3
nimNoNil
nimHasWarningProveInit
nimNoZeroExtendMagic
nimHasNilSeqs
nimHasWarningTypelessParam
nimcomputedgoto
nimFixedOwned
nimHasWarningUseBase
nimHasNilChecks
nimNewTypedesc
nimHasWarningOctalEscape
nimHasWarningGcMem
nimHasHintCondTrue
nimHasWarningUnsafeCode
nimHasHintGlobalVar
nimHasWarningSmallLshouldNotBeUsed
nimHasExceptionsQuery
gcc
nimHasHintCodeBegin
nimToOpenArrayCString
niminheritable
nimHasWarningConfigDeprecated
nimHasWarningCommentXIgnored
nimHasCppDefine
nimHasWarningUnsafeSetLen
nimHasHintName
nimNoNilSeqs
nimbabel
nimHasHintExec
nimHasTypeof
nimalias
nimAshr
nimHasWarningDestructor
nimKnowsNimvm
nimtypedescfixed
nimSymKind
nimHasWarningEachIdentIsTuple
nimHasHintCondFalse
nimErrorProcCanHaveBody
nimmixin
nimGenericInOutFlags
nimHascallOperator
nimHasWarningCycleCreated
nimHasHintUserRaw
nimVmEqIdent
nimHasWarningUninit
nimNewShiftOps
nimHasIsNamedTuple
nlvm
nimNewRoof
nimNoZeroTerminator
nimHasDefault
nimHasWarningGcUnsafe
nimHasInstantiationOfInMacro
nimHasHintCodeEnd
nimHasWarningLanguageXNotSupported
nimMacrosSizealignof
nimHasWarningUnknownSubstitutionX
nimHasHintProcessing
nimHasHintDependency
nimHasUsed
nimHasStacktraceMsgs
nimHasalignOf
nimHasHintSource
nimHasHintCC
nimnomagic64
nimHascodeReordering
nimHasHintXDeclaredButNotUsed
nimrequiresnimframe
nimUncheckedArrayTyp
nimHasHintExtendedContext
nimHasHintLineTooLong
nimHasHintPerformance
nimHasStyleChecks
nimHasSignatureHashInMacro
nimVmExportFixed
nimMacrosGetNodeId
nimHasHintConvFromXtoItselfNotNeeded
nimHasWarningUnsafeDefault
nimHasforLoopMacros
nimHasRunnableExamples
nimHasWarningRedefinitionOfLabel
nimHasHintConvToBaseNotNeeded
nimHasWarningUser
nimvarargstyped
nimnewshared
nimparsebiggestfloatmagic
nimHasWarningSpacing
nimhygiene
nimHasHintConf
nimHasdotOperators
nimHasHintPath
nimHasHintExprAlwaysX
nimHasSymOwnerInMacro
nimArrIdx
nimFixedForwardGeneric
nimHasSinkInference
-- end of list --
/data/Projects/nlvm/Nim/lib/pure
/data/Projects/nlvm/Nim/lib/core
/data/Projects/nlvm/Nim/lib/arch
/data/Projects/nlvm/Nim/lib/pure/unidecode
/data/Projects/nlvm/Nim/lib/js
/data/Projects/nlvm/Nim/lib/posix
/data/Projects/nlvm/Nim/lib/windows
/data/Projects/nlvm/Nim/lib/wrappers/linenoise
/data/Projects/nlvm/Nim/lib/wrappers
/data/Projects/nlvm/Nim/lib/impure
/data/Projects/nlvm/Nim/lib/pure/concurrency
/data/Projects/nlvm/Nim/lib/pure/collections
/data/Projects/nlvm/Nim/lib/deprecated/pure
/data/Projects/nlvm/Nim/lib/deprecated/core
/data/Projects/nlvm/nlvm-lib
/data/Projects/nlvm/Nim/lib
/data/Projects/nlvm/Nim/lib
arnetheduck commented 4 years ago

hm - ok, looks about correct - can you also do nlvm --verbosity:3 c yourfile.nim and paste the hints about paths?

napalu commented 4 years ago

Thanks for the quick feedback - I just found out that it compiles fine if I omit --gc:arc in the compile arguments. Sorry - should have included the compile flags :( Is --gc:arc not supported yet?

arnetheduck commented 4 years ago

lol, not even upstream works with gc:arc, beyond toy examples :)

https://github.com/arnetheduck/nlvm/blob/master/skipped-tests.txt will show the missing pieces the best - progress on arc would definitely be interesting to see.

napalu commented 4 years ago

Ah okies - thanks for the prompt feedback :) I'll play around with nlvm now