1
votes

I have a project which has an existing scons build system for Ubuntu. I need to modify the scons file so as to compile it for 32-bit.

Tried CC_FLAGS='-m32', HOST_ARCH='x86' and TARGET_ARCH='x86' in environment, these do not help.

Basically I want the same effect as using -m32 option in gcc.

Tried a sample code below with the scons file content given below, still does not help. Appreciate any pointers.

test.c:

#include <stdio.h>

int main()
{
    int a1 = 6;
    char *p1 = (char *)malloc(100);
    printf("Hello, world!\n");
    printf("&a1: %p\n", &a1);
    printf("p1: %p\n", p1);
}

Sconstruct file:

Program('test.c')
Environment(CCFLAGS=['-m32'], TARGET_ARCH='x86', HOST_ARCH='x86')
1

1 Answers

0
votes

It worked with the below scons.

env = Environment(CCFLAGS = '-m32', LINKFLAGS = '-m32')
env.Program('test.c')

Closing this question with this answer.