heysokam / confy

Comfortable and Configurable buildsystem for C, C++ and Nim
MIT License
13 stars 0 forks source link

[nim] error with `import confy`. Likely because caused by `confy/nimble` #4

Closed griffith1deady closed 10 months ago

griffith1deady commented 11 months ago

i have that code in my src/build.nim

import confy

let srcHello = srcDir/"library.nim"
var hello = Program.new(
  src   = srcHello,
  trg   = "hello-nim-x64",
  ) # Doesn't build. Stores the configuration for calling .build() later

#_____________________
# Normal Compilation |
#____________________|
when not defined(CrossCompile):
  hello.syst = confy.getHost()         # This is the default value set when not specified. Explicit just for clarity of the example.
  hello.build( run=true, force=true )  # Order to build. Defaults when omitted: (run=false, force=false)

#_____________________
# Cross Compilation  |
#____________________|
elif defined(CrossCompile): # --d:CrossCompile in the src/build.nim.cfg file to run this part of the example
  # Build the target for Linux x86_64
  var lnx  = hello                                 # Make a copy, so we have the configuration on this target too
  lnx.trg  = hello.trg&"-x64"                      # Give it a unique name (just for clarity)
  lnx.syst = System(os: OS.Linux, cpu: CPU.x86_64) # Change the target to build for Linux and x86_64
  lnx.build()                                      # Order to build, but not run and not forcebuild

  # Build the target for Windows x86_64
  var win  = hello                                   # Make a copy, so we have the configuration on this target too
  win.trg  = hello.trg&".exe"                        # Give it the .exe extension
  win.syst = System(os: OS.Windows, cpu: CPU.x86_64) # Change the target to build for Windows and x86_64
  win.build()                                        # Order to build, but not run and not forcebuild

  # Build the target for mac.x64
  var macx64  = hello                               # Make a copy, so we have the configuration on this target too
  macx64.trg  = hello.trg&".app"                    # Give it the .app extension
  macx64.syst = System(os: OS.Mac, cpu: CPU.x86_64) # Change the target to build for Mac and x86_64
  macx64.build()                                    # Order to build, but not run and not forcebuild

  # Build the target for mac.arm64
  var macarm  = hello                              # Make a copy, so we have the configuration on this target too
  macarm.trg  = hello.trg&".app"                   # Give it the .app extension
  macarm.syst = System(os: OS.Mac, cpu: CPU.arm64) # Change the target to build for Mac and arm64
  macarm.build()   

my project structure look's like: image

my .nimble file:

from confy/nimble as run import nil

# Package

packageName   = "nanogl3ify"
version       = "0.0.1"
author        = "griffith1deady <sadness1rip@gmail.com>"
description   = "Java NanoVG binding for LWJGL2"
license       = "WTFPL"
srcDir = "src"
bin           = @["library.exe"]

# Dependencies

requires("nim >= 1.6.4")
requires("nanovg >= 0.3.4")
requires("jnim >= 0.5.2")

task confy, ".....": run.confy()

error what i get:

confy: Building the current project with confy ... Hint: used config file 'C:\Users\Administrator.choosenim\toolchains\nim-#devel\config\nim.cfg' [Conf] Hint: used config file 'C:\Users\Administrator.choosenim\toolchains\nim-#devel\config\config.nims' [Conf] ........................................................................................................................................................................................................................................ CC: build.nim Hint: [Link] gcc.exe: fatal error: no input files compilation terminated. Error: execution of an external program failed: 'gcc.exe @build_linkerArgs.txt' stack trace: (most recent call last) C:\Users\ADMINI~1\AppData\Local\Temp\nimblecache-0\nimscriptapi_1979849413.nim(210, 16) C:\Project's\Binding\nanogl3ify\nanogl3ify.nimble(18, 31) confyTask C:\Users\Administrator.nimble\pkgs2\confy-0.1.11-0a543bd1e917efb307de3eb66d8540e3123634c7\confy\nims\task.nim(30, 3) confy C:\Users\Administrator.nimble\pkgs2\confy-0.1.11-0a543bd1e917efb307de3eb66d8540e3123634c7\confy\nims\helper.nim(41, 16) sh C:\Users\Administrator.choosenim\toolchains\nim-#devel\lib\system\nimscript.nim(263, 7) exec C:\Users\Administrator.choosenim\toolchains\nim-#devel\lib\system\nimscript.nim(263, 7) Error: unhandled exception: FAILED: nim c -d:release -d:ssl --skipParentCfg --outDir:.\bin .\src/build.nim [OSError] Tip: 5 messages have been suppressed, use --verbose to show them. nimscriptwrapper.nim(161) execScript

Error:  Exception raised during nimble script execution

PS C:\Project's\Binding\nanogl3ify>

if my build.nim contains any code not related to import confy, compilation succesfully.

heysokam commented 10 months ago

@griffith1deady finally taking a look a this. sorry for the delay

exception: FAILED: nim c -d:release -d:ssl --skipParentCfg --outDir:.\bin .\src/build.nim [OSError]

Notice how confy is creating the paths as .\ .. / instead of using backlashes for everything Although I'm not completely sure yet, this is likely to be causing the issues, since the error is saying that gcc doesn't understand the build command.

I'm going to be doing a deep refactor of the library from https://github.com/heysokam/confy/pull/5 and will take a look at this during the process.

Will ping you here once that is complete, so we can try again to see if the problem is resolved.

heysokam commented 10 months ago

image I managed to get confy to run correctly on windows with the refactor at #5

I will merge it soon, and we can start debugging your project setup from there.

heysokam commented 10 months ago

@griffith1deady Version v0.2.0 is up and running Please try again using the hello.nim example project as your template. I think the problem should be fixed, but let me know if something else comes up.

heysokam commented 10 months ago

Closing, as the problem should theoretically be fixed. Please write here and/or reopen this issue if your problem persists after the v0.2.0 refactor.