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

bmcweb fails to compile in the openbmc SDK #2

Closed
geissonator opened this issue Aug 10, 2018 · 2 comments
Closed

bmcweb fails to compile in the openbmc SDK #2

geissonator opened this issue Aug 10, 2018 · 2 comments

Comments

@geissonator
Copy link
Contributor

I've spent a bit of time here and there trying to get bmcweb to compile within the openbmc SDK. I found and patched one issue with https://gerrit.openbmc-project.xyz/#/c/openbmc/openbmc/+/11901/ but I'm still not quite there and I gotta move on for now. So opening this bug to track what I've found.

With an SDK built based on the commit above, I get this when I compile:

andrewg@andrewg-VirtualBox:~/Code/bmcweb$ cmake .
-- The CXX compiler identification is GNU 7.3.0
-- Check for working CXX compiler: /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/bin/arm-openbmc-linux-gnueabi/arm-openbmc-linux-gnueabi-g++
-- Check for working CXX compiler: /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/bin/arm-openbmc-linux-gnueabi/arm-openbmc-linux-gnueabi-g++ -- broken
CMake Error at /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
  The C++ compiler

    "/home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/bin/arm-openbmc-linux-gnueabi/arm-openbmc-linux-gnueabi-g++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/andrewg/Code/bmcweb/3rdparty/CMakeFiles/CMakeTmp
    
    Run Build Command:"/usr/bin/make" "cmTC_4e71b/fast"
    /usr/bin/make -f CMakeFiles/cmTC_4e71b.dir/build.make CMakeFiles/cmTC_4e71b.dir/build
    make[1]: Entering directory '/home/andrewg/Code/bmcweb/3rdparty/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_4e71b.dir/testCXXCompiler.cxx.o
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/bin/arm-openbmc-linux-gnueabi/arm-openbmc-linux-gnueabi-g++    -O2 -pipe -g -feliminate-unused-debug-types    -o CMakeFiles/cmTC_4e71b.dir/testCXXCompiler.cxx.o -c /home/andrewg/Code/bmcweb/3rdparty/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    Linking CXX executable cmTC_4e71b
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4e71b.dir/link.txt --verbose=1
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/bin/arm-openbmc-linux-gnueabi/arm-openbmc-linux-gnueabi-g++  -O2 -pipe -g -feliminate-unused-debug-types   -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed  -rdynamic CMakeFiles/cmTC_4e71b.dir/testCXXCompiler.cxx.o  -o cmTC_4e71b 
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find crt1.o: No such file or directory
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find crti.o: No such file or directory
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find crtbegin.o: No such file or directory
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find -lstdc++
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find -lm
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find -lgcc_s
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find -lgcc
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find -lc
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find -lgcc_s
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find -lgcc
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find crtend.o: No such file or directory
    /home/andrewg/sdk/08102018-witherspoon/sysroots/x86_64-oesdk-linux/usr/libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/7.3.0/real-ld: cannot find crtn.o: No such file or directory
    collect2: error: ld returned 1 exit status
    CMakeFiles/cmTC_4e71b.dir/build.make:97: recipe for target 'cmTC_4e71b' failed
    make[1]: *** [cmTC_4e71b] Error 1
    make[1]: Leaving directory '/home/andrewg/Code/bmcweb/3rdparty/CMakeFiles/CMakeTmp'
    Makefile:126: recipe for target 'cmTC_4e71b/fast' failed
    make: *** [cmTC_4e71b/fast] Error 2
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt


-- Configuring incomplete, errors occurred!
See also "/home/andrewg/Code/bmcweb/3rdparty/CMakeFiles/CMakeOutput.log".
See also "/home/andrewg/Code/bmcweb/3rdparty/CMakeFiles/CMakeError.log".
make: *** No targets specified and no makefile found.  Stop.
-- Boost version: 1.66.0
CMake Error: File /home/andrewg/Code/bmcweb/sdbusplus-src/sdbusplus/server.hpp.in does not exist.
CMake Error at CMakeLists.txt:118 (configure_file):
  configure_file Problem configuring file


CMake Error: File /home/andrewg/Code/bmcweb/sdbusplus-src/sdbusplus/bus.hpp.in does not exist.
CMake Error at CMakeLists.txt:122 (configure_file):
  configure_file Problem configuring file


