Showing posts with label gcc. Show all posts
Showing posts with label gcc. Show all posts

2012-08-10

Lua output redirection

While ago I was working on Lua based implementation of the scripting library. One of the requirements was a total control of output and error messages, to allow it's automatic handling. One of the issues I've faced is that some output was going to stdout even if there is redefined print Lua function.

I thought about two quick solutions:
- redirect standard streams;
- redefine printf and it's adjacent functions.

Since standard streams, both stdout and stderr, in my case were already redefined (for remote debugging purposes), I didn't had much to choose from.

Looking into Lua 5.1 sources, I've found that stdout was simply hard-coded in some places. During up-streaming this patch to Lua 5.2 surprisingly most of the hard-coded stream names went away, and it looks like it would be possible to use redefined print without losing anything. I haven't tested this though. Following just works for Lua 5.1.x and above.

2011-11-08

Multiple gcc versions on Ubuntu machine

# let the beast in
su

# install the older gcc versions
apt-get install gcc-4.4
apt-get install g++-4.4

# configure
update-alternatives --remove-all gcc
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 44
 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4
 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.4
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 46
 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.6

# switch gcc
update-alternatives --config gcc

2009-09-14

Removing MinGW dll dependencies

libgcc_s_dw2-1.dll

Passing -static-libgcc will remove this dependency for all languages other than C.
Note: C++ exceptions depends on this option.

mingwm10.dll

Remove -mthreads option from your makefile.
Note: Multithreading and C++ exceptions depends on this option.

2009-09-09

How to set up library paths for configure

env CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" ./configure

2009-08-04

How to ARM Linux

During last few years I've never found a good excessive topic covering most of the areas to get Linux runnnig from scratch. I remember myself doing a lot of investigation about correct building of a crosscompiler, studying bootloader internals, and so on... I'm definitely sure - if I had a person that could point me in right direction, then all the development should finish much earlier.

Consider this article as my personal note and feel free using it your own way.

2009-04-30

Mingw on Linux

I'm using MinGW for years, but never tried to use it on Linux machine as a crosscompiler. Today I've had first experience. First thing I've noticed is how actually easy to install such environment - there is a totally automated build script available from MinGW site.
Pros:
  • One environment
  • Speed. Native environment vs MSys is much, much faster.
Cons:
  • Building non-Linux things on Linux means transferring them from one machine to another.

2009-04-27

Icon and version information resource file

This should be an update for one of the recent posts.

resource.rc:
ID ICON "path/to/my.ico"
...the ID can be anything. It doesn't matter unless it is referred in the code.

Run windres as follows:
windres resource.rc -O coff -o resource.o
Include resource.o along with other object files while linking, e.g.,
g++ -o app obj1.o obj2.o resource.o

And, at no extra charge, it is possible to include version information to the application, adding the following boilerplate to resource.rc file:
1 VERSIONINFO
FILEVERSION     1,0,0,0
PRODUCTVERSION  1,0,0,0
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904E4"
        BEGIN
            VALUE "CompanyName", "Company name"
            VALUE "FileDescription", "Application name"
            VALUE "FileVersion", "1.0"
            VALUE "InternalName", "my_app"
            VALUE "LegalCopyright", "Copyright info"
            VALUE "OriginalFilename", "my_app.exe"
            VALUE "ProductName", "My App"
            VALUE "ProductVersion", "1.0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1252
    END
END

Links:
- Original post
- Additional info

Credit goes to Evan McLean.