@/tmp/gcc-arguments0.txt: No such file or directory

Hi,

I have been able to use successfully the previous build for cross compiling embedded C. After upgrading to the current one, I am getting the following CMake: Problems Tab

Error:Configuration dialer [Debug]
Compiler exited with error code 1 (/home/fe1/fe1/cws/uc_nios2/nios2/bin/nios2-linux-uclibc-gcc "-DEMBED" "-D__adjtimex=adjtimex" "-D__linux__" "-D__uClinux__" "-Dlinux" "-Dunix" "-I/home/fe1/fe1/cws/uc_nios2/nios2/include" "-I/home/fe1/fe1/cws/uc_nios2/uClinux-dist" "-I/home/fe1/fe1/cws/uc_nios2/uClinux-dist/linux-2.6.x/include" "-I/home/fe1/fe1/cws/uc_nios2/uClinux-dist/staging/usr/include" "-Wall" "-O2" "-g" "-fno-builtin" "-D___CIDR_IGNORE_DEFINITIONS_START" "-xc" "-v" "-dD" "-E" "-")
nios2-linux-uclibc-gcc: @/tmp/gcc-arguments0.txt: No such file or directory
nios2-linux-uclibc-gcc: no input files

This is part of my CMakeLists which was working fine until this clion build

 
set(CMAKE_SYSTEM_NAME Generic)
set(NIOS2_GCC /home/fe1/fe1/cws/uc_nios2/nios2)
set(GCC_BIN ${NIOS2_GCC}/bin)
set(SUPPORT_FILE_DIRECTORY ${NIOS2_GCC}/include)
set(CMAKE_C_COMPILER ${GCC_BIN}/nios2-linux-uclibc-gcc)

set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
add_definitions(-Wall -O2 -g -fno-builtin -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED -D__adjtimex=adjtimex)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-d -Wl,-elf2flt")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
3 comments
Comment actions Permalink

The problem is that you are working with the nios2-linux-uclibc-gcc compiler.
nios2-linux-uclibc-gcc does not support the option "read switches from the file" that needs for correct cross-platform gcc compilation.

To restore the CLion functioning you need to write understudy script for nios2-linux-uclibc-gcc that reads the options file @/tmp/gcc-argumentsXXXX.txt and runs original compiler with huge decoded command line.

@
file
Read command-line options from file.  The options read are inserted in place of the original @file option.  If file does not exist, or cannot be read, then the option will be treated literally, and not removed.

Options in file are separated by whitespace.  A whitespace character may be included in an option by surrounding the entire option in either single or double quotes.  Any character (including a backslash) may be included by prefixing the character to be included with a backslash.  The file may itself contain additional @file options; any such options will be processed recursively.

0
Comment actions Permalink

Thank you very much for the reply,

I followed your lead and wrote a python script that would catch the call to gcc. Although I wouldn't get an error on the "Problems" tab, the autocomplete wouldn't properly find the .h files. After some more debuging I found CLION reads the stdout from that initial call, so I just mimic it as a quick fix. If you have a better idea, let me know. Again, thanks for the feedback.

#!/usr/bin/python
import sys
import subprocess
import os

file_path, _ = os.path.split(sys.argv[0])
gcc_bin = os.path.join(file_path, "nios2-linux-uclibc-gcc")
# gcc_bin = "/usr/bin/cc"
gcc_popen = subprocess.Popen([gcc_bin] + sys.argv[1:], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = gcc_popen.wait()
std_err = gcc_popen.stderr.read()
# with open("/tmp/trol2", "a+") as fh:
#     fh.write("-----------------CALL----------------\n")
#     with open(sys.argv[1][1:]) as tmp:
#         fh.write("%s\n=====\n\n" % tmp.read())
#         fh.write(gcc_popen.stdout.read())
if "nios2-linux-uclibc-gcc: no input files" in std_err:
    sys.stdout.write("""
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
COLLECT_GCC_OPTIONS='-D' 'EMBED' '-D' '__adjtimex=adjtimex' '-D' '__linux__' '-D' '__uClinux__' '-D' 'linux' '-D' 'unix' '-g' '-I' '/home/fe1/fe1/cws/uc_nios2/nios2/include' '-I' '/home/fe1/fe1/cws/uc_nios2/uClinux-dist' '-I' '/home/fe1/fe1/cws/uc_nios2/uClinux-dist/linux-2.6.x/include' '-I' '/home/fe1/fe1/cws/uc_nios2/uClinux-dist/staging/usr/include' '-Wall' '-O2' '-g' '-fno-builtin' '-D' '___CIDR_IGNORE_DEFINITIONS_START' '-v' '-dD' '-E' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/4.8/cc1 -E -quiet -v -I /home/fe1/fe1/cws/uc_nios2/nios2/include -I /home/fe1/fe1/cws/uc_nios2/uClinux-dist -I /home/fe1/fe1/cws/uc_nios2/uClinux-dist/linux-2.6.x/include -I /home/fe1/fe1/cws/uc_nios2/uClinux-dist/staging/usr/include -imultiarch x86_64-linux-gnu -D EMBED -D __adjtimex=adjtimex -D __linux__ -D __uClinux__ -D linux -D unix -D ___CIDR_IGNORE_DEFINITIONS_START - -mtune=generic -march=x86-64 -Wall -fno-builtin -g -g -fworking-directory -O2 -fstack-protector -Wformat -Wformat-security -dD
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/home/fe1/fe1/cws/uc_nios2/nios2/include
/home/fe1/fe1/cws/uc_nios2/uClinux-dist
/home/fe1/fe1/cws/uc_nios2/uClinux-dist/linux-2.6.x/include
/home/fe1/fe1/cws/uc_nios2/uClinux-dist/staging/usr/include
/usr/lib/gcc/x86_64-linux-gnu/4.8/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
""")
    sys.exit(0)
sys.stderr.write(std_err)
sys.exit(result)

0
Comment actions Permalink

Maybe you are interested in FAQ
Q: CLion fails to find some of my headers. Where does it search for them?
http://blog.jetbrains.com/clion/2014/09/clion-answers-frequently-asked-questions/

0

Please sign in to leave a comment.