0

I'm working on writing a C program for the Moxa UC-7110 which runs uCLinux. I have installed the arm-elf-gcc tool chain provided by Moxa, and I'm able to build applications fine so far.

The problem is, I'm somewhat of a novice at C programming and the CMake system. I want to be able to make HTTP GET & POST requests, but the system I'm building for doesn't have libcurl or any similar library. I don't want to write my own, so I'd like to build libcurl or some equivalent for the Moxa, but I don't understand how to get libcurl configured for the cross compiler.

I've downloaded the libcurl source and run:

./configure CC=arm-elf-gcc

but it just fails with:

configure: error: C compiler cannot create executables

Are the basics for cross compiling that I should be aware of? Is there a way to run configure with it knowing I'm cross compiling?

EDIT

I've started running

LDFLAGS="-Wl,-elf2flt" ./configure --build=x86_64-linux-gnu --host=arm-elf

Which should cross compile properly according to the autoconf docs, but it doesn't go into cross compilation mode, and keeps trying to execute the binaries it builds.

checking for arm-elf-gcc... arm-elf-gcc
checking whether the C compiler works... no
configure: error: in `/home/mcantrell/curl-7.37.0':
configure: error: C compiler cannot create executables
artless noise
  • 21,212
  • 6
  • 68
  • 105
hukir
  • 1,733
  • 1
  • 9
  • 13
  • You don't want to change `CC`, but rather something like `ARCH`. Search around, there's plenty of information on cross compiling out there. – Kerrek SB Jun 12 '14 at 01:05
  • So if I just pass `ARCH=ARM9` that should cover it? – hukir Jun 12 '14 at 01:12
  • 1
    Possible duplicate http://stackoverflow.com/questions/15234959/cross-compiling-for-arm-with-autoconf – harmic Jun 12 '14 at 01:24
  • @harmic That post is helpful, but doesn't provide enough to fix my problem. I've updated my question with more information, and I'm now providing build and host args to autoconf, but it's still trying to build and test binaries, suggesting autoconf isn't in cross compile mode for some reason. – hukir Jun 12 '14 at 01:49
  • The option is something like `--target=` or `--host=`. Try `./configure --help` and look for cross-compilation options. – tangrs Jun 12 '14 at 10:12
  • 1
    This is covered in the docs/INSTALL in the curl source tree. Follow that and if that doesn't work, tell us exactly what you did and what didn't work. – Daniel Stenberg Jun 12 '14 at 11:42
  • In particular, [CROSS COMPILE section](https://github.com/bagder/curl/blob/master/docs/INSTALL#L878) of *docs/INSTALL*. The option `--with-random=/dev/urandom`, maybe useful with version **7.22** and maybe other versions. You need libraries compiled for the ARM, that libcurl may depend on, such as OpenSSL if you are using `--with-ssl`. – artless noise Jun 12 '14 at 15:18

0 Answers0