Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emmaken.py doesn't emulate ar correctly #7

Closed
paleozogt opened this issue Apr 27, 2011 · 1 comment
Closed

emmaken.py doesn't emulate ar correctly #7

paleozogt opened this issue Apr 27, 2011 · 1 comment
Labels

Comments

@paleozogt
Copy link

The way that CMake uses the 'ar' tool doesn't seem to be compatible with the way that emmaken.py emulates it.

For example, using helloworld.c:

#include <stdio.h>

int helloworld(void) {
   printf("helloworld \n");
   return 0;
}

and CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)

# these must be set *before* project()
if (EMSCRIPTEN)
    set(EMSCRIPTEN_TOOLS ${EMSCRIPTEN_HOME}/tools)
    SET(CMAKE_C_COMPILER          "${EMSCRIPTEN_TOOLS}/emmaken.py")
    SET(CMAKE_CXX_COMPILER        "${EMSCRIPTEN_TOOLS}/emmaken.py")
    SET(CMAKE_LINKER              "${EMSCRIPTEN_TOOLS}/emmaken.py")
    SET(CMAKE_CXX_LINKER          "${EMSCRIPTEN_TOOLS}/emmaken.py")
    SET(CMAKE_C_LINK_EXECUTABLE   "${EMSCRIPTEN_TOOLS}/emmaken.py")
    SET(CMAKE_CXX_LINK_EXECUTABLE "${EMSCRIPTEN_TOOLS}/emmaken.py")
endif(EMSCRIPTEN)

project(helloworld)

# these must be set *after* project()
if (EMSCRIPTEN)
    SET(CMAKE_AR                  "${EMSCRIPTEN_TOOLS}/emmaken.py")
    SET(CMAKE_RANLIB              "${EMSCRIPTEN_TOOLS}/emmaken.py")
endif(EMSCRIPTEN)

# list of sources
set(SRCS helloworld.c)

# make a lib
add_library(helloworld ${SRCS})

will produce this output:

$ cmake .. -DEMSCRIPTEN=1 -DEMSCRIPTEN_HOME=/home/vail/Development/emscripten; make VERBOSE=1
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vail/Development/helloworld/.build-js
/usr/bin/cmake -H/home/vail/Development/helloworld -B/home/vail/Development/helloworld/.build-js --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/vail/Development/helloworld/.build-js/CMakeFiles /home/vail/Development/helloworld/.build-js/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/vail/Development/helloworld/.build-js'
make -f CMakeFiles/helloworld.dir/build.make CMakeFiles/helloworld.dir/depend
make[2]: Entering directory `/home/vail/Development/helloworld/.build-js'
cd /home/vail/Development/helloworld/.build-js && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/vail/Development/helloworld /home/vail/Development/helloworld /home/vail/Development/helloworld/.build-js /home/vail/Development/helloworld/.build-js /home/vail/Development/helloworld/.build-js/CMakeFiles/helloworld.dir/DependInfo.cmake --color=
Dependee "/home/vail/Development/helloworld/.build-js/CMakeFiles/helloworld.dir/DependInfo.cmake" is newer than depender "/home/vail/Development/helloworld/.build-js/CMakeFiles/helloworld.dir/depend.internal".
Scanning dependencies of target helloworld
make[2]: Leaving directory `/home/vail/Development/helloworld/.build-js'
make -f CMakeFiles/helloworld.dir/build.make CMakeFiles/helloworld.dir/build
make[2]: Entering directory `/home/vail/Development/helloworld/.build-js'
/usr/bin/cmake -E cmake_progress_report /home/vail/Development/helloworld/.build-js/CMakeFiles 1
[100%] Building C object CMakeFiles/helloworld.dir/helloworld.c.o
/home/vail/Development/emscripten/tools/emmaken.py    -o CMakeFiles/helloworld.dir/helloworld.c.o   -c /home/vail/Development/helloworld/helloworld.c
emmaken.py:  /home/vail/Development/emscripten/tools/emmaken.py -o CMakeFiles/helloworld.dir/helloworld.c.o -c /home/vail/Development/helloworld/helloworld.c
emmaken.py:  /home/vail/Development/emscripten/tools/emmaken.py -o CMakeFiles/helloworld.dir/helloworld.c.o -c /home/vail/Development/helloworld/helloworld.c
Running: /home/vail/Development/llvm-gcc-4.2-2.9.source/cbuild/install/bin/llvm-gcc -o CMakeFiles/helloworld.dir/helloworld.c.o -c /home/vail/Development/helloworld/helloworld.c -m32 -U__i386__ -U__x86_64__ -U__SSE__ -UX87_DOUBLE_ROUNDING -UHAVE_GCC_ASM_FOR_X87 -emit-llvm -c
Linking C static library libhelloworld.a
/usr/bin/cmake -P CMakeFiles/helloworld.dir/cmake_clean_target.cmake
/usr/bin/cmake -E cmake_link_script CMakeFiles/helloworld.dir/link.txt --verbose=1
/home/vail/Development/emscripten/tools/emmaken.py cr libhelloworld.a  CMakeFiles/helloworld.dir/helloworld.c.o
emmaken.py:  /home/vail/Development/emscripten/tools/emmaken.py cr libhelloworld.a CMakeFiles/helloworld.dir/helloworld.c.o
emmaken.py:  /home/vail/Development/emscripten/tools/emmaken.py cr libhelloworld.a CMakeFiles/helloworld.dir/helloworld.c.o
Running: /home/vail/Development/llvm-2.9/cbuild/bin/llvm-link cr libhelloworld.a CMakeFiles/helloworld.dir/helloworld.c.o
/home/vail/Development/llvm-2.9/cbuild/bin/llvm-link: cr: Could not open input file: No such file or directory
/home/vail/Development/llvm-2.9/cbuild/bin/llvm-link: error loading file 'cr'
make[2]: *** [libhelloworld.a] Error 1
make[2]: Leaving directory `/home/vail/Development/helloworld/.build-js'
make[1]: *** [CMakeFiles/helloworld.dir/all] Error 2
make[1]: Leaving directory `/home/vail/Development/helloworld/.build-js'
make: *** [all] Error 2
@kripken
Copy link
Member

kripken commented Apr 28, 2011

Fixed in rev 1b2b60f

@kripken kripken closed this as completed Apr 28, 2011
@juj juj added the CMake label Jul 28, 2014
tlively pushed a commit to tlively/emscripten that referenced this issue Mar 23, 2022
steveisok pushed a commit to steveisok/emscripten that referenced this issue Sep 18, 2023
…505.2 (emscripten-core#7)

[dotnet/main] Update dependencies from dotnet/arcade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants