Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken build on Linux Mint #738

Open
jimdbr opened this issue Mar 21, 2023 · 22 comments
Open

Broken build on Linux Mint #738

jimdbr opened this issue Mar 21, 2023 · 22 comments

Comments

@jimdbr
Copy link

jimdbr commented Mar 21, 2023

The default version of Boost on Linux Mint 21.1 Vera is 1.74.0 but brewtarget wants at least 1.79.0. I'm reluctant to upgrade Boost because of scattered reports that a newer Boost might break other software.

Any suggestions?

Thanks.

Jim

@matty0ung
Copy link
Contributor

Maybe there is a way to install a newer version of Boost in a different location than the 1.74 you already have installed and then point the build system at the 1.79 directories?

@jimdbr
Copy link
Author

jimdbr commented May 3, 2023

I finally had a chance to look at this. I have Boost 1.82 installed in /usr/local/lib. The brewtarget build throws lots of compiler warnings. Starting from the menu works but starting from the command line (/usr/bin/brewtarget) aborts. The final line of the stacktrace is:

31# _start in /usr/bin/brewtarget
[database/ObjectStore.cpp:700]
[17:08:55.513] (1dq4d1jzgg) ERROR : ASSERT: "false" in file /home/jim/Src/brewtarget/src/database/ObjectStore.cpp, line 702 [database/ObjectStore.cpp:702]

I don't know what this means but I will keep poking at it.

@matty0ung
Copy link
Contributor

The error you're seeing usually means we read something unexpected (and unparseable) out of the database. Are you starting with a fresh database or using an existing one?

Also, what commands are you using to build and install brewtarget? (Depending on the compiler, you can see compiler warnings in some of the Qt headers, but there normally should not be very many in the Brewtarget code itself.)

@jimdbr
Copy link
Author

jimdbr commented May 4, 2023

I am using an existing database. I turned on logging and have over 1800 lines of errors, mostly like "[13:43:25.193] (1dil1llge8) ERROR : int {anonymous}::stringToEnum(const ObjectStore::TableDefinition&, const ObjectStore::TableField&, const QVariant&) Could not decode "pellet" to enum when mapping column form to property form for hop so using 0 [database/ObjectStore.cpp:241]".

I am using the regular cmake and make commands in brewtarget-build, ie cmake ..;make with the default tools distributed with Linux Mint. The warnings all appear to be Qt. I noticed that PROJECT_VERSION = 3.0.8 but the resulting bin says 3.0.6.

As before, starting from the command line ends with an abort. Starting from the GUI gives me a running brewtarget with over 1800 errors in the log.

@matty0ung
Copy link
Contributor

Sounds like you might have two different binaries. If you're building from source, it's simplest to ensure that you don't already have the binary package installed. The .deb and .rpm packages will install the executable to /usr/bin/brewtarget. A local build & install using CMake or Meson will put the executable at /usr/local/bin/brewtarget. (See, eg, https://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux), for why this is. TLDR is that local compiles are not supposed to install into the same place as the package manager.)

Make a backup of your database file (just in case) and uninstall the packaged version (sudo apt remove brewtarget). That way you'll only have the locally-built executable, which should be less confusing.

Also, for a local build, note that you must install the binary before running it. Otherwise, it doesn't know where to look for various resources. If you're using CMake, in the build directory, you need:

make
sudo make install
brewtarget

If you're using Meson, in the mbuild directory, it's:

meson compile
sudo meson install
brewtarget

@matty0ung
Copy link
Contributor

The error about Could not decode "pellet" to enum when mapping column form to property form for hop comes from a bug from a few months back. The bug should be fixed in the current code base, so seeing that particular error message suggests you might have been running an older version of the code (eg from the package install rather than the local build). But, if you're still seeing it when running the current code, let us know.

@jimdbr
Copy link
Author

jimdbr commented May 5, 2023

I always build from source. The last package I used was 2.3.1. That was removed years ago. After a make clean; make; sudo make install nothing works. Looks like it's time to clean up my build directories and start fresh. By the way, I found brewtarget binaries in both /usr/bin and /usr/local/bin so I removed all of them.

@matty0ung
Copy link
Contributor

Ah, OK, that's curious. I had a look on my system and I also seem to have Brewtarget 3.0.6 in /usr/bin! I wonder if we had a bug in one of the build scripts for that release.

Anyway, yes, you're right, cleaning up build directories and starting fresh is a good idea.

Let us know how you get on.

@jimdbr
Copy link
Author

jimdbr commented May 5, 2023

I made a fresh clone of the repository. Brewtarget will run with the default database but aborts with my database.

@matty0ung
Copy link
Contributor

OK, sounds like progress. 😄

If the abort is still from the assert at line 702 of database/ObjectStore.cpp then there should be a couple of critical error messages logged almost immediately before it that give some useful diagnostic info. (This is actually one of the places where Boost stacktrace is very useful!)

