We have moved to a new Sailfish OS Forum. Please start new discussions there.

App build fails after some time (or number of builds)

asked 2019-05-21 19:05:06 +0300

JosD gravatar image

updated 2019-05-22 11:45:33 +0300

I am learning to develop apps using SDK Qt Creator 4.8.1 (Sailfish SDK) on Ubuntu 19.04. Some first test-apps run well in the emulator and on my Xperia X. I learn by making small changes and frequently testing the results in the emulator. Now something weird has happened: after some time and various changes the build process faults with

/usr/lib/Scrt1.o: In function `_start':
(.text+0x28): undefined reference to `main'
collect2: error: ld returned 1 exit status

Even if I roll back all changes, the error remains. Only starting a new project and copying all the code as text, makes the build successful again. But after some time (or number of builds?) the error surfaces again.

Any suggestions how to overcome this problem?

edit retag flag offensive close delete


Can you share your project?

vige ( 2019-05-22 12:42:36 +0300 )edit

Hm, the last project that failed, mysteriously recovered overnight and ran well again. The original project still fails to build (but was successful with the same code earlier). Thanks for asking by the way and please find the project via the link above.

JosD ( 2019-05-22 19:15:44 +0300 )edit

Hi Vige, Your analysis was excellent. Although the code was the same, I seem to have changed the project configuration. And after the changes suggested by you, the build runs fine again. Thank you very much! Regards, JosD.

JosD ( 2019-05-23 19:59:12 +0300 )edit

2 Answers

Sort by » oldest newest most voted

answered 2019-05-23 09:05:44 +0300

vige gravatar image

You project does not contain any c++ sources, that's why there is no main() function for the linker to find.

You probably want to make your project a "QML only" project, by changing the CONFIG -line in your .pro file to: CONFIG += sailfishapp_qml

You also need to edit the Exec -line in your .desktop -file to launch your app using sailfish-qml: Exec=sailfish-qml Countback

I have a feeling you have created your project as a "Sailfish OS Qt Quick Application" and then you have later deleted the .cpp file.

edit flag offensive delete publish link more

answered 2019-05-23 19:59:51 +0300

JosD gravatar image

The analysis of Vige was correct and brought the solution.

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools



Asked: 2019-05-21 19:05:06 +0300

Seen: 96 times

Last updated: May 23 '19