OPENSSL_INCLUDE_DIR /home/andrewg/sdk/08102018-witherspoon/sysroots/armv6-openbmc-linux-gnueabi/usr/include
CMAKE_BUILD_TYPE=
-- Configuring incomplete, errors occurred!
See also "/home/andrewg/Code/bmcweb/CMakeFiles/CMakeOutput.log".
See also "/home/andrewg/Code/bmcweb/CMakeFiles/CMakeError.log".
andrewg@andrewg-VirtualBox:~/Code/bmcweb$ 

The error seem to indicate that cmake is not getting the appropriate SDK paths. The required files and libraries are in the SDK:

andrewg@andrewg-VirtualBox:~/Code/bmcweb$ ls /home/andrewg/sdk/08102018-witherspoon/sysroots/armv6-openbmc-linux-gnueabi/usr/lib/crt*
/home/andrewg/sdk/08102018-witherspoon/sysroots/armv6-openbmc-linux-gnueabi/usr/lib/crt1.o
/home/andrewg/sdk/08102018-witherspoon/sysroots/armv6-openbmc-linux-gnueabi/usr/lib/crti.o
/home/andrewg/sdk/08102018-witherspoon/sysroots/armv6-openbmc-linux-gnueabi/usr/lib/crtn.o

But it's not finding them for some reason. I don't think this is a bmcweb specific issue, I think it's probably a cmake related issue with the SDK.

I'm running at commit 1b0044b

@feistjj
Copy link
Member

feistjj commented Aug 10, 2018

https://gerrit.openbmc-project.xyz/#/c/openbmc/bmcweb/+/11904/ should fix the problem if you are building out of tree. If you want to use the Yocto Dependencies make sure flag -DYOCTO_DEPENDENCIES is set

@geissonator
Copy link
Contributor Author

Yep, nice with this commit and this command to build I was able to get a bmcweb I could start up on our witherspoon from a compile in our SDK:

cmake --build . -DYOCTO_DEPENDENCIES=1 -DBMCWEB_INSECURE_DISABLE_SSL=ON -DBMCWEB_ENABLE_KVM=OFF -DBMCWEB_ENABLE_DBUS_REST=OFF -DBMCWEB_ENABLE_PHOSPHOR_WEBUI=OFF
make

Thanks!

bradbishop pushed a commit that referenced this issue Feb 6, 2021
In code review, despite them being documented, people still tend to make
these mistakes.  Having them numbered allows responding with comments
that are much simpler for a maintainer, with quick comments like:
"Common error #2"
While this might not seem like a huge savings, for maintainers having to
review 10s of reviews per day, having an optimized workflow helps a lot
with time savings and little improvements add up over time.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I877cbbf50c1e20448f31464f820114073bba513e
bradbishop pushed a commit that referenced this issue Feb 19, 2021
Fixes #178

Every few months, this option breaks because of some combination of
compiler options.  I'm hoping that this is a more permenant fix, and
will keep it working forever.

Functionally, this commit changes a couple things.
1.  It fixes the regression that snuck into this option, by making the
req variable optional using the c++17 [[maybe_unused]] syntax.
2. It promotes the BMCWEB_INSECURE_DISABLE_XSS_PREVENTION into the
config.h file, and a constexpr variable rather than a #define.  This has
the benefit that both the code paths in question will compiled
regardless of whether or not they're used, thus ensuring they stay
buildable forever.  The optimization path will still delete the code
later, but we won't have so many one-off build options breaking.  We
should move all the other feature driven #ifdefs to this pattern in the
future.
3. As a mechnaical change to #2, this adds a config.h.in, which delcares
the various variables as their respective constexpr types.  This allows
the constants to be used in a cleaner way.

As an aside, at some point, DISABLE_XSS_PREVENTION should really move to
a non-persistent runtime option rather than a compile time option.  Too
many people get hung up on having to recompile their BMC, and moving it
to runtime under admin credentials is no more a security risk.

As another aside, we should move all the other #ifdef style options to
this pattern.  It seems like it would help with keeping all options
buildable, and is definitely more modern than #ifdefs for features,
especially if they don't require #include changes or linker changes.

Tested:
enabled meson option insecure-disable-xss, and verified code builds and
works again.

Change-Id: Id03faa17cffdbabaf4e5b0d46b24bb58b7f44669
Signed-off-by: Ed Tanous <edtanous@google.com>
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

2 participants