(I'm expecting there should be an easy fix for your existing database.)

@jimdbr
Copy link
Author

jimdbr commented May 5, 2023

Like these:

[12:29:20.221] (1dpk686xj4) ERROR : void ObjectStore::loadAll(Database*) Error executing database query "SELECT id, display, deleted, folder, abv, attenuation, boil_off, brewdate, brewhouse_eff, eff_into_bk, fermentdate, fg, final_volume, mash_final_temp, notes, og, pitch_temp, post_boil_volume, projected_abv, projected_atten, projected_boil_grav, projected_eff, projected_ferm_points, projected_fg, projected_mash_fin_temp, projected_og, projected_points, projected_strike_temp, projected_vol_into_bk, projected_vol_into_ferm, sg, strike_temp, volume_into_bk, volume_into_fermenter, recipe_id\n FROM brewnote;" : "no such column: notes Unable to execute statement" [database/ObjectStore.cpp:1240]
[12:29:20.277] (1dpk686xj4) ERROR : void ObjectStore::impl::wrapAndUnmapAsNeeded(const ObjectStore::TableDefinition&, const ObjectStore::TableField&, QVariant&) Unexpected type # 6 = double in QVariant for property inventoryId , field type FieldType # 1 : ( "ObjectStore::FieldType::Int" ) , value QVariant(double, 140) , table fermentable , column inventory_id [database/ObjectStore.cpp:695]
[12:29:20.288] (1dpk686xj4) ERROR : void ObjectStore::impl::wrapAndUnmapAsNeeded(const ObjectStore::TableDefinition&, const

@matty0ung
Copy link
Contributor

Hmm, that's interesting. The first error is saying a column is missing from one of the database tables. The second is saying that, in another table, it found a decimal number where it expected an integer.

The second error is relatively easily fixable. Either we update the data to say "make these decimals integers", or we update the code to say "decimal numbers in this integer-only field is a known legacy issue, just truncate the decimal to an integer and it will be fine". This is because, if I remember rightly, we had a field that, long ago, was accidentally declared as a decimal when it was something we only were every going to store integers in. So it's safe to do either of the corrections I mention.

The first error though is a bit more puzzling. I can't think off the top of my head why the notes field would disappear from the brewnote table.

Are all the other messages for the same errors, or are there some different ones?

@jimdbr
Copy link
Author

jimdbr commented May 6, 2023

There is one warning:

12:30:18.625] (1dmhap1hds) WARNING : QXcbConnection: XCB error: 3 (BadWindow), sequence: 531, resource id: 9868761, major code: 40 (TranslateCoords), minor code: 0 [:0]

The other messages are all INFO with the strings "No value supplied for required parameter" and "so using generic default". Looks like my database is trashed so it won't merge. Did I miss a schema change somewhere?

@matty0ung
Copy link
Contributor

Good to know it's only one missing column. Not sure how come it isn't there. Every time we modify the DB schema, we update the schema version number, which is stored both in the code and in the version column of the settings table. Should be set to version 10. But, AFAICT, the notes field has been on the brewnote table since version 1, ie from years and years ago.

Since you're compiling from source, are you OK to make a backup of your DB and try to fix it with some manual SQL -- eg using sqlite3 from the command line or "DB Browser for SQLite' from the GUI? I think all you would need would be:

ALTER TABLE brewnote ADD COLUMN notes TYPE text;

NB: I have not tested this so there may be minor syntax errors to correct.

Then, while you're at it, you should (I think) be able to fix the other error with:

UPDATE fermentable SET inventory_id = CAST(inventory_id AS int) WHERE inventory_id IS NOT null;

@jimdbr
Copy link
Author

jimdbr commented May 6, 2023

The database and my code are both 10. I have some older backups that I can play with. I won't be able to get to it until mid-week. I have a backup database with my recipes that is schema version 10, assuming that's what the version number in the settings table is. I found a few older databases with different version numbers that I will move aside to avoid confusion.

Thanks for your help. I will let you know what happens in a few days.

@matty0ung matty0ung mentioned this issue May 8, 2023
@jimdbr
Copy link
Author

jimdbr commented May 8, 2023

I'm getting closer. I ran the SQL you suggested. Now it's complaining about an unexpected type. The stack trace is attached.

brewtarget.log

While playing with DB Browser I found a bunch of old recipes and data created by previous versions of brewtarget. I suspect the best way to proceed is to get brewtarget running well enough to export the small number of recipes I want to keep and then start with a fresh database.

@matty0ung
Copy link
Contributor

Other folks are seeing the same issue (eg see #751) so I'll do a PR this week to fix it.

Hopefully we can get the software to read your DB directly. The "Plan B" of export and start again should mostly work, but it might not be 100% as some things (eg brew notes) cannot be exported to BeerXML.

@jimdbr
Copy link
Author

jimdbr commented May 9, 2023

Thanks. I'm not too concerned about the brew notes. I usually print a brew sheet, scribble notes on it while brewing and then forget to update the brew notes.

@matty0ung
Copy link
Contributor

I'm hoping https://github.com/Brewtarget/brewtarget/releases/tag/v3.0.9 fixes the bugs you're seeing and the rest is, as you say, data issues from old DBs. But, as ever, let me know if you see other problems.

@jimdbr
Copy link
Author

jimdbr commented May 15, 2023

Still seeing an error:

[08:55:21.392] (1dtodvnrr4) ERROR : void ObjectStore::impl::wrapAndUnmapAsNeeded(const ObjectStore::TableDefinition&, const ObjectStore::TableField&, QVariant&) Unexpected type # 6 = double in QVariant for property inventoryId , field type FieldType # 1 : ( "ObjectStore::FieldType::Int" ) , value QVariant(double, 10) , table hop , column inventory_id [database/ObjectStore.cpp:697]
[08:55:21.403] (1dtodvnrr4) ERROR : void ObjectStore::impl::wrapAndUnmapAsNeeded(const ObjectStore::TableDefinition&, const

@matty0ung matty0ung reopened this May 15, 2023
@matty0ung
Copy link
Contributor

Ah, OK, that's the same error on another table. The fix is very similar!

@Scimmia22
Copy link
Contributor

See #755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants