3
$\begingroup$

I am building a Mathematica interface to my c++ program. My makefile and source are available at github. This is the line that invokes wscc,

wscc -b64 -o math.exe math.tm math.c thermal_funcs.o zeta.o -lgsl -lgslcblas $(MATH_INC)

The *.o object files are linked successfully and math.exe is built by wscc. However, during the compilation stage, it appears that the object files are still passed to my C-compiler (they should only be passed during linking), such that I receive warnings:

math.c: gcc: warning: thermal_funcs.o: linker input file unused because linking not done
gcc: warning: zeta.o: linker input file unused because linking not done
math.exe.tm.c: gcc: warning: thermal_funcs.o: linker input file unused because linking not done
gcc: warning: zeta.o: linker input file unused because linking not done

I guess they are innocuous and the resulting executable math.exe works as expected. You can produce similar warnings by running

gcc -c test.c test.o

upon emtpy files test.c and test.o It seems like a (fairly harmless) bug in wscc, as it shouldn't be passing object files to gcc -c commands. But maybe I am doing something wrong?

$\endgroup$
2
  • $\begingroup$ You do not need to use wscc/mcc. You can use wsprep to "compile" the .tm template to a .c file, then compile that file in a second step (and perhaps do the linking in a third). The point of wscc is to avoid typing multiple commands. If you have a makefile anyway, it's more a hindrance to try to combine everything into a single command. $\endgroup$
    – Szabolcs
    Commented Aug 28, 2017 at 8:37
  • $\begingroup$ Oh I see, thanks. $\endgroup$
    – innisfree
    Commented Aug 28, 2017 at 9:28

1 Answer 1

2
$\begingroup$

In your src/makefile, on the line that contains $(MATH) -b64 ..., change "thermal_funcs.o zeta.o" to "-Wl,thermal_funcs.o,zeta.o" That's a lowercase ell after the W, not the digit 1.

And, then, of course, make math.exe

The man page for gcc describes linker options. "-Wl,options" is a way of passing options directly to the linker. I don't know any more than that.

I tried your makefile, and got the two error messages. Then I tried "-Wl,options" and the error messages went away.

$\endgroup$
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.