Forums

option naming conflict with mono under Win32

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

option naming conflict with mono under Win32

Postby PixelPartner » Tue Dec 30, 2008 8:01 am

I use a fresh cobra-workspace under Windows XP with Mono 2.0 installed.
When I call cobra with a -pkg option it calls pkg-config to get references.
Unfortunately pkg-config returns lots of -r: that don't fit the renamed -ref/-reference option of cobra but cobra thinks of it as a -run/-r option.

I guess it was a bad idea to change the options from "-ref/-r -run" to "-ref/-reference -run/-r".

Maybe I should uninstall my Mono SDK I wanted to use to limit myself to cross platform features ?
PixelPartner
 
Posts: 5
Location: Berlin/Germany

Re: option naming conflict with mono under Win32

Postby Charles » Tue Dec 30, 2008 9:18 pm

Here is the code in the Cobra compiler that implements pkg-config. You can see towards the end that it's looking for "-r:" (not "-ref:") in the output and splitting on that. And the original option text from pkg-config is not being used:
def refsForPackage(pkgName as String) as List<of String>
"""
Returns the library/DLL refs for the give package name.
Runs pkg-config to get that list.
See HowTo/GTK.cobra
"""
refs = List<of String>()

# example: pkg-config --libs gtk-sharp-2.0
p = Process()
p.startInfo.fileName = 'pkg-config'
p.startInfo.arguments = '--libs [pkgName]'
if .verbosity > 1
print 'Running: [p.startInfo.fileName] [p.startInfo.arguments]'
output = CobraCore.runAndCaptureAllOutput(p).trim
if p.exitCode
_addMessage(SourceException('Cannot locate package "[pkgName]"'))
print ' $ [p.startInfo.fileName] [p.startInfo.arguments]'
for line in output.split(c'\n')
print ' |', line
return refs

parts = output.replace('-r:', '${1}').split(c'${1}') # while Cobra uses -ref:, pkg-config outputs -r:
for part in parts
if part.trim <> '', refs.add(part.trim)

return refs


So I'm not sure what the problem is. Does pkg-config on Windows spit out /r: instead of -r:?

Can you post back the exact cobra command you are using and the output? Also, try throwing in a -v for verbose and a -c for compile-only.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: option naming conflict with mono under Win32

Postby PixelPartner » Fri Jan 02, 2009 1:22 am

Thank you Chuck, the cobra side seems fine !
IMO it boils down to a problem with the C#-Compiler shouting 'CS2007', also given the -pkg: option.
But I still don't know how to solve this.
BTW: Happy new year to all of you ...

Code: Select all
C:\Cobra\cobra-workspace\HowTo>cobra -c -v -pkg:gtk-sharp-2.0 390-GTK.cobra
Cobra Command Line 0.8.0 post-release
Copyright (C) 2003-2008 by Cobra Language LLC.

OS Version:   Microsoft Windows NT 5.1.2600 Service Pack 2
CLR Platform: .NET
CLR Version:  2.0.50727.1433
Current Directory: C:\Cobra\cobra-workspace\HowTo
Current Exe: C:\Cobra\Cobra-0.8.0-post\bin\cobra.exe
Option Dictionary:
    compile: true
    verbosity: 1
    pkg: List<of String>['gtk-sharp-2.0']
    contracts: 'inline'
    correct-source: Set<of String>['none']
    debugging-tips: true
    embed-run-time: false
    include-asserts: true
    include-nil-checks: true
    include-tests: true
    include-traces: true
    number: 'decimal'
Paths:
    390-GTK.cobra
Adding reference to Cobra.Lang.dll
Reading assembly:  mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 at
        C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll
Reading assembly:  System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 at
        C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll
Loading reference: Cobra.Lang.dll
Reading assembly:  Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=null at C:\Cobra\Cobra-0.8.0-post\bin\Cobra.Lang.dll
Loading reference: D:/EIGENE~1/privat/MONO-2~1.1/lib/mono/gtk-sharp-2.0/pango-sharp.dll
Reading assembly:  pango-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f at
        D:\Eigene Dateien\privat\Mono-2.0.1\lib\mono\gtk-sharp-2.0\pango-sharp.dll
Loading reference: D:/EIGENE~1/privat/MONO-2~1.1/lib/mono/gtk-sharp-2.0/atk-sharp.dll
Reading assembly:  atk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f at
        D:\Eigene Dateien\privat\Mono-2.0.1\lib\mono\gtk-sharp-2.0\atk-sharp.dll
Loading reference: D:/EIGENE~1/privat/MONO-2~1.1/lib/mono/gtk-sharp-2.0/gdk-sharp.dll
Reading assembly:  gdk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f at
        D:\Eigene Dateien\privat\Mono-2.0.1\lib\mono\gtk-sharp-2.0\gdk-sharp.dll
Loading reference: D:/EIGENE~1/privat/MONO-2~1.1/lib/mono/gtk-sharp-2.0/gtk-sharp.dll
Reading assembly:  gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f at
        D:\Eigene Dateien\privat\Mono-2.0.1\lib\mono\gtk-sharp-2.0\gtk-sharp.dll
Loading reference: D:/EIGENE~1/privat/MONO-2~1.1/lib/mono/gtk-sharp-2.0/glib-sharp.dll
Reading assembly:  glib-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f at
        D:\Eigene Dateien\privat\Mono-2.0.1\lib\mono\gtk-sharp-2.0\glib-sharp.dll
Noting  C:\Cobra\Cobra-0.8.0-post\bin\CobraInfo.cs
Parsing 390-GTK.cobra
Compiling to produce 390-GTK.exe
error: fatal error CS2007: Unrecognized option: "-pkg:gtk-sharp-2.0"
Compilation failed - 1 error, 0 warnings
PixelPartner
 
Posts: 5
Location: Berlin/Germany

Re: option naming conflict with mono under Win32

Postby Charles » Fri Jan 02, 2009 3:06 am

PixelPartner wrote:Thank you Chuck, the cobra side seems fine !
IMO it boils down to a problem with the C#-Compiler shouting 'CS2007', also given the -pkg: option.
But I still don't know how to solve this.
BTW: Happy new year to all of you ...
...

I confirmed that Cobra was passing -pkg: onto the C# compiler, and it seemed unnecessary. I took that out and tested with no problems (launching GTK apps on Mac OS X that were compiled with cobra -pkg:...).

Checked in.

Update, try again and let me know how it goes.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 73 guests