Giter Site home page Giter Site logo

-Wformat error about wac HOT 4 CLOSED

kanaka avatar kanaka commented on September 4, 2024
-Wformat error

from wac.

Comments (4)

IngwiePhoenix avatar IngwiePhoenix commented on September 4, 2024

Also as a side note, on Mac OS, this happens later on:

[email protected] ~/W/g/wac $ emmake make 
gcc  -DPLATFORM=1 -std=gnu99 -m32 -g -c wa.c -o wa.o
gcc  -DPLATFORM=1 -std=gnu99 -m32 -g -c util.c -o util.o
gcc  -DPLATFORM=1 -std=gnu99 -m32 -g -c thunk.c -o thunk.o
gcc  -DPLATFORM=1 -std=gnu99 -m32 -g -c platform_libc.c -o platform_libc.o
platform_libc.c:18:53: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
        FATAL("Could not allocate %d bytes for %s", (int)nmemb * size, name);
                                  ~~                ^~~~~~~~~~~~~~~~~
                                  %lu
./util.h:20:21: note: expanded from macro 'FATAL'
    fprintf(stderr, __VA_ARGS__); exit(1); \
                    ^~~~~~~~~~~
platform_libc.c:28:53: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
        FATAL("Could not allocate %d bytes for %s", (int)nmemb * size, name);
                                  ~~                ^~~~~~~~~~~~~~~~~
                                  %lu
./util.h:20:21: note: expanded from macro 'FATAL'
    fprintf(stderr, __VA_ARGS__); exit(1); \
                    ^~~~~~~~~~~
2 warnings generated.
ar rcs wa.a wa.o util.o thunk.o platform_libc.o
gcc  -DPLATFORM=1 -std=gnu99 -m32 -g -c wac.c -o wac.o
gcc  -DPLATFORM=1 -std=gnu99 -m32 -g -rdynamic -Wl,--no-as-needed -o wac \
	    -Wl,--start-group wa.a wac.o -Wl,--end-group -lm -ldl -ledit
ld: unknown option: --no-as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [wac] Error 1

from wac.

kanaka avatar kanaka commented on September 4, 2024

@IngwiePhoenix I wasn't seeing those warning with my version of gcc (5.4.0) but I've pushed changes that should fix that. Can you check and verify that it builds for you?

from wac.

IngwiePhoenix avatar IngwiePhoenix commented on September 4, 2024

On OS X, the default compiler is LLVM Clang. Howeve,r as you mentioned GCC, I decided to change my make invocation into this:

[email protected] ~/W/g/wac $ env HOST_CC=/usr/local/opt/gcc/bin/gcc-8 CFLAGS="-I "(xcrun --show-sdk-path)/usr/include make
/usr/local/opt/gcc/bin/gcc-8 -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -DPLATFORM=1 -std=gnu99 -m32 -g -c wa.c -o wa.o
/usr/local/opt/gcc/bin/gcc-8 -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -DPLATFORM=1 -std=gnu99 -m32 -g -c util.c -o util.o
/usr/local/opt/gcc/bin/gcc-8 -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -DPLATFORM=1 -std=gnu99 -m32 -g -c thunk.c -o thunk.o
/usr/local/opt/gcc/bin/gcc-8 -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -DPLATFORM=1 -std=gnu99 -m32 -g -c platform_libc.c -o platform_libc.o
ar rcs wa.a wa.o util.o thunk.o platform_libc.o
/usr/local/opt/gcc/bin/gcc-8 -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -DPLATFORM=1 -std=gnu99 -m32 -g -c wac.c -o wac.o
/usr/local/opt/gcc/bin/gcc-8 -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -DPLATFORM=1 -std=gnu99 -m32 -g -rdynamic -Wl,--no-as-needed -o wac \
	    -Wl,--start-group wa.a wac.o -Wl,--end-group -lm -ldl -ledit
ld: unknown option: --no-as-needed
collect2: error: ld returned 1 exit status
make: *** [wac] Error 1

Note, I am using the Fish shell - that is why the command substition is a little bit off and weird-looking.

But as you see, warnings gone! :)

from wac.

kanaka avatar kanaka commented on September 4, 2024

That means that the ld on OS X doesn't support the --no-as-needed flag. I suspect that you can probably drop that flag and you should be okay. It might not be needed on Linux (I think --no-as-needed is default but there was a valid reason I needed it in the past). But it will probably be a while before I can around to testing that for sure. I'm going to close the bug for now since the issue is specific to OS X ld.

from wac.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.