Cannot cross compile 32-bit curl apps on x86_64

Asked by Mike Heffner

Cross compiling (-m32) a 32-bit application that relies on libcurl in a 64-bit host fails with:

In file included from /usr/include/curl/curl.h:35,
                 from ....:
/usr/include/curl/curlrules.h:143: error: size of array '__curl_rule_01__' is negative
/usr/include/curl/curlrules.h:153: error: size of array '__curl_rule_02__' is negative

This is due to libcurl's installation of a generated, architecture dependent, header file "curlbuild.h". Design decisions aside, I think the package should handle this so the user doesn't have to install a parallel installation of 32-bit libcurl to cross-compile curl apps.

One possible solution is to the use approach Fedora takes and install both curlbuild.h's side-by-side and switch on __WORDSIZE:

$ ls /usr/include/curl/curlbuild*
/usr/include/curl/curlbuild-32.h /usr/include/curl/curlbuild-64.h /usr/include/curl/curlbuild.h

$ cat /usr/include/curl/curlbuild.h
#include <bits/wordsize.h>

#if __WORDSIZE == 32
#include "curlbuild-32.h"
#elif __WORDSIZE == 64
#include "curlbuild-64.h"
#else
#error "Unknown word size"
#endif

There is also a forum thread discussing this same issue: http://ubuntuforums.org/showthread.php?t=1680426

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

You could use a chroot to compile 32bit apps in 64bit

https://help.ubuntu.com/community/BasicChroot

Can you help with this problem?

Provide an answer of your own, or ask Mike Heffner for more information if necessary.

To post a message you must log in.