cross-compiling with gcc, got storage size of ... isn't known error when it is defined in an include file under sysroot - gcc

I have a question very simliar to Cross compiler default include path setup but there wasn't the answer I was looking for.
I built a cross-compiler for openrisc. I have it in ~/openrisck/toolchain/
under there, I have bin(or32-linux-* excutables are here), include, lib, lib64, libexec, or32-linux, share.
under or32-linux, I have bin, include, lib, sys-root.
When I build busybox, I gave CONFIG_CROSS_COMPILER_PREFIX as "or32-linux-".
and CONFIG_SYSROOT as "$SYSROOT" which is ~/openrisk/toolchain/or32-linux/sys-root.
then I run 'make install' in buxybox source. Since the path includes the cross-compiler directory, it compiles for or32-linux-. But I have an error below
ckim : srctree = /home/ckim/openrisc/busybox
CC applets/applets.o
In file included from /home/ckim/openrisc/toolchain/bin/../lib/gcc/or32-linux/4.5.1-or32-1.0rc1/include-fixed/syslimits.h:7:0,
from /home/ckim/openrisc/toolchain/bin/../lib/gcc/or32-linux/4.5.1-or32-1.0rc1/include-fixed/limits.h:34,
from include/platform.h:141,
from include/libbb.h:13,
from include/busybox.h:8,
from applets/applets.c:9:
/home/ckim/openrisc/toolchain/bin/../lib/gcc/or32-linux/4.5.1-or32-1.0rc1/include-fixed/limits.h:169:61: fatal error: limits.h: No such file or directory
compilation terminated.
make[1]: *** [applets/applets.o] Error 1
make: *** [applets_dir] Error 2
which makes me thinks that Ah! the cross-compiler uses the include path relative to the executable. (see above bin/../lib/gcc/or32-linux/version/include-fixed)
So the include limits.h goes to the gcc's limits.h correctly. The last file syslimits.h has #include_next when the limits.h file have already been included. and the compiler complains that the file cannot be found.
Can somebody tell me how to solve this problem? (limits.h includes syslimits.h and syslimits.h includes limits.h .. )
EDIT : I ran 'make CROSS_COMPILE=or32-linux- CONFIG_PREFIX=$SYSROOT install'
then I got 'lutimes undeclared in coreutil/touch.c' error. Assuming the limit.h problem is gone, this means I should give these command line arguments because CROSS_COMPILE for make is different from CONFIG_CROSS_COMPILER_PREFIX in busybox configuration and make's CONFIG_PREFIX is different from CONFIG_SYSROOT for busybox configuration. so to remove the lutimes error, I ran 'make menuconfig' and removed CONFIG_TOUCH. Then I reran the make(make CROSS_COMPILE=or32-linux- CONFIG_PREFIX=$SYSROOT install), and this time got
procps/free.c: In function 'free_main':
procps/free.c:51:17: error: storage size of 'info' isn't known
procps/free.c:77:2: warning: implicit declaration of function 'sysinfo'
I found that in $SYSROOT/usr/include/sys/sysinfo.h, struct sysinfo is defined. I don't know why it says it's not defined. Any help would be deeply appreciated. Thanks!

For anyone who might be facing the same problem I had..
I tried about 3 times with the old toolchain but failed.
Yesterday, I got help from IRC (openrisc) and someone told me there is an updated toolchain for or1k. (not or32 which is old. I should have read the opencore page first..)
The page is
http://opencores.org/or1k/OpenRISC_GNU_tool_chain#Linux_.28uClibc.29_toolchain_.28or1k-linux-uclibc.29 (read from Linux (uClibc) toolchain (or1k-linux-uclibc))

Related

MinGW gcc isn't able to compile a simple test program(same with cygwin) in CLion

I've just installed CLion and i needed compiler. I installed Cygwin.
But there was an error:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
CMake Error: Error executing cmake::LoadCache(). Aborting.
Error code: 1
So, CMake was "bundled" and i tried to install it from site. But there was the next error:
Selected CMake might be incompatible with the Cygwin environment.
In order to run on Cygwin, CMake needs to be specially compiled.
Please select either CMake bundled with CLion or CMake from the Cygwin installation.
CMake Error: The source directory "/cygdrive/c/Users/Пользователь/AppData/Local/Temp/cmake_check_environment" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
Error code: 1
Then i've tried to install MinGW - this time it was the following problem:
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe -- broken
CMake Error at D:/CLion 182.2574.4/bin/cmake/share/cmake-3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"D:/MinGW/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp
Run Build Command:"D:/MinGW/mingw64/bin/mingw32-make.exe" "cmTC_a4ce5/fast"
D:/MinGW/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_a4ce5.dir\build.make CMakeFiles/cmTC_a4ce5.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj
D:\MinGW\mingw64\bin\gcc.exe -o CMakeFiles\cmTC_a4ce5.dir\testCCompiler.c.obj -c C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
mingw32-make.exe[1]: *** [CMakeFiles\cmTC_a4ce5.dir\build.make:65: CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:125: cmTC_a4ce5/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".
Error code: 1
In both cases it's problems with paths, i think. I tried to give root to CLion, gcc, etc. - nothing.
I've tried to find logs or just way to this path - but all was worthless - path doesn't exist.I just can't find out, why that's happening.
Help me, please
Looks like there is a problem with encodings somewhere between windows/cygwin/clion/cmake (I assume you user name is non-ascii).
As a quick workaround try:
installing CLion in the location without non-latin symbols
changing CLion's system and config folders to the location without non-latin symbols. instructions
And to troubleshoot the problem, could you please check if the cygwin's console shows the user home path correctly? (e.g. use ls /cygdrive/c/Users/, then cd to the user home path).
If Cygwin can correctly work with the user home, could you please file a bug report and attach CLion's log files? (Help | Show Log in Explorer)

Bazel failed to include a external static library .a

-- Question solved --
This question is solved. Thanks for all the help!
The problem and the reason is briefly stated as following for other readers in the future:
[Environment]
Ubuntu 14.04, Bazel, C++
[Question]
I want to include an external library. So I download the source file and make it as as a static lib .a.
I correctly set the BUILD, WORKSPACE and related files. However, when compile, it alerts the error:
Linking of rule '//main' failed (Exit 1)
main: error: undefined reference to 'void ex_lib::compute(double*, double const*, double const*)'
collect2: error: ld returned 1 exit status
I tried with the .lo and alwayslink method here but doesn't work.
Alternate to "`--whole-archive`" in bazel
[Reason]
It is because that the external library source files contains duplicate header files. So I fix the header file problem. Make the .a again. Then everything works.
So nothing wrong with the bazel. It is the library itself that cause the problem. But the error information is confusing and I think it is caused by bazel.
What you can do to investigate further is to run the clean bazel build with --subcommands to see individual command lines of actions executed. Then you can cd into the sandbox, and execute the same gcc command as bazel does and debug what's wrong. Or you can try to get linking to work by handwriting gcc command, and pasting here both the command bazel generated, and your desired command. Is it possible that you have multiple liegroups libs installed on the system and gcc is getting one that's incompatible with headers you're including?
The problem is solved. Special thanks to mhlopko.
It is mainly because there is errors with the lib source file. Thus .a file I use contains errors. Now the bazel works fine with the new lib file.
By the way, now bazel works fine with both .a or .so file that I generated.

Pachi cant find caffe/caffe.hpp: No such file or directory

I am attempting to compile Go/Baduk engine Pachi (https://github.com/pasky/pachi) with Caffe (http://caffe.berkeleyvision.org) support.
Caffe install is OK and its located in /something/PACHI_GO_ENGINE/caffe/
caffe.hpp is located in:
/something/PACHI_GO_ENGINE/caffe/distribute/include/caffe/caffe.hpp
/something/PACHI_GO_ENGINE/caffe/include/caffe/caffe.hpp
I also updated the Pachi Makefile as instructed:
- Edit Makefile, set DCNN=1, point it to where caffe is installed and build.
I even made a copy of ...include/caffe/ to /usr/local/lib because this supposed to be a default location.
Makefile changes:
DCNN=1
#CAFFE_LIB=/usr/local/lib
CAFFE_LIB=/something/PACHI_GO_ENGINE/caffe/distribute/include
#(and several variations of this)
And I still get:
[CC] fbook.c
[CC] chat.c
[CXX] dcnn.cpp
dcnn.cpp:13:27: fatal error: caffe/caffe.hpp: No such file or directory
compilation terminated.
Makefile.lib:78: recipe for target 'dcnn.o' failed
make: *** [dcnn.o] Error 1
CAFFE_LIB variable is to point to the path where caffe.so or caffe.a is present. In your case, the dcnn.cpp cannot find the header files.
Though the header files are present in /something/PACHI_GO_ENGINE/caffe/distribute/include they won't be detected by pachi because, header file paths are mentioned using the variable INCLUDES. You will have to append this path to the INCLUDES variable and not the CAFFE_LIB.

.os file unrecognized while building glibc

While building glibc, I get this error.
*glibc/build/elf/dl-allobjs.os: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status*
What is an .os file and what binutil do I need to install to fix this?
What is an .os file
It's just an object file, intended to be linked into a shared library. UNIX linkers for the most part don't care about file extension, you can call file foo.o, foo.oS, or just about anything else, it would still work.
what binutil do I need to install to fix this?
It's unlikely that your problem has anything to do with binutils. It is more likely that the file got corrupted somehow.
What does file glibc/build/elf/dl-allobjs.os report? Are you cross-compiling? Does the problem reproduce if you reconfigure and rebuild in a different directory?

GPL Ghostscript build mac os x framework from source error?

I download the GPL Ghsotscript9.00 from sourceforge.net, and try to bulid source as framework in mac, the steps as the help document about make, such as: copy macosx.mak to the top-level directory, rename it to makefile and issue 'make framework' from Terminal.app. then the procedure ends with this:
./base/gsicc_create.c: At top level:
./base/gsicc_create.c:242: warning: ‘gsicc_diagmatrix_init’ defined but not used
./base/gsicc_create.c:294: warning: ‘cie_is_lab’ defined but not used
./base/gsicc_create.c:542: warning: ‘swapbytes32’ defined but not used
./base/gsicc_create.c:692: warning: ‘add_desc_tag’ defined but not used
./base/gsicc_create.c:714: warning: ‘add_text_tag’ defined but not used
./base/gsicc_create.c:1382: warning: ‘add_tabledata’ defined but not used
make[1]: *** No rule to make target `obj/../soobj/lcms.dev', needed by `obj/../soobj/sicclib.dev'. Stop.
make: *** [so] Error 2
I don't know why the official file can't work? Maybe there are some operations I need to do before making, but how?
Thanks.
Please try the latest 9.04 from http://www.ghostscript.com/download (this is the top level page, actual
source download from http://downloads.ghostscript.com/public/ghostscript-9.04.tar.gz )
If you continue to have problems, please post the issue at http://bugs.ghostscript.com
We have several Artifex staff developers that work on macosx that build regularly, but they may not build the
shared obj lib regularly.

Resources