tpoechtrager / wclang

Cross compile source code easily for Windows with clang on Linux/Unix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[SOLVED] Error when creating object file

opened this issue · comments

Here's the log for default command that links executable, it will give the following error:

$ w32-clang main.c -o main.exe
/tmp/main-420ff2.s: Assembler messages:
/tmp/main-420ff2.s:1: Error: unknown pseudo-op: `.def'
/tmp/main-420ff2.s:2: Error: unknown pseudo-op: `.scl'
/tmp/main-420ff2.s:3: Error: Missing symbol name in directive
/tmp/main-420ff2.s:4: Error: unknown pseudo-op: `.endef'
/tmp/main-420ff2.s:5: Error: expected symbol name
/tmp/main-420ff2.s:6: Error: junk at end of line, first unrecognized character is `@'
/tmp/main-420ff2.s:7: Error: unknown pseudo-op: `.def'
/tmp/main-420ff2.s:8: Error: unknown pseudo-op: `.scl'
/tmp/main-420ff2.s:9: Error: Missing symbol name in directive
/tmp/main-420ff2.s:9: Error: unrecognized symbol type "32"
/tmp/main-420ff2.s:10: Error: unknown pseudo-op: `.endef'
/tmp/main-420ff2.s:30: Error: unknown pseudo-op: `.def'
/tmp/main-420ff2.s:31: Error: unknown pseudo-op: `.scl'
/tmp/main-420ff2.s:32: Error: Missing symbol name in directive
/tmp/main-420ff2.s:32: Error: unrecognized symbol type "32"
/tmp/main-420ff2.s:33: Error: unknown pseudo-op: `.endef'
/tmp/main-420ff2.s:68: Fatal error: bad .section directive: want a,w,x,M,S,G,T in string
clang: error: assembler (via gcc) command failed with exit code 1 (use -v to see invocation)

If I enable mingw linker:

w32-clang main.c -o main.exe -wc-use-mingw-linker

All is fine! Executable is created. Now let's try to create object file:

$ w32-clang -c main.c -o main.obj
/tmp/main-7f4d85.s: Assembler messages:
/tmp/main-7f4d85.s:1: Error: unknown pseudo-op: `.def'
/tmp/main-7f4d85.s:2: Error: unknown pseudo-op: `.scl'
/tmp/main-7f4d85.s:3: Error: Missing symbol name in directive
/tmp/main-7f4d85.s:4: Error: unknown pseudo-op: `.endef'
/tmp/main-7f4d85.s:5: Error: expected symbol name
/tmp/main-7f4d85.s:6: Error: junk at end of line, first unrecognized character is `@'
/tmp/main-7f4d85.s:7: Error: unknown pseudo-op: `.def'
/tmp/main-7f4d85.s:8: Error: unknown pseudo-op: `.scl'
/tmp/main-7f4d85.s:9: Error: Missing symbol name in directive
/tmp/main-7f4d85.s:9: Error: unrecognized symbol type "32"
/tmp/main-7f4d85.s:10: Error: unknown pseudo-op: `.endef'
/tmp/main-7f4d85.s:30: Error: unknown pseudo-op: `.def'
/tmp/main-7f4d85.s:31: Error: unknown pseudo-op: `.scl'
/tmp/main-7f4d85.s:32: Error: Missing symbol name in directive
/tmp/main-7f4d85.s:32: Error: unrecognized symbol type "32"
/tmp/main-7f4d85.s:33: Error: unknown pseudo-op: `.endef'
/tmp/main-7f4d85.s:68: Fatal error: bad .section directive: want a,w,x,M,S,G,T in string
clang: error: assembler (via gcc) command failed with exit code 1 (use -v to see invocation)

Adding -wc-use-mingw-linker gives the same result:

$ w32-clang -c main.c -o main.obj -wc-use-mingw-linker
/tmp/main-7454e1.s: Assembler messages:
/tmp/main-7454e1.s:1: Error: unknown pseudo-op: `.def'
/tmp/main-7454e1.s:2: Error: unknown pseudo-op: `.scl'
/tmp/main-7454e1.s:3: Error: Missing symbol name in directive
/tmp/main-7454e1.s:4: Error: unknown pseudo-op: `.endef'
/tmp/main-7454e1.s:5: Error: expected symbol name
/tmp/main-7454e1.s:6: Error: junk at end of line, first unrecognized character is `@'
/tmp/main-7454e1.s:7: Error: unknown pseudo-op: `.def'
/tmp/main-7454e1.s:8: Error: unknown pseudo-op: `.scl'
/tmp/main-7454e1.s:9: Error: Missing symbol name in directive
/tmp/main-7454e1.s:9: Error: unrecognized symbol type "32"
/tmp/main-7454e1.s:10: Error: unknown pseudo-op: `.endef'
/tmp/main-7454e1.s:30: Error: unknown pseudo-op: `.def'
/tmp/main-7454e1.s:31: Error: unknown pseudo-op: `.scl'
/tmp/main-7454e1.s:32: Error: Missing symbol name in directive
/tmp/main-7454e1.s:32: Error: unrecognized symbol type "32"
/tmp/main-7454e1.s:33: Error: unknown pseudo-op: `.endef'
/tmp/main-7454e1.s:68: Fatal error: bad .section directive: want a,w,x,M,S,G,T in string
clang: error: assembler (via gcc) command failed with exit code 1 (use -v to see invocation)

Any ideas?

Ok, I'm not sure how right this will be, but it fixes the issue:

--- wclang.cpp
+++ wclang.cpp
@@ -1111,7 +1111,7 @@
                 {
                     auto usemingwlinker = [](commandargs &cmdargs, char *arg)
                     {
-                        if (!cmdargs.islinkstep)
+                        if (!cmdargs.islinkstep && !cmdargs.iscompilestep)
                         {
                             if (cmdargs.verbose)
                                 verbosemsg("ignoring %", arg);
@@ -1153,12 +1153,7 @@
         #undef INVALID_ARGUMENT
     }

-    if (cmdargs.islinkstep && cmdargs.iscompilestep)
-    {
-        /* w32-clang file.c -c -o file.o */
-        cmdargs.islinkstep = false;
-    }
-    else if (!cmdargs.islinkstep && !cmdargs.iscompilestep)
+    if (!cmdargs.islinkstep && !cmdargs.iscompilestep)
     {
         /* w32-clang file.c */
         cmdargs.islinkstep = true;
$ w32-clang -c main.c -o main.obj -wc-use-mingw-linker
$ nm main.obj
00000000 b .bss
00000000 d .data
00000000 T _main
         U ___main
00000000 r .rdata$zzz
00000000 t .text

Wrong assembler.

Please post your clang version + the output of w32-clang test.c -wc-verbose -v.

-wc-use-mingw-linker explicitly invokes gcc instead of clang, thus, it should only be used for linking with incompatible flags.

I just downloaded and built MXE and everything works flawlessly for me.

$ i686-w64-mingw32.static-clang test.c -v
clang version 3.5.1 (224377)
Target: i686-w64-windows-gnu
Thread model: posix
 "/opt/compiler/llvm-3.5/bin/clang-3.5" -cc1 -triple i686-w64-windows-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name test.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -v -dwarf-column-info -nostdsysteminc -nobuiltininc -resource-dir /opt/compiler/llvm-3.5/bin/../lib/clang/3.5.1 -isystem /opt/compiler/llvm-3.5/bin/../lib/clang/3.5.1/include -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++ -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++/i686-w64-mingw32.static -fdebug-compilation-dir /home/thomas/tmp -ferror-limit 19 -fmessage-length 237 -mstackrealign -fno-use-cxa-atexit -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/test-859969.o -x c test.c
clang -cc1 version 3.5.1 based upon LLVM 3.5.1svn default target x86_64-unknown-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /opt/compiler/llvm-3.5/bin/../lib/clang/3.5.1/include
 /data/tmp/mxe/usr/i686-w64-mingw32.static/include
 /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++
 /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++/i686-w64-mingw32.static
End of search list.
 "/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-gcc" -nostdinc -isystem /opt/compiler/llvm-3.5/bin/../lib/clang/3.5.1/include -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++ -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++/i686-w64-mingw32.static -v -m32 -o a.out /tmp/test-859969.o
Using built-in specs.
COLLECT_GCC=/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-gcc
COLLECT_LTO_WRAPPER=/data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/lto-wrapper
Target: i686-w64-mingw32.static
Configured with: /data/tmp/mxe/tmp-gcc-i686-w64-mingw32.static/gcc-4.9.2/configure --target=i686-w64-mingw32.static --build=x86_64-unknown-linux-gnu --prefix=/data/tmp/mxe/usr --libdir=/data/tmp/mxe/usr/lib --enable-languages=c,c++,objc,fortran --enable-version-specific-runtime-libs --with-gcc --with-gnu-ld --with-gnu-as --disable-nls --disable-shared --disable-multilib --without-x --disable-win32-registry --enable-threads=win32 --disable-libgomp --with-cloog=/data/tmp/mxe/usr --with-gmp=/data/tmp/mxe/usr --with-isl=/data/tmp/mxe/usr --with-mpc=/data/tmp/mxe/usr --with-mpfr=/data/tmp/mxe/usr --with-as=/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-as --with-ld=/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-ld --with-nm=/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-nm
Thread model: win32
gcc version 4.9.2 (GCC) 
COMPILER_PATH=/data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/:/data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/:/data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/:/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/:/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/:/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/bin/
LIBRARY_PATH=/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/:/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/lib/../lib/:/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/lib/
COLLECT_GCC_OPTIONS='-nostdinc' '-isystem' '/opt/compiler/llvm-3.5/bin/../lib/clang/3.5.1/include' '-isystem' '/data/tmp/mxe/usr/i686-w64-mingw32.static/include' '-isystem' '/data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++' '-isystem' '/data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++/i686-w64-mingw32.static' '-v' '-m32' '-o' 'a.out' '-mtune=generic' '-march=pentiumpro'
 /data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/collect2 -plugin /data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/liblto_plugin.so -plugin-opt=/data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/lto-wrapper -plugin-opt=-fresolution=/tmp/cc7B0SR6.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pe -Bdynamic -o a.out /data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/lib/../lib/crt2.o /data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/crtbegin.o -L/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2 -L/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/lib/../lib -L/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/lib /tmp/test-859969.o -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt /data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/crtend.o

Even with -no-integrated-as

$ i686-w64-mingw32.static-clang test.c -no-integrated-as -v
clang version 3.5.1 (224377)
Target: i686-w64-windows-gnu
Thread model: posix
 "/opt/compiler/llvm-3.5/bin/clang-3.5" -cc1 -triple i686-w64-windows-gnu -S -disable-free -disable-llvm-verifier -main-file-name test.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -no-integrated-as -mconstructor-aliases -target-cpu pentium4 -v -dwarf-column-info -nostdsysteminc -nobuiltininc -resource-dir /opt/compiler/llvm-3.5/bin/../lib/clang/3.5.1 -isystem /opt/compiler/llvm-3.5/bin/../lib/clang/3.5.1/include -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++ -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++/i686-w64-mingw32.static -fno-dwarf-directory-asm -fdebug-compilation-dir /home/thomas/tmp -ferror-limit 19 -fmessage-length 237 -mstackrealign -fno-use-cxa-atexit -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/test-1213ac.s -x c test.c
clang -cc1 version 3.5.1 based upon LLVM 3.5.1svn default target x86_64-unknown-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /opt/compiler/llvm-3.5/bin/../lib/clang/3.5.1/include
 /data/tmp/mxe/usr/i686-w64-mingw32.static/include
 /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++
 /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++/i686-w64-mingw32.static
End of search list.
 "/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-as" --32 -o /tmp/test-d11e73.o /tmp/test-1213ac.s
 "/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-gcc" -nostdinc -isystem /opt/compiler/llvm-3.5/bin/../lib/clang/3.5.1/include -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++ -isystem /data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++/i686-w64-mingw32.static -v -m32 -o a.out /tmp/test-d11e73.o
Using built-in specs.
COLLECT_GCC=/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-gcc
COLLECT_LTO_WRAPPER=/data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/lto-wrapper
Target: i686-w64-mingw32.static
Configured with: /data/tmp/mxe/tmp-gcc-i686-w64-mingw32.static/gcc-4.9.2/configure --target=i686-w64-mingw32.static --build=x86_64-unknown-linux-gnu --prefix=/data/tmp/mxe/usr --libdir=/data/tmp/mxe/usr/lib --enable-languages=c,c++,objc,fortran --enable-version-specific-runtime-libs --with-gcc --with-gnu-ld --with-gnu-as --disable-nls --disable-shared --disable-multilib --without-x --disable-win32-registry --enable-threads=win32 --disable-libgomp --with-cloog=/data/tmp/mxe/usr --with-gmp=/data/tmp/mxe/usr --with-isl=/data/tmp/mxe/usr --with-mpc=/data/tmp/mxe/usr --with-mpfr=/data/tmp/mxe/usr --with-as=/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-as --with-ld=/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-ld --with-nm=/data/tmp/mxe/usr/bin/i686-w64-mingw32.static-nm
Thread model: win32
gcc version 4.9.2 (GCC) 
COMPILER_PATH=/data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/:/data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/:/data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/:/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/:/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/:/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/bin/
LIBRARY_PATH=/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/:/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/lib/../lib/:/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/lib/
COLLECT_GCC_OPTIONS='-nostdinc' '-isystem' '/opt/compiler/llvm-3.5/bin/../lib/clang/3.5.1/include' '-isystem' '/data/tmp/mxe/usr/i686-w64-mingw32.static/include' '-isystem' '/data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++' '-isystem' '/data/tmp/mxe/usr/i686-w64-mingw32.static/include/../../../usr/lib/gcc/i686-w64-mingw32.static/4.9.2/include/c++/i686-w64-mingw32.static' '-v' '-m32' '-o' 'a.out' '-mtune=generic' '-march=pentiumpro'
 /data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/collect2 -plugin /data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/liblto_plugin.so -plugin-opt=/data/tmp/mxe/usr/libexec/gcc/i686-w64-mingw32.static/4.9.2/lto-wrapper -plugin-opt=-fresolution=/tmp/ccw51V5v.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pe -Bdynamic -o a.out /data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/lib/../lib/crt2.o /data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/crtbegin.o -L/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2 -L/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/lib/../lib -L/data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/../../../../i686-w64-mingw32.static/lib /tmp/test-d11e73.o -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt /data/tmp/mxe/usr/lib/gcc/i686-w64-mingw32.static/4.9.2/crtend.o

I am using clang 3.5.1, you are probably using 3.4 or 3.3 since the integrated assembler is enabled by default on later versions.

You may be able to get rid of that error by either:

  • upgrading clang to 3.5.1

or

  • by setting export COMPILER_PATH=/path/to/mxe/usr/bin/ (where i686-w64-mingw32.shared-as is located)

or

  • by symlinking all mxe mingw tools (mxe/usr/bin/*) into the clang binary directory

Ah, yes! You're right, I've used Clang 3.4, it's the default version of Clang on Ubuntu 14.04. I had to enable LLVM's repository to install the latest one and symlink clang-3.5 and clang++-3.5 to clang and clang++ respectively.

Then it throwed these errors:

$ w32-clang main.c
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)

I exported COMPILER_PATH variable with export COMPILER_PATH=/opt/mxe/usr/bin/ and it started to compile executables and object files just fine!

Thank you, Tom!

Can we include a note about Clang 3.5 and COMPILER_PATH global variable in readme?

Ah, yes! You're right, I've used Clang 3.4, it's the default version of Clang on Ubuntu 14.04. I had to > enable LLVM's repository to install the latest one and symlink clang-3.5 and clang++-3.5 to clang and clang++ respectively.

I would avoid that repository, that repository is known to contain broken compilers...

Also ensure it's 3.5.1 and not 3.5.0, 3.5.0 has an annoying bug: http://llvm.org/bugs/show_bug.cgi?id=20746.

You may simply go with: http://llvm.org/releases/3.5.1/clang+llvm-3.5.1-x86_64-linux-gnu.tar.xz.

Can we include a note about Clang 3.5 and COMPILER_PATH global variable in readme?

Yes of course, feel free to do a pull request (for #15 too).