- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@ :~/cilk_plus_tests/fibonacci $ gcc -v Using built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/raid/home//repository/sw/cilk_build/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper Target: x86_64-unknown-linux-gnuConfigured with: ./configure --prefix=/home//repository/sw/cilk_build/ Thread model: posixgcc version 4.8.0 20120408 (experimental) (GCC)
1. GMP2. MPFR3. MPC4. Libelf5. GCC6. Binutils
#include#include#include#includeint fib(long long int n){long long int x, y;if (n < 2)return n;else{x = cilk_spawn fib(n-1);y = cilk_spawn fib(n-2);cilk_sync;return x + y;}}int main(int argc, char *argv[]){int n;long long int result;n = atoi(argv[1]);result = fib(n);printf("%d\\t%dn", n, result);return 0;}
/tmp/ccg1ZjDO.s: Assembler messages:/tmp/ccg1ZjDO.s: Error: .size expression for fib does not evaluate to a constant/tmp/ccg1ZjDO.s: Error: .size expression for __cilk_spawn_001.2925 does not evaluate to a constant/tmp/ccg1ZjDO.s: Error: .size expression for __cilk_spawn_002.2942 does not evaluate to a constantmake: *** [build] Error 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rahul,
If you want to use static please compile with g++. Also make sure that "-static" is the first argument after g++.You may geta warning, but I think you can ignore it.
Here is what I did to compile (Please note that my build directory is ./install-test):
Then I set LD_LIBRARY_PATH the following way:
Then I executed the executable and I got the following result (I added a "\\n" in the printf for clarity):
Thanks,
Balaji V. Iyer.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please tell me a bit about your environment? Are you trying to build a cross compiler? Why are you building binutils? If you want to build binutils, you must do that before you build the compiler and make sure the compiler points to the correct binutils (using --with-as command and making sure the path is set correctly to the install directory). Generally the host system binutils will suffice (assuming you are NOT building a cross compiler or making any assembler changes). I think the reason why you are getting this problem is because the assembler that was present when the compiler was built is different from the assembler that is present when you are trying to build the executable.
I hope this helps!
Thanks,
Balaji V. Iyer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Linux2.6.32-40-generic #87-Ubuntu SMP Tue Mar 6 00:56:56 UTC 2012 x86_64 GNU/Linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
$BUILD_PATH/gcc -g -o parallel_static fib_cilk.c -static -I $BUILD_PATH/include/ -L $LD_LIBRARY_PATH/libcilkrts.a
/tmp/ccyrQw40.o: In function `fib':/home//cilk_plus_tests/fibonacci/fib_cilk.c:17: undefined reference to `__cilkrts_enter_frame' /home//cilk_plus_tests/fibonacci/fib_cilk.c:32: undefined reference to `__cilkrts_sync' /home//cilk_plus_tests/fibonacci/fib_cilk.c:17: undefined reference to `__cilkrts_sync' /home//cilk_plus_tests/fibonacci/fib_cilk.c:17: undefined reference to `__cilkrts_leave_frame' /tmp/ccyrQw40.o: In function `__cilk_spawn_001.2925':/home//cilk_plus_tests/fibonacci/fib_cilk.c:59: undefined reference to `__cilkrts_enter_frame' /home//cilk_plus_tests/fibonacci/fib_cilk.c:26: undefined reference to `__cilkrts_leave_frame' /tmp/ccyrQw40.o: In function `__cilk_spawn_002.2942':/home//cilk_plus_tests/fibonacci/fib_cilk.c:26: undefined reference to `__cilkrts_enter_frame' /home//cilk_plus_tests/fibonacci/fib_cilk.c:29: undefined reference to `__cilkrts_leave_frame' collect2: error: ld returned 1 exit status
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The best way to build executables are to do the following:
$BUILD_DIR/bin/gcc -ldl -lcilkrts
In your case add the 2 flags I have indicated in bold. You do not need to explicitly point to the include and load directories.
$BUILD_PATH/gcc -g -o parallel_static fib_cilk.c -static -lcilkrts -ldl
Thanks,
Balaji V. Iyer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
$(BUILD)/gcc fib_cilk.c -g -o parallel_static -static -l $LD_LIBRARY_PATH/libcilkrts.a
collect2: error: ld returned 1 exit status
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rahul,
If you want to use static please compile with g++. Also make sure that "-static" is the first argument after g++.You may geta warning, but I think you can ignore it.
Here is what I did to compile (Please note that my build directory is ./install-test):
Then I set LD_LIBRARY_PATH the following way:
Then I executed the executable and I got the following result (I added a "\\n" in the printf for clarity):
Thanks,
Balaji V. Iyer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am glad to hear it worked!
Thanks,
Balaji V. Iyer.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page