-
Notifications
You must be signed in to change notification settings - Fork 7.5k
native_posix linking issues under Ubuntu 18.04 after upgrade #10243
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
Comments
@pfalcon : native_posix builds fine in Ubuntu 18.04 w gcc 7.3. You need to install the gcc-multilib & g++-multilib |
Maybe for you, but not for me, see above.
Sure, I did all that. |
This is a clean virtual machine with the packages needed to compile zephyr + cmake + the zephyr sdk lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic
alpi@alpiX1804v:~/aescolar-ot$ uname -a
Linux alpiX1804v 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
alpi@alpiX1804v:~/aescolar-ot$ mkdir build
alpi@alpiX1804v:~/aescolar-ot$ source zephyr-env.sh
alpi@alpiX1804v:~/aescolar-ot$ cd build/
alpi@alpiX1804v:~/aescolar-ot/build$ cmake ../samples/hello_world/ -GNinja -DBOARD=native_posix
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.5", minimum required is "3.4")
-- Selected BOARD native_posix
Zephyr version: 1.13.99
Parsing Kconfig tree in /home/alpi/aescolar-ot/Kconfig
Loading /home/alpi/aescolar-ot/boards/posix/native_posix/native_posix_defconfig as base
Merging /home/alpi/aescolar-ot/samples/hello_world/prj.conf
-- Generating zephyr/include/generated/generated_dts_board.h
-- Cache files will be written to: /home/alpi/.cache/zephyr
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is unknown
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/gcc
-- Performing Test toolchain_is_ok
-- Performing Test toolchain_is_ok - Success
--
*******************************
*** NOTE TO KCONFIG AUTHORS ***
*******************************
The behavior of Kconfig 'default' properties in Zephyr has changed. The
earliest default with a satisfied condition is now used, instead of the
last one. This is standard Kconfig behavior.
See http://docs.zephyrproject.org/latest/porting/board_porting.html#old-zephyr-kconfig-behavior-for-defaults.
To get rid of this note, create a file called 'hide-defaults-note' in the
Zephyr root directory. An empty file is fine.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alpi/aescolar-ot/build
alpi@alpiX1804v:~/aescolar-ot/build$ ninja
[1/69] Preparing syscall dependency handling
[69/69] Linking C executable zephyr/zephyr.elf
alpi@alpiX1804v:~/aescolar-ot/build$ zephyr/zephyr.exe
***** Booting Zephyr OS v1.9.0-7536-g73c217802 *****
Hello World! native_posix
^C
Stopped at 0.690s
alpi@alpiX1804v:~/aescolar-ot/build$ git log | head
commit 73c21780272d1f7f4382c9213c463f3ddbca5716
alpi@alpiX1804v:~/aescolar-ot/build$ cmake --version
cmake version 3.10.2 |
If you have updated your installation, maybe the gcc you are running is not the default one from the ubuntu distro? In that case you need to install the gcc-mulitlib for that gcc package. (say gcc-7-multilib) |
I indeed upgraded from Ubuntu 16.04. The gcc is:
multilib packages:
So, everything looks ok. Thanks for confirming that it works for you in a clean VM and for other hints. As you can see, I unassigned this from you, will try to dig further myself (though I'd appreciate hints if I get stuck). My plan is to check how cmake passes -m32 to link stage and why it might be dropped. (Will work on this as time permits.) |
And this is how the link line looks like in the example above:
Note the end of link line |
Maybe check with |
@pfalcon : Given that this issue seems to be related to your particular compilers setup, would you consider it reasonable to close it? (You can still re-open it later if you want to add something) |
That's not my evaluation of this issue, mine would be "CMake build system doesn't have reliable enough ways to detect i386 vs x86_64 systems, leading to build errors". It's true that I'm the first to report it, but that doesn't mean nobody else is affected - it's just nobody else reported it yet (you can just wait for an echo thru the years). As I mentioned, I unassigned you from this ticket, thanks for triaging it. Let me assign it to myself to avoid any confusion. If you wouldn't like to receive further notifications on this ticket, there's "Unsubscribe" button on the right of page. Thanks. |
@nashif : This really seems to be an issue with Paul's multiple compilers installation/packaging issues after a distro upgrade, and not related to Zephyr per se. |
@pfalcon: Using Ubuntu 16.04.10 I have the same issue, -m32 appears to be missing from the link line. This was not an upgrade, it was a recent fresh install.
gcc is:
multilib packages:
Would be interesting to try a 16.04 clean vm to see if it is broken? |
@paulsykes : Cool, thanks for confirmation and additional info. Previous to upgrade, I was on 16.04 and everything was ok for me. (16.04 was itself upgraded from 14.04.) It's still on my todo to debug this. |
@paulsykes , @pfalcon : What applications are you trying to compile? Is it your own app which is setting its own linker flags? |
From the console log above: |
The posix arch cmake file sets the "-m32" About 16.04 I just tried, and it works fine in a clean machine. Here the exact steps I followed:
|
Yeah, and I thought maybe it's conditional on some checks, but it's not:
Now the fun thing: there were a bunch of toolchain upgrades in 18.04 this weekend, which I installed. Ant trying to build now for BOARD=native_posix, everything links well (I tried hello_world and samples/subsys/shell/shell_module). I don't known what may be involved. Maybe cmake tries to smartass thru app's link flags and remove something on its whim? (Btw, @aescolar, how do we deal with building native_posix on 32-bit system?) Anyway, now I'm keen to close this, @paulsykes, let us know if you plan to investigate your case further and keeping the ticket open is beneficial. |
Btw, I don't use -GNinja, i.e. use ol' good makefiles. |
(I haven't had myself a 32 bit OS image for quite a few years now.. So I haven't tried building anything in a 32bit OS for a while) |
Ok, let's close this for now, can reopen if stable reproduction cases are provided. |
Sigh, I hit this starting from scratch with 18.04 minimal setup and following instructions. There are some steps missing. |
@jimschm : It is quite annoying that this is happening to some people. But it is very difficult to know what is the problem from the descriptions provided so far in this issue. |
Yeah, my feedback isn't super actionable, except that it is another independent report. What I did is described well above. I installed 18.04 fresh from Ubuntu into a VirtualBox VM, then followed online instructions closely, including SDK installation. I put SDK export lines into .zephyrrc which was not explicitly instructed but fairly obvious. This brought me to the point where I could run cmake for hello_world, but then compiler etc. was not installed. I installed a few more every day packages (build-essential, gcc-multilib, g++-multilib). Then I got here. Unfortunately I don't have the time to troubleshoot. I switched to 16.04, did exact same steps, and it worked fine. |
@jimschm: I guess, going forward, we need to collect some objective data for the working/non-working environments. As an initial step, can start with providing output for the following commands:
For me (working env):
(As can be seen, my cmake doesn't come from distro, it's actually a manual install from ubuntu 16.04 times, when distro version was too low for Zephyr's need. Need to try distro version one of these days, but not right now, as I need to get work done, not debug build tools hell too.) |
We are actually not telling people to install gcc or gcc-multilib in the getting started guide.. The multilib dependency is only mentioned in the native_posix board page. I will do a PR to update the getting started list of packages for Ubuntu. (Maybe this issue is the result of running cmake the first time without the needed things, then installing them, and then running it again with a corrupted cmake working directory (?)) |
Definitely not for me. rm -rf ... is my frequent command during Zephyr development (I don't trust Zephyr's own clean). |
In 0d811b9 the gcc-mulitlib package was removed from the Ubuntu list of packages to install. Seems this may be creating some confusion for some developers (see comments in zephyrproject-rtos#10243) Let's add it back. Signed-off-by: Alberto Escolar Piedras <[email protected]>
I am well versed with cmake. That said it's good to mention in the instructions that tool paths are cached in the build directory. |
In 0d811b9 the gcc-mulitlib package was removed from the Ubuntu list of packages to install. Seems this may be creating some confusion for some developers (see comments in #10243) Let's add it back. Signed-off-by: Alberto Escolar Piedras <[email protected]>
Just for the note, I'm 2nd day on:
(from distro) And so far, so good. |
Uh oh!
There was an error while loading. Please reload this page.
Here're 2 facts:
Trying to build for BOARD=native_posix now I get:
With VERBOSE=1 it's:
It clearly looks like -m32 is missing from the link command line, and indeed, re-running that command in the appropriate dir with -m32 added leads to a successful link and working executable.
The text was updated successfully, but these errors were encountered: