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

Compiling error on windows 10 #77

Open
deb75 opened this issue May 27, 2021 · 5 comments
Open

Compiling error on windows 10 #77

deb75 opened this issue May 27, 2021 · 5 comments
Assignees
Labels

Comments

@deb75
Copy link

deb75 commented May 27, 2021

Hello,

I am trying to get detox (1.4.2) working on windows 10 through the msys2/mingw64 (latest) tool chain.

Currently, I run into the compiling error :

parse_table.c: In function 'parse_table':
parse_table.c:60:28: error: 'struct stat' has no member named 'st_blocks'
   60 |   size = (512 * ttable_stat.st_blocks);
        |                            ^

It seems that the stat structure on win32 does not have the same attributes than in GNU/linux.

Probably a quick workaround would be to wrap this error within preprocessing directives.

Let me know if this is possible and when you can do it. I will try again then

Regards

@dharple
Copy link
Owner

dharple commented May 27, 2021

Thanks for letting me know! It's definitely possible. It could take a few weeks for me to have the time to test a fix for this issue due to other commitments. In the meantime, please try this quick workaround and let me know if you run in to other problems with building detox. If you're not familiar with how to use patch, just let me know.

detox-workaround-issue-77.patch.txt

Thanks!

@dharple
Copy link
Owner

dharple commented Jul 24, 2021

A fix for this issue was released in v1.4.3.

I set up msys2 on a testing box, but I was unable to reproduce the stat issues on this testing box using v1.4.2. So, if this problem is still happening for you in v1.4.3, please let me know and we'll debug it further.

Thanks!

@deb75
Copy link
Author

deb75 commented Aug 18, 2021

Hello,

Sorry for answeering late.

I tried again with windows 10 / msys2 (both updated) :

# Open an msys2 shell (not mingw64)
# Get latest zip archive
./configure --prefix=/usr/local
make

But I run into this issue :

detox.c: In function 'main':
detox.c:97:19: error: implicit declaration of function 'lstat'; did you mean 'wstat'? [-Werror=implicit-function-declaration]
   97 |             err = lstat(file_walk, &stat_info);
      |                   ^~~~~
      |                   wstat
cc1.exe: all warnings being treated as errors

I fixed this by removing Werror from src/Makefile. Then, the compilation goes on but seems to fail at the end :

gcc -DDATADIR=\"/usr/local/share\" -DSYSCONFDIR=\"/usr/local/etc\" -DYY_NO_INPUT -DYY_NO_UNPUT -D_FORTIFY_SOURCE=2 -Wall -g -O2 -flto=auto -fstack-clash-protection -fstack-protector-strong   -o detox.exe config_file_yacc.o config_file_lex.o builtin_table.o clean_string.o clean_utf_8.o config_file.o config_file_dump.o config_file_spoof.o detox.o file.o filelist.o filter.o parse_options.o parse_table.o sequence.o table.o wrapped.o
make: l'option « -j » prend en argument un entier positif
Utilisation : make [options] [cible] ...
Options :
  -b, -m                      Ignoré pour compatibilité.
  -B, --always-make           Fabriquer toutes les cibles sans condition.
  -C RÉPERTOIRE, --directory=RÉPERTOIRE
                              Se placer dans le RÉPERTOIRE avant toute action.
  -d                          Afficher beaucoup d'informations de débogage.
  --debug[=FLAGS]             Afficher divers types d'informations de débogage.
  -e, --environment-overrides
                              Les variables d'environment sont prioritaires sur les makefiles.
  -E STRING, --eval=STRING    Evaluate STRING as a makefile statement.
  -f FICHIER, --file=FICHIER, --makefile=FICHIER
                              Lire le FICHIER comme un makefile.
  -h, --help                  Afficher ce message et quitter.
  -i, --ignore-errors         Ignorer les erreurs venant des recettes.
  -I RÉPERTOIRE, --include-dir=RÉPERTOIRE
                              Chercher dans le RÉPERTOIRE les makefiles traités par inclusion.
  -j [N], --jobs[=N]          Autoriser N tâches simultanées ; nombre infini si utilisé sans argument.
  -k, --keep-going            Poursuivre même si certaines cibles n'ont pas pu être fabriquées.
  -l [N], --load-average[=N], --max-load[=N]
                              Ne pas lancer de tâches multiples à moins que la charge soit inférieure à N.
  -L, --check-symlink-times   Utiliser le « mtime » le plus récent entre les liens symboliques et la cible.
  -n, --just-print, --dry-run, --recon
                              N'exécuter aucune recette ; seulement les afficher.
  -o FICHIER, --old-file=FICHIER, --assume-old=FICHIER
                              Considérer le FICHIER comme étant très ancien et ne pas le refabriquer.
  -O[TYPE], --output-sync[=TYPE]
                              Synchronise la sortie des tâches parallèles par TYPE.
  -p, --print-data-base       Afficher la base de données interne de make.
  -q, --question              Ne pas exécuter de recette ; le code de sortie indique si la cible est à jour.
  -r, --no-builtin-rules      Désactiver les règles implicites internes.
  -R, --no-builtin-variables  Désactiver les réglages des variables internes.
  -s, --silent, --quiet       Ne pas répéter les recettes.
  --no-silent                 Echo recipes (disable --silent mode).
  -S, --no-keep-going, --stop
                              Désactiver -k.
  -t, --touch                 Assigner l'heure actuelle aux cibles au lieu de les refabriquer.
  --trace                     Afficher les traces mémoire.
  -v, --version               Afficher le numéro de version de make et quitter.
  -w, --print-directory       Afficher le répertoire courant.
  --no-print-directory        Désactiver l'option -w, même si elle a été activée implicitement.
  -W FICHIER, --what-if=FICHIER, --new-file=FICHIER, --assume-new=FICHIER
                              Considérer le FICHIER comme étant toujours nouveau.
  --warn-undefined-variables  Prévenir lorsqu'une variable non définie est référencée.

Ce programme est construit pour x86_64-pc-msys
Signaler les anomalies à <bug-make@gnu.org>.
lto-wrapper.exe: fatal error: make returned 2 exit status
compilation terminated.
D:/xxx/Documents/utils/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: error: lto-wrapper failed
collect2.exe: error: ld returned 1 exit status
make[2]: *** [Makefile:510 : detox.exe] Erreur 1
make[2] : on quitte le répertoire « /c/Users/xxx/work/detox-main/src »
make[1]: *** [Makefile:407 : all] Erreur 2
make[1] : on quitte le répertoire « /c/Users/xxx/work/detox-main/src »
make: *** [Makefile:544 : all-recursive] Erreur 1

Some comments are in french, but mainly there seem to have an issue at linking stage.

Do you run into theses troubles ?

Regards

@dharple
Copy link
Owner

dharple commented Aug 19, 2021

Thanks for the update. No worries; I can read some of the messages in French, and Google Translate will fill in the rest.

I've seen the first error; I think it was caused by a missing dependency. I'll see if I can track it down.

The second issue, with -Werror disabled, is truly strange. You didn't specify -j on the command line.

I'll look in to this soon.

@dharple dharple reopened this Aug 19, 2021
@dharple
Copy link
Owner

dharple commented Mar 31, 2024

Sorry for the delay. I no longer have a machine I can test MSYS2 on, but I think I can start to work on this. MSYS2 doesn't have lstat(), and it sounds like it never will, which is weird, but out of scope of detox.

Reference: https://sourceforge.net/p/mingw/mailman/mingw-users/thread/CA%2Bsc5mm_OqAOh%3DFTVPvJXPo2F-ooiFkz3rnnNcsGJs5sPwpEkg%40mail.gmail.com/#msg28861304

So, I need to update autoconf to check to see if lstat() is available, and if not, use stat instead. That part is easy, but I also need to confirm that it works as expected (e.g. detox reviews the link's name, not the linked file's name).

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

2 participants