Thanks Alon !

-o main.o is the same as -o main, but we can test with -o *.js 

On Monday, August 12, 2019 at 10:42:37 PM UTC+2, Alon Zakai wrote:
>
> The issue is that
>
> emcc main.c -o main
>
> will emit an object file to main. This behavior is different than clang 
> and gcc, as emcc uses the suffix to decide what to emit: if it sees -o 
> main.js it will link to JS, and would error on the missing foo. But without 
> a recognizable suffix it emits an object file, and then there is no link 
> error.
>
> This can be confusing and perhaps we should make it more standard (the 
> original reasons behind it are probably no longer relevant). Meanwhile, the 
> workaround is to do such tests with -o main.o (specifying a suffix).
>
> - Alon
>
>
> On Mon, Aug 12, 2019 at 7:46 AM Mehdi Sabwat <[email protected] 
> <javascript:>> wrote:
>
>> Hi, 
>>
>> I am trying to cross-compile ffmpeg, and I have an issue with:
>>
>> sched_getaffinity (undefined symbol)
>>
>> eventhough the test succeeds:
>> Enter code here...check_func sched_getaffinity
>> test_ld cc
>> test_cc
>> BEGIN /tmp/ffconf.PhRaCAYu/test.c
>>     1   extern int sched_getaffinity();
>>     2   int main(void){ sched_getaffinity(); }
>> END /tmp/ffconf.PhRaCAYu/test.c
>> emcc 
>> -I/home/b1ue/b1ue/workdir_vlc/vlc/contrib/wasm32-unknown-emscripten/include 
>> -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -
>> D_POSIX_C_SOURCE=200112 -D_\
>> XOPEN_SOURCE=600 -I/home/b1ue/b1ue/workdir_vlc/vlc/contrib/wasm32-unknown
>> -emscripten/include -g -O2 -s USE_PTHREADS=1 -std=c11 -fomit-frame-pointer 
>> -c -o /tmp/ffconf.PhR\
>> aCAYu/test.o /tmp/ffconf.PhRaCAYu/test.c
>> emcc -L/home/b1ue/b1ue/workdir_vlc/vlc/contrib/wasm32-unknown-emscripten/lib 
>> -L/home/b1ue/b1ue/workdir_vlc/vlc/contrib/wasm32-unknown-emscripten/lib -
>> Wl,--as-needed -Wl,\
>> -z,noexecstack -o /tmp/ffconf.PhRaCAYu/test /tmp/ffconf.PhRaCAYu/test.o
>>
>>
>> I have this test that is giving me weird results.
>>
>> main.c:
>> extern int  foo();
>>
>> //int  foo();
>> main()
>> {
>>   foo();
>>   return 0;
>> }
>>
>>
>> this code compiles with: 
>> emcc main.c -o main
>>
>> it shouldn't because this function was never defined. We would think it 
>> is because in the first example we compiled with -c and then linked (which 
>> works the same, ie. doesn't give any error), but I have a case where the 
>> configure test does not use -c and fails.
>>
>> example :
>> configure:45053: checking for shmat
>>
>> configure:45053: emcc -o conftest -g -O2  -Werror=unknown-warning-option 
>> -Werror=invalid-command-line-argument -D__NEED_ssize_t -s USE_PTHREADS=1 
>> -I/home/b1ue/vlc/vlc/co\
>> ntrib/wasm32-unknown-emscripten/include -Wall -Wextra -Wsign-compare -Wundef 
>> -Wpointer-arith -Wvolatile-register-var -Wformat -Wformat-security 
>> -Wbad-function-cast -Wwri\
>> te-strings -Wmissing-prototypes -Werror-implicit-function-declaration 
>> -Winit-self -pipe -fvisibility=hidden -fno-math-errno 
>> -funsafe-math-optimizations -funroll-loops  -\
>> I/home/b1ue/vlc/vlc/contrib/wasm32-unknown-emscripten/include  
>> -L/home/b1ue/vlc/vlc/contrib/wasm32-unknown-emscripten/lib -Wl,-z,defs 
>> conftest.c  >&5
>> emscripten:warning: Wasm source map won't be usable in a browser without 
>> --source-map-base
>> error: undefined symbol: shmat
>> warning: To disable errors for undefined symbols use `-s 
>> ERROR_ON_UNDEFINED_SYMBOLS=0`
>> Error: Aborting compilation due to previous errors
>> shared:ERROR: '/home/b1ue/b1ue/workdir_vlc/emsdk/node/8.9.1_64bit/bin/node 
>> /home/b1ue/b1ue/workdir_vlc/emsdk/upstream/emscripten/src/compiler.js 
>> /tmp/tmppnm5jpew.txt /ho\
>> me/b1ue/b1ue/workdir_vlc/emsdk/upstream/emscripten/src/library_pthread.js' 
>> failed (1)
>> configure:45053: $? = 1
>>
>>
>> thank you 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/emscripten-discuss/6b383a65-2f51-4830-939f-9d7afb1285ef%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/emscripten-discuss/6b383a65-2f51-4830-939f-9d7afb1285ef%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/406e97f1-8364-4767-8d2c-844c69016f4f%40googlegroups.com.

Reply via email to