Valama / valama

Next generation Vala IDE
GNU General Public License v3.0
207 stars 35 forks source link

Cannot convert from `int' to `Vala.Expression?' during compiling #240

Open ghost opened 8 years ago

ghost commented 8 years ago

I downloaded the source and tried to compile though I get this error:

" /aur-valama-git/src/valama-git/guanako/scanner/valaparser.vala:597.5-597.36: error: Assignment: Cannot convert from int' toVala.Expression?'"

What am I doing wrong? I tried it multiple times now. Is the source outdated is there some actual bug or am I simply dumb? I am running on Arch

xkaying commented 8 years ago

now vala version is 0.32 ,so all these macro is wrong. remove it

if VALAC_0_26

else

endif

ghost commented 8 years ago

Sorry but I dont get it. Should I simply remove all the macros that are ran when version is checked? I mean it would not change the actual line that is causing the error seeing the last line is causing the actual error.

`#if VALAC_0_26 if (array_length != null) {

else

        if (array_length > 0) {

endif

            array_type.fixed_length = true;
            array_type.length = array_length;`
399man commented 8 years ago

@xkaying I just cloned the repository in order to give valama a try and I'm facing the very same issue. And really don't get you comment.

snaiperskaya96 commented 8 years ago

Basically valama is not compatible with Vala > 0.26. Very bad

linusseelinger commented 8 years ago

I just tried the current valama master with Vala 0.30.1 on ubuntu 16.04, it builds fine for me. Did you use the git repo straight from github?

snaiperskaya96 commented 8 years ago

Yep, trying to compile with Vala 0.32 on elementary and also on ubuntu with Vala 0.30

399man commented 8 years ago

I'm using Debian Testing with vala 0.32, trying to build current master.

linusseelinger commented 8 years ago

Hm, now it's getting weird... I just did a fresh clone, and it builds fine. Do you have multiple vala/libvala versions installed? Could you please post the full cmake output of a clean build?

dcrdev commented 8 years ago

I'm trying to build this on Fedora (vala 0.32) and am running into this issue as well - has anyone managed to get to the bottom of it?

arrufat commented 8 years ago

Any news on how to build valama with vala 0.34.1? I'm having the exact same error as @fasa123

karasu commented 8 years ago

Having the same problem, also using Vala 0.34.1 compiling from a fresh repository clone, in Antergos (Arch derivative). Here's my output (in case is helpful):

/home/karasu/valama/guanako/scanner/valaparser.vala:597.5-597.36: error: Assignment: Cannot convert from `int' to `Vala.Expression?'
                array_type.length = array_length;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation failed: 1 error(s), 0 warning(s)
make[2]: *** [guanako/CMakeFiles/guanako.dir/build.make:111: guanako/vala.stamp] Error 1
make[2]: Leaving directory '/home/karasu/valama/build'
make[1]: *** [CMakeFiles/Makefile2:224: guanako/CMakeFiles/guanako.dir/all] Error 2
make[1]: Leaving directory '/home/karasu/valama/build'
make: *** [Makefile:131: all] Error 2
fusion809 commented 8 years ago

Arch Linux users may wish to use this modified valama-git PKGBUILD:

# Maintainer: Peter Lamby <peterlamby@web.de>
pkgname=valama-git
pkgver=r940.a7539fa
pkgrel=1
pkgdesc="Next generation Vala IDE"
arch=('i686' 'x86_64')
url="https://github.com/Valama/valama"
license=('GPL3')
depends=('glib2' 'vala0.26' 'clutter-gtk' 'libgee' 'gdk-pixbuf2' 'gdl' 'gtksourceview3' 'webkit2gtk' 'intltool' 'glade')
makedepends=("cmake" 'imagemagick')
options=('!libtool')
install=valama.install
source=("${pkgname}"::'git+https://github.com/Valama/valama.git')
md5sums=('SKIP')

pkgver() {
    cd "$pkgname"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    cd "${srcdir}/${pkgname}"
}

build() {
    cd "${srcdir}/${pkgname}"
    cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DPOSTINSTALL_HOOK=OFF -DCMAKE_BUILD_TYPE=Release
    make
}

package() {
    cd "${srcdir}/${pkgname}"
    make DESTDIR="${pkgdir}" install
}

I have added a vala0.26 package to the AUR, so as soon as you install it you can build valama-git with this modified PKGBUILD. Alternatively, if you're feeling lazy you can use my [pkgbuild-current] repository, which has a valama-git package in it, along with a vala0.26 package. To add this repository and install valama-git from it run:

echo -e "[pkgbuild-current]\nServer = https://github.com/fusion809/PKGBUILDs/releases/download/current\nSigLevel = PackageOptional" | sudo tee /etc/pacman.conf
sudo pacman -Syyu valama-git --noconfirm
snaiperskaya96 commented 8 years ago

@fusion809 But the topic problem is relative to vala > 0.26

fusion809 commented 8 years ago

Yep, this isn't a solution, more a work-around for Arch users. If I could pull a solution to the actual problem (which is its build failure with vala>0.26, as you pointed out) out of thin air I would, but unfortunately, this is the best I personally can come up with.

snaiperskaya96 commented 8 years ago

@fusion809 What I mean is that compiling valama with vala 0.26 should just work, though i think your is a useful solution to install valama on arch, your answer seems a little off-topic here. Just saying

fusion809 commented 8 years ago

True, it is off-topic here, but it seems like the best place to mention it seeing how Arch users are amongst those reporting this error here. So mentioning this work-around here is one of the best ways I can get this workaround to people that can benefit from it. I have also mentioned it in the comments of the valama-git AUR package.

lapawa commented 7 years ago

I get the same original issue on Ubuntu 16.10. Vala version is 0.32. valaparser.vala:597.5-597.36: error: Assignment: Cannot convert from int' toVala.Expression?'" array_type.value_owned = type.value_owned;

var array_type = new ArrayType (type, 1, get_src (begin));
            array_type.inline_allocated = true;
#if VALAC_0_26
            if (array_length != null) {
#else
            if (array_length > 0) {
#endif
                array_type.fixed_length = true;
                array_type.length = array_length;
            }
            array_type.value_owned = type.value_owned;

            return array_type;

Failed run CMakeCache.txt

lapawa commented 7 years ago

I've found the array_type.length datatype In my vala versions source code It is of type Expression. Removing the #if VALAC_0_26 directive and the complete #else to #endif part from valaparser.vala solved my compile issues. You can find the changes made in my forked repository: https://github.com/lapawa/valama/commit/379b6d6ea9eebd904eee3650a2da5bdf5a86b4d2 Good luck

robertsanseries commented 7 years ago

Simple to solve this problem:

1 - Open the code in the file that generates the error valama/guanako/scanner/valaparser.vala line 597

2 - Forces the conversion of the value by making a "cast" In: Array_type.length = array_length;

for: Array_type.length = (Vala.Expression) array_